2

I got to understand what a LUT actually is. The inputs of a logic function acts as drivers for address lines of a memory block (typically a RAM block) and the address lines are decoded to point to a value which is passed on to the output.

Y=A^B

We store the values[0:3]=(0,1,1,0); And based on the input which acts as address,the corresponding output is enabled.

But how is this value actually stored?

I write y<=a xor b;

How is this put into the look up table? And how is this linked with the multiplexers and D-Flipflops?

Muthu Subramanian
  • 451
  • 2
  • 8
  • 11

1 Answers1

3

The LUT is loaded with data with the internal configuration logic. Extra logic inside the FPGA (hard logic, not LUTs) reads the configuration bitstream (sof or bit file) from an external flash chip or from the JTAG interface and then stores it into the correct locations inside the FPGA. This includes LUTs, block RAM, clock management components (PLL, DCM, MMCM, etc), and the routing matrix. This configuration routine is triggered after any reset of the entire FPGA (i.e. Xilinx PROGRAM_B or Altera nCONFIG) and can load the bitstream from a number of different sources including JTAG, SPI or parallel flash chips, a microcontroller or microprocessor, another FPGA or CPLD, etc.

The routing matrix is what interconnects the reconfigurable components inside the FPGA. It consists of horizontal and vertical wires of various lengths and interconnecting switches. Closing the correct switches allows signals to be routed around the FPGA between the various components. Dedicated clock distribution networks also exist to distribute high speed, high fanout clock and reset signals.

I would highly recommend looking at an FPGA datasheet to get a feel for how these components are implemented on a commercial FPGA. Both Xilinx and Altera have quite a bit of documentation on the specifics of the routing network and construction of the logic elements.

alex.forencich
  • 40,694
  • 1
  • 68
  • 109
  • I do not get many things here. What is FPGA start up routine? I thought only when we feed the .sof file into the fpga, it will load LUT. I think I am asking about how the code is compiled and how it is actually implemented. Besides I do not get the extra logic part. Could you elaborate on your point? Every point? I am a beginner here – Muthu Subramanian May 10 '15 at 02:51
  • There is one more question. Suppose I have logic cells with only four bit LUTs. I write a logic function of four inputs. Only one LUT (or only one logic cell) is enough? and I write a logic function of five variables and how is it implemented in the LUTs? – Muthu Subramanian May 10 '15 at 02:57
  • Yes, one LUT is enough for any function with 4 inputs and one output. – alex.forencich May 10 '15 at 02:58
  • What about the five inputs? and how is the input routed to a particular logic cell and the output is routed to an I/O pad? I am guessing a routing matrix but I have no idea what it is – Muthu Subramanian May 10 '15 at 03:05
  • For 5 inputs it would have to be split up among several LUTs. You will be able to break apart your logic function into pieces small enough to fit on LUTs, though it may require several LUTs to implement the whole thing. – alex.forencich May 10 '15 at 03:29
  • regarding the five input case, suppose F=ABC+DE and I write it as F=E(ABC+D) +E'(ABC). then I implement ABC+D in one logic cell and pass this as a data in to another logic cell. It will act as the multiplexer input and the other multiplexer input being the implementation of ABC in the same logic cell(the second one) and the enable input is E. Is this the way it works? – Muthu Subramanian May 10 '15 at 05:42
  • That's one way. Another method would be x = ABC and F = x + DE, each fitting on a 3-input LUT. LUT packing will be handled automatically by the toolchain so you don't need to do this yourself. Unless of course you want to directly instantiate LUTs as primitives. – alex.forencich May 10 '15 at 05:53
  • Actually, what you wrote won't work since you need to implement ABC as well as bring in ABC+D and then the E signal, which is 5 inputs in total. You would need to use something else for the MUX, either a dedicated MUX or another LUT. – alex.forencich May 10 '15 at 05:56
  • https://drive.google.com/file/d/0B6BxPUwcufIQNThnRDMwc1pmR0U/view?usp=sharing i thought it would work. what is wrong? I have two LUTs? – Muthu Subramanian May 10 '15 at 07:18
  • Two LUTs and one mux. You don't always get a MUX by itself that you can use like that (depends on the FPGA), so that MUX may need to be a LUT itself. In which case, you need 3 LUTs. – alex.forencich May 10 '15 at 07:31