Video 3 of 4 · ~8 minutes
Dr. Mike Borowczak · Electrical & Computer Engineering · CECS · UCF
Every FPGA chip family has a fixed number of memory blocks: iCE40 HX1K has 16 EBRs. iCE40 UP5K has 128 SPRAM + 30 BRAM. Xilinx Artix-7 has 135 BRAM36Ks (~4.8 Mbit). Intel Cyclone V has 3.3 Mbit. When you buy a chip, you buy a fixed memory budget — designs that don't fit are redesigned. Datasheet comprehension is career-critical.
Every design from here to capstone must fit within 1280 LUTs + 64 Kbit of block RAM. Today's memory-planning skills are what let you size ambitious projects. Trying to cram a 256-character text frame buffer in without understanding EBRs? You'll fail synthesis. Understanding the budget? You'll allocate 2 EBRs and move on.
“The FPGA has 64 Kbit of block memory, so I can fit any combination of RAMs up to that total. A 3 Kbit RAM + a 5 Kbit RAM + a 2 Kbit RAM = 10 Kbit, and I've got 54 Kbit left.”
Block RAM comes in fixed-size units: 16 blocks × 4 Kbit each. A 3 Kbit RAM consumes 1 whole EBR. A 5 Kbit RAM consumes 2 EBRs (overflows into a second block). A 2 Kbit RAM consumes 1 EBR. Total EBR cost: 1 + 2 + 1 = 4 EBRs, not a “10 Kbit” calculation. Always round up to the next whole block.
| Resource | Count | Per-unit | Total |
|---|---|---|---|
| Logic cells (LUT4 + DFF) | 1,280 | — | 1,280 LUTs |
| Embedded Block RAM (EBR) | 16 | 4 Kbit | 64 Kbit |
| PLLs | 1 | — | 1 |
| I/O pins | up to 96 | — | — |
| SPI config flash | 1 | external | 8 Mbit typ. |
Each 4 Kbit EBR can be configured in 5 different shapes:
| Aspect Ratio | Depth × Width | Typical Use |
|---|---|---|
| 256 × 16 | 256 words | Coefficient table, char ROM (16-bit ASCII) |
| 512 × 8 | 512 bytes | UART FIFO, text buffer, 7-seg char ROM |
| 1024 × 4 | 1024 nibbles | Audio sample table (4-bit PCM) |
| 2048 × 2 | 2048 dibits | Rare — dense packed data |
| 4096 × 1 | 4096 bits | Bitmap pixels, BCD encodings |
reg [7:0] mem [0:511] → 512×8 aspect. Declare reg [15:0] mem [0:255] → 256×16. If you need more depth or width than one EBR supports, the tool automatically concatenates multiple EBRs.
A design needs: UART TX FIFO (256 × 8), UART RX FIFO (256 × 8), character ROM for VGA (128 × 64), sine lookup (1024 × 10). How many EBRs?
$ yosys -p "read_verilog *.v; synth_ice40 -top top_design; stat" -q
=== top_design ===
Number of cells: 480
SB_CARRY 45
SB_DFFE 120
SB_LUT4 280
SB_RAM40_4K 9 ← 9 EBRs used
(56% of 16 available)
SB_RAM40_4K count matches your budget estimate. If it doesn't — if you expected 3 and got 8 — some RAM wasn't inferred and got scattered. Bug. If it's bigger than 16, your design does not fit on this chip — redesign or re-target.
nextpnr-ice40 reports utilization with “Device utilization: LCs 34%, BRAMs 56%”. That's the final authority on whether you fit. Watch those numbers grow through a project.
Ask AI: “I'm targeting an iCE40 HX1K (16 × 4Kbit EBRs, 1280 LUTs). Can I fit a 2048-entry × 32-bit lookup table? If not, what do I do?”
TASK
AI does a resource-fit analysis.
BEFORE
Predict: 2048 × 32 = 64 Kbit. Exactly the full EBR budget. Any other memory = doesn't fit.
AFTER
Strong AI: “Fills all EBRs, leaves no other memory. Consider halving precision or storing half-ROM with symmetry.”
TAKEAWAY
Architecture-aware problem solving is a hallmark of senior AI help.
① iCE40 HX1K: 1280 LUTs + 16 EBRs × 4 Kbit = 64 Kbit block RAM.
② EBRs are fixed units. Always round up when budgeting.
③ Aspect ratios: 256×16, 512×8, 1024×4, 2048×2, 4096×1. Tool picks automatically.
④ Budget before coding. Verify with make stat.
🔗 Transfer
Video 4 of 4 · ~8 minutes
▸ WHY THIS MATTERS NEXT
Pattern + budget = what can you build? Video 4 puts it together with a concrete application: a pattern sequencer that uses ROM + a counter to produce arbitrary LED animations, sine waves, or character displays. You'll see how the memory resources from today become real-world behavior.