0
\$\begingroup\$

I want to implement half adder using FPGA. For this I need to design CLB, more specifically LUT for half adder. I know LUT gives only one output. But, for half adder we get two output. One for sum and other for carry.

How can I design CLB for half adder?

How can I get two output from LUT? What I am doing wrong?

enter image description here

From study what I understood about FPGA is, This image represent building block of FPGA which is CLB. CLB consists of LUT, D-Flipflop and MUX.

LUT is used to configure any type of logic gates. AND, OR, NOT or any other complex logic gate. By using program we store output of truth table for say AND gate in LUT. And while we give input to FPGA it goes through LUT via address bar and access specific memory address in LUT. And then output of LUT goes through two paths. Here, we need to choose whether we want our output through combinational circuit or sequential circuit. We use MUX for this selecting purpose. 0 for combinational circuit and 1 for sequential circuit.

Am I correct What I understood so far?

When we need to choose sequential circuit and combinational circuit?

\$\endgroup\$
4
  • \$\begingroup\$ Which FPGA family? Many have special features in their logic block to enable designing adders without a second CLB. But to show you which features, we have to know which FPGA you're targeting. \$\endgroup\$ – The Photon Nov 12 '20 at 18:19
  • \$\begingroup\$ You almost never want to directly target FPGA fabric on this scale; you do it sometimes for special functional blocks (memory, IO, DLL, multiplier...), but for basic logic you just write logical (or better yet arithmetic) expressions and lets the tools optimally assign them. In terms of sequential vs combinatorial, you chose what your application needs, but beware that long combinatorial paths between registers will limit achievable clock speeds. \$\endgroup\$ – Chris Stratton Nov 12 '20 at 18:19
  • \$\begingroup\$ @ThePhoton FPGA i am using is this: tequipment.net/Digilent/ZedBoard \$\endgroup\$ – f_chowdhury Nov 12 '20 at 18:39
  • \$\begingroup\$ Your question is like you want to build an AND gate with transistors in breadboard while you already have dedicated chips for that. Why you wanna even do it when the while point of designing in FPGA is TO MAKE USE OF CLBs WHICH ARE ALREADY THERE IN FPGA. \$\endgroup\$ – Mitu Raj Nov 13 '20 at 3:41
1
\$\begingroup\$

You have a Zynq-7020 device, which contains an Artix-7 FPGA chip. The CLB for this FPGA is described here. It is much more complex than what you imagined. The CLB contains two slices, and each slice has 4 LUTs and 8 storage elements (flip-flops or latches).

The slice looks something like enter image description here

Furthermore, each LUT has two outputs, O5 and O6. O5 is connected to a "carry chain" which provides a very short connection to a neighboring look-up table, slice, or CLB. This is specifically designed to be the carry output of an adder or counter.

As mentioned by Chris in comments, rather than try to manage all this complexity yourself, with modern synthesis tools (i.e. tools developed in the last 20 years), you'll usually achieve better results by just writing assign X = A + B; in your Verilog than by trying to configure the CLB yourself.

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.