A synthesis tool turns each RTL array into storage plus access logic. A small array becomes one flop per bit with read muxes and write decode.
A large array becomes a macro instance instead. The tool does not build the storage from gates; it connects a compiled block.
Array | Bits | Bytes | Likely result |
|---|---|---|---|
32 x 8 | 256 | 32 | Flops |
64 x 32 | 2048 | 256 | Flops unless ports are few and sync |
4096 x 32 | 131072 | 16384 (16 KiB) | Macro |
Capacity is depth times width in bits, divided by eight in bytes. Address bits are the ceiling of log2 of the depth.
The program below checks three capacities and their address widths.
import sys
def addr_bits(depth):
n = 0
while (1 << n) < depth:
n = n + 1
return n
cases = [
(32, 8, 256, 32, 5),
(64, 32, 2048, 256, 6),
(4096, 32, 131072, 16384, 12),
]
bad = 0
for i in range(len(cases)):
depth, width, want_bits, want_bytes, want_addr = cases[i]
bits = depth * width
total_bytes = bits // 8
abits = addr_bits(depth)
if bits != want_bits:
print("FAIL: case " + str(i) + " bits " + str(bits))
bad += 1
if total_bytes != want_bytes:
print("FAIL: case " + str(i) + " bytes " + str(total_bytes))
bad += 1
if abits != want_addr:
print("FAIL: case " + str(i) + " addr " + str(abits))
bad += 1
if bits % 8 != 0:
print("FAIL: case " + str(i) + " not a whole number of bytes")
bad += 1
if bad != 0:
sys.exit(1)
print("PASS: capacity arithmetic holds on 3 memories")Flops win for shallow tables with awkward access. Async reads, many read ports and per-bit resets all point at flops.
The storage cost is easy to bound. A 16-entry table of 8-bit values holds 128 bits.
16 entries x 8 bits = 128 storage bits
course.lib DFF area = 8 area units (teaching library, not a process figure)
storage area = 128 x 8 = 1024 area units, plus read muxes and write decode
32 entries x 8 bits = 256 bits -> 256 x 8 = 2048 area unitsThat linear growth is the whole argument. Doubling the table doubles the flops, while a macro would amortize its fixed overhead.
2048 bits, which is 256 bytes. Six address bits cover 64 entries.
Flops. Most compiled macros offer neither, so the macro would need extra logic that erases its advantage.