Tuesday, December 10, 2024
Embedded & MCUEmbedded LinuxExplainerMicrocontrollers

How LUT and Flip-Flops Work in FPGAs?

Table of contents

  1. What is the LUT?
  2. How LUT Work in FPGAs?
  3. One warning of LUT
  4. How Flip-Flops Work in FPGAs?
  5. Video related to Flip-Flops
  6. What is a clock?
  7. Some types of clock
  8. Conclusion

What is the LUT?

LUTs, which use relatively small quantities of RAM, are used to implement a large portion of the logic in a CLB. It is simple to assume that when an FPGA uses the term “system gates,” it is referring to the total number of NOR and NAND gates in a given chip. However, all combinatorial logic, including ANDs, ORs, NANDs, XORs, and similar operations, is really implemented as truth tables in LUT memory. Every possible combination of outputs is listed in a truth table.

Look-Up Tables (LUTs) are the means through which Boolean algebra is performed by FPGAs. A look-up table is a distinct functional unit that the digital designer can program. LUTs use the same truth table concept to relate outputs to inputs. FPGA including many family series like Virtex-7 FPGAs, Kintex-7 FPGAs, Virtex-6 FPGA, Spartan 6 FPGAs, and so on are all composed of three elements: Look-up table (LUT), Flip-Flop (FF), and Wires.

How LUT Work in FPGAs?

The following Boolean equation needs a truth table: A + (C*B’). Maybe we ought to explain what those symbols imply.

truth table

An FPGA does not actually include discrete logic gates. Instead, FPGAs employ LUTs, or look-up tables. The Digital Designer programs the LUT to solve a Boolean algebraic equation like the two we saw earlier. As one might anticipate, the Look-Up Table needs to be programmable in order to accommodate all conceivable boolean expression combinations. I’ll repeat it once more, but in a different way: Any Boolean algebra equation you can conceive of can be created with a single 3-Input LUT and three input signals.

Depending on the FPGA you are using, LUTs can be different sizes, but they all act the same. Not too long ago, 3-Input LUTs were the norm; today, 4-Input and even 5-Input LUTs are prevalent. Simply add more Look-Up Tables if you need to create a more complex expression. One of the two most essential parts of an FPGA are LUTs. There are thousands of these parts in a single FPGA.

One warning of LUT

One drawback of the LUT is a condition known as a “glitch.” It isn’t a “glitch” in the sense of a general error, but rather a feature of LUT-based logic.

In a LUT, though, you’re actually altering the address of a RAM bank that is one bit wide. The RAM may briefly lose the ability to determine what to output when the LUT input bits change, which causes the RAM address to change. We refer to it as a glitch if, during that moment of uncertainty, the LUT output diverges from the desired output.

How Flip-Flops Work in FPGAs?

One of the two most crucial parts of an FPGA is the Look-Up Table (LUT), with the Flip-Flop coming in second. Flip-flops come in a few distinct varieties (JK, T, and D). Of the fundamental flip flops, the JK flip-flop is the most adaptable. In clocked sequential logic circuits, one bit of data is stored using a JK flip-flop. It performs almost exactly like an SR flip flop. The sole modification is the removal of the undefinable condition where S and R are both 1. A JK flip-flop may accept four different input combinations, including “logic 1,” “logic 0,” “no change,” and “toggle,” thanks to the additional timed input. T stands for (“toggle”) flip-flop to prevent an intermediate state in SR flip-flop.

flip-flop

To prevent the occurrence of an intermediate state, we should only supply one input to the flip-flop known as the Trigger input Toggle input. But the D Flip-Flop is the most popular.

You’ll see in the image above that the S-designated gadget has a pin on top of it. The Set pin is what it is called. A pin with the letter R on it is located on the device’s bottom. The Reset pin is what it is called. There is also a pin marked “Qbar” on the device’s right side. The value on this pin will always be the polar opposite of the value on pin Q. The Flip-Flop’s three most crucial pins are:

  • D: Data Input to Flip-Flop
  • Q: Data Output of Flip-Flop (Registered)
  • >: Clock Input to Flip-Flop

Video related to Flip-Flops

https://youtu.be/lrXjuotxqzE

What is a clock?

Almost all digital circuits are operated by digital clocks. One approach to conceptualize a system’s clock is as a series of gears. Any gear in the system needs to be driven by a master gear in order for it to rotate. In digital logic, that is essentially the clock’s function. It offers a consistent stream of low-to-high-to-low-again voltage shifts, enabling your FPGA to function. The analogy is also entertaining because the gears resemble the square wave on a digital clock.

clock

Some types of clock

The red arrow on the rising edge of the clock in the waveform above denotes three clock cycle events. The D input switches from being low to being high between the first and second rising edges of the clock. When the rising edge of the second clock cycle occurs, the output Q observes that D has changed from low to high. When the Flip Flop examines the supplied data, it is at the rising edge. Q now has the same value as input D at this stage. Because of this, flip-flops are frequently referred to as registers. On the third rising edge, Q once more checks the value of D and registers it. Q remains high since nothing has changed.

A waveform for a D Flip-Flop with two inputs and one output may be seen in the image above. The rising edge of the clock affects the D Flip-Flop, so when it occurs, the input D is transferred to the output Q. It only happens around the margins. Q switches from 0 to 1 after observing that D has changed to 1 during the first clock cycle. When Q checks the value of D again on the second clock edge and discovers that it is low once more, it again becomes low.

Conclusion

I’ve already mentioned that the two most crucial parts of an FPGA are flip-flops and LUTs. To become a proficient digital designer, one must have a solid understanding of how flip-flops (registers) operate. The primary element of an FPGA that is utilized to maintain the internal state of the chip is a flip-flop.

If the FPGA could only be made up of LUTs, state management would not be possible. This implies that the FPGA would be unaware of what had previously occurred. With a very long chain of and gates, or gates, etc., all changes to the inputs would be analyzed right away and communicated to the output. An FPGA, however, needs to be aware of the past in order to do the vast majority of functions. It can monitor counters, state machines, and object status in this fashion. Flip-flops allow for this. The more you work with a Hardware Description Language (HDL), the more you will understand the significance of flip-flops in your FPGA designs.

Harshvardhan Mishra

Hi, I'm Harshvardhan Mishra. Tech enthusiast and IT professional with a B.Tech in IT, PG Diploma in IoT from CDAC, and 6 years of industry experience. Founder of HVM Smart Solutions, blending technology for real-world solutions. As a passionate technical author, I simplify complex concepts for diverse audiences. Let's connect and explore the tech world together! If you want to help support me on my journey, consider sharing my articles, or Buy me a Coffee! Thank you for reading my blog! Happy learning! Linkedin

Leave a Reply

Your email address will not be published. Required fields are marked *