Skip to content

Commit 45d1659

Browse files
committed
- Added Lots of LUTs.
1 parent 871e124 commit 45d1659

File tree

1 file changed

+93
-0
lines changed

1 file changed

+93
-0
lines changed

lessons/lots_of_luts/lots_of_luts.md

Lines changed: 93 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,93 @@
1+
# Lots of LUTs
2+
## The Truth is in the Tables
3+
We know that all boolean functions can be expressed using only three basic
4+
operators: and, or, not. each of these takes one or two boolean inputs and produces
5+
a single boolean output. We often express these boolean operators and any boolean
6+
functions composed from them as truth tables, which simply show which outputs are
7+
produced for a given set or inputs.
8+
9+
10+
And
11+
12+
| a | b | out |
13+
| - | - | --- |
14+
| 0 | 0 | 0 |
15+
| 0 | 1 | 0 |
16+
| 1 | 0 | 0 |
17+
| 1 | 1 | 1 |
18+
19+
Or
20+
21+
| a | b | out |
22+
| - | - | --- |
23+
| 0 | 0 | 0 |
24+
| 0 | 1 | 1 |
25+
| 1 | 0 | 1 |
26+
| 1 | 1 | 1 |
27+
28+
Not
29+
30+
| a | out |
31+
| - | --- |
32+
| 0 | 1 |
33+
| 1 | 0 |
34+
35+
Now if we think of the input set as a single binary value, we find we can implement
36+
truth tables using a hardware construct that you may be familiar with: ROM.
37+
38+
And
39+
40+
| address | out |
41+
| ------- | --- |
42+
| 00 | 0 |
43+
| 01 | 0 |
44+
| 10 | 0 |
45+
| 11 | 1 |
46+
47+
Or
48+
49+
| address | out |
50+
| ------- | --- |
51+
| 00 | 0 |
52+
| 01 | 1 |
53+
| 10 | 1 |
54+
| 11 | 1 |
55+
56+
Not
57+
58+
| address | out |
59+
| --------| --- |
60+
| 0 | 1 |
61+
| 1 | 0 |
62+
63+
The input set becomes the address input of the ROM, and the output is simply the
64+
value stored at that address. Thus we could implement any boolean operation or
65+
expression given a sufficiently large ROM.
66+
67+
## The Shape-shifting Gate
68+
Now that we have established that we can use ROM as a substitute for traditional
69+
logic gates, how do we create a programmable logic element that can be used in FPGAs?
70+
The answer is RAM! RAM allows us to change the value stored at a specific address,
71+
which means we can reprogram the truth table stored in it as we please. A given RAM
72+
can be an and gate, an or gate, or any logical function that will fit in the table.
73+
74+
In fact, FPGAs contain [millions](https://www.altera.com/products/fpga/stratix-series/stratix-10/overview.html#family-table)
75+
of small RAMs called **L**ook-**U**p **T**ables (**LUT**s). When chained in series or
76+
parallel to other LUTs, they can be used to implement any logical function in the
77+
same way gates would.
78+
79+
## No Free Lunch
80+
The flexibility that LUTs give us over gates is not free. There are often significant
81+
power and performance costs that come with it.
82+
83+
* Latency
84+
* Area inefficient
85+
* Expensive
86+
* Power hungry
87+
* Must be reprogrammed at power on
88+
89+
90+
91+
92+
93+

0 commit comments

Comments
 (0)