| fpga4fun.com - where FPGAs are fun. |
FPGAs are built from one basic "logic-cell", duplicated hundreds or thousands of time. A logic-cell is basically a small lookup table ("LUT"), a D-flipflop and a 2-to-1 mux (to bypass the flipflop if desired).
The LUT is like a small RAM and has typically 4 inputs, so can implement any logic gate with up to 4-inputs. For example an AND gate with 3 inputs, whose result is then OR-ed with another input would fit in one LUT.
Each logic-cell can be connected to other logic-cells through interconnect resources (wires/muxes placed around the logic-cells). Each cell can do little, but with lots of them connected together, complex logic functions can be created.
The interconnect wires also go to the boundary of the device where I/O cells are implemented and connected to the pins of the FPGAs.
In addition to general-purpose interconnect resources, FPGAs have fast dedicated lines in between neighboring logic cells. The most common type of fast dedicated lines are "carry chains". Carry chains allow creating arithmetic functions (like counters and adders) efficiently (low logic usage & high operating speed).
Older programmable technologies (PAL/CPLD) don't have carry chains and so are quickly limited when arithmetic operations are required.
In addition to logic, all new FPGAs have dedicated blocks of static RAM distributed among and controlled by the logic elements.
There are many parameters affecting RAM operation. The main parameter is the number of agents that can access the RAM simultaneously.
Here's a simplified drawing of a dual-port RAM.
To figure out how many agents are available, count the number of separate address buses going to the RAM. Each agent has a dedicated address bus. Each agent has also a read and a write data bus.
Writing to the RAM is usually done synchronously. Reading is usually done synchronously but can sometimes be done asynchronously.
Now there are two types of internal RAMs in an FPGA: blockrams and distributed RAMs. The size of the RAM needed usually determines which type is used.
Distributed RAM brings a lot of flexibility in the RAM distribution in an FPGA, but isn't efficient in term of area (a logic-cell can actually hold very little RAM). Altera prefers building different size blockrams around the device (which is more area efficient, but less flexible). Which one is better for you depends on your FPGA application.