How much fits on the chip
You will learn
How to read a resource count and find which resource runs out first.
A synthesis report says how many LUTs, flip-flops, DSPs and block RAMs your design takes. The question that matters is which of them runs out first. A design can use few LUTs and still not fit because it needs more DSPs than the chip has. Type a LUT count, or pick one of our real designs, and see how many copies fit on an XC7A200T.
Try it
Pick a real design, then raise the DSP count until something other than LUTs runs out first. In the spec frame, fits_board checks four resources in turn: which one comes last, and how many DSP48 blocks does xc7a100t_resources list?

Type your LUT count (and FF, DSP, BRAM) and see how many copies fit on an XC7A200T, one grid cell per copy, and which resource runs out first. Totals from nextpnr-xilinx.
specs/fpga/stdlib.t27
// SPDX-License-Identifier: Apache-2.0
// t27/specs/fpga/stdlib.t27
// T27 FPGA Standard Library IP Catalog
// Reusable hardware IP cores with resource utilization estimates
// Uses flat arrays + count fields (parser-compatible)
// phi^2 + 1/phi^2 = 3 | TRINITY
module Stdlib {
// === IP core kind ===
pub const IpKind = enum(i8) {
uart_tx = 0,
uart_rx = 1,
spi_master = 2,
spi_slave = 3,
i2c_master = 4,
gpio = 5,
pwm = 6,
timer = 7,
bram_ctrl = 8,
axi_interconnect = 9,
clock_crossing = 10,
gf16_alu = 11,
ternary_alu = 12,
}
// === Resource utilization ===
pub struct ResourceEstimate {
luts : u32,
ffs : u32,
bram18 : u32,
dsp48 : u32,
io_pins : u32,
}
// === IP core entry ===
pub struct IpCore {
name : &str,
kind : i8,
version : u32,
resources : ResourceEstimate,
clock_freq_mhz : u32,
vendor : &str,
verified : bool,
}
// === IP catalog entry ===
pub struct IpCatalog {
name : &str,
cores : [32]IpCore,
core_count : u32,
}
// === Board resource budget ===
pub struct BoardResources {
name : &str,
luts : u32,
ffs : u32,
bram18 : u32,
dsp48 : u32,
io_pins : u32,
}
// === Constructor helpers ===
fn zero_resources() -> ResourceEstimate {
return ResourceEstimate{
.luts = 0,
.ffs = 0,
.bram18 = 0,
.dsp48 = 0,
.io_pins = 0,
};
}
fn resources(luts: u32, ffs: u32, bram18: u32, dsp48: u32, io: u32) -> ResourceEstimate {
return ResourceEstimate{
.luts = luts,
.ffs = ffs,
.bram18 = bram18,
.dsp48 = dsp48,
.io_pins = io,
};
}
fn ip_core(name: &str, kind: i8, luts: u32, ffs: u32, bram18: u32, dsp48: u32, io: u32, freq_mhz: u32) -> IpCore {
return IpCore{
.name = name,
.kind = kind,
.version = 1,
.resources = resources(luts, ffs, bram18, dsp48, io),
.clock_freq_mhz = freq_mhz,
.vendor = "t27",
.verified = false,
};
}
fn empty_catalog(name: &str) -> IpCatalog {
var cat = IpCatalog{
.name = name,
.cores = [32]IpCore{
IpCore{.name = "", .kind = 0, .version = 0, .resources = zero_resources(), .clock_freq_mhz = 0, .vendor = "", .verified = false},
IpCore{.name = "", .kind = 0, .version = 0, .resources = zero_resources(), .clock_freq_mhz = 0, .vendor = "", .verified = false},
IpCore{.name = "", .kind = 0, .version = 0, .resources = zero_resources(), .clock_freq_mhz = 0, .vendor = "", .verified = false},
IpCore{.name = "", .kind = 0, .version = 0, .resources = zero_resources(), .clock_freq_mhz = 0, .vendor = "", .verified = false},
IpCore{.name = "", .kind = 0, .version = 0, .resources = zero_resources(), .clock_freq_mhz = 0, .vendor = "", .verified = false},
IpCore{.name = "", .kind = 0, .version = 0, .resources = zero_resources(), .clock_freq_mhz = 0, .vendor = "", .verified = false},
IpCore{.name = "", .kind = 0, .version = 0, .resources = zero_resources(), .clock_freq_mhz = 0, .vendor = "", .verified = false},
IpCore{.name = "", .kind = 0, .version = 0, .resources = zero_resources(), .clock_freq_mhz = 0, .vendor = "", .verified = false},
IpCore{.name = "", .kind = 0, .version = 0, .resources = zero_resources(), .clock_freq_mhz = 0, .vendor = "", .verified = false},
IpCore{.name = "", .kind = 0, .version = 0, .resources = zero_resources(), .clock_freq_mhz = 0, .vendor = "", .verified = false},
IpCore{.name = "", .kind = 0, .version = 0, .resources = zero_resources(), .clock_freq_mhz = 0, .vendor = "", .verified = false},
IpCore{.name = "", .kind = 0, .version = 0, .resources = zero_resources(), .clock_freq_mhz = 0, .vendor = "", .verified = false},
IpCore{.name = "", .kind = 0, .version = 0, .resources = zero_resources(), .clock_freq_mhz = 0, .vendor = "", .verified = false},
IpCore{.name = "", .kind = 0, .version = 0, .resources = zero_resources(), .clock_freq_mhz = 0, .vendor = "", .verified = false},
IpCore{.name = "", .kind = 0, .version = 0, .resources = zero_resources(), .clock_freq_mhz = 0, .vendor = "", .verified = false},
IpCore{.name = "", .kind = 0, .version = 0, .resources = zero_resources(), .clock_freq_mhz = 0, .vendor = "", .verified = false},
IpCore{.name = "", .kind = 0, .version = 0, .resources = zero_resources(), .clock_freq_mhz = 0, .vendor = "", .verified = false},
IpCore{.name = "", .kind = 0, .version = 0, .resources = zero_resources(), .clock_freq_mhz = 0, .vendor = "", .verified = false},
IpCore{.name = "", .kind = 0, .version = 0, .resources = zero_resources(), .clock_freq_mhz = 0, .vendor = "", .verified = false},
IpCore{.name = "", .kind = 0, .version = 0, .resources = zero_resources(), .clock_freq_mhz = 0, .vendor = "", .verified = false},
IpCore{.name = "", .kind = 0, .version = 0, .resources = zero_resources(), .clock_freq_mhz = 0, .vendor = "", .verified = false},
IpCore{.name = "", .kind = 0, .version = 0, .resources = zero_resources(), .clock_freq_mhz = 0, .vendor = "", .verified = false},
IpCore{.name = "", .kind = 0, .version = 0, .resources = zero_resources(), .clock_freq_mhz = 0, .vendor = "", .verified = false},
IpCore{.name = "", .kind = 0, .version = 0, .resources = zero_resources(), .clock_freq_mhz = 0, .vendor = "", .verified = false},
IpCore{.name = "", .kind = 0, .version = 0, .resources = zero_resources(), .clock_freq_mhz = 0, .vendor = "", .verified = false},
IpCore{.name = "", .kind = 0, .version = 0, .resources = zero_resources(), .clock_freq_mhz = 0, .vendor = "", .verified = false},
IpCore{.name = "", .kind = 0, .version = 0, .resources = zero_resources(), .clock_freq_mhz = 0, .vendor = "", .verified = false},
IpCore{.name = "", .kind = 0, .version = 0, .resources = zero_resources(), .clock_freq_mhz = 0, .vendor = "", .verified = false},
IpCore{.name = "", .kind = 0, .version = 0, .resources = zero_resources(), .clock_freq_mhz = 0, .vendor = "", .verified = false},
IpCore{.name = "", .kind = 0, .version = 0, .resources = zero_resources(), .clock_freq_mhz = 0, .vendor = "", .verified = false},
IpCore{.name = "", .kind = 0, .version = 0, .resources = zero_resources(), .clock_freq_mhz = 0, .vendor = "", .verified = false},
IpCore{.name = "", .kind = 0, .version = 0, .resources = zero_resources(), .clock_freq_mhz = 0, .vendor = "", .verified = false},
},
.core_count = 0,
};
return cat;
}
fn arty_a7_resources() -> BoardResources {
return BoardResources{
.name = "arty_a7",
.luts = 33800,
.ffs = 67600,
.bram18 = 60,
.dsp48 = 90,
.io_pins = 210,
};
}
fn xc7a100t_resources() -> BoardResources {
return BoardResources{
.name = "xc7a100t",
.luts = 63400,
.ffs = 126800,
.bram18 = 135,
.dsp48 = 240,
.io_pins = 300,
};
}
// === Query functions ===
fn total_luts(cat: IpCatalog) -> u32 {
var total : u32 = 0;
var i : u32 = 0;
while (i < cat.core_count) {
total = total + cat.cores[i].resources.luts;
i = i + 1;
}
return total;
}
fn total_ffs(cat: IpCatalog) -> u32 {
var total : u32 = 0;
var i : u32 = 0;
while (i < cat.core_count) {
total = total + cat.cores[i].resources.ffs;
i = i + 1;
}
return total;
}
fn total_bram18(cat: IpCatalog) -> u32 {
var total : u32 = 0;
var i : u32 = 0;
while (i < cat.core_count) {
total = total + cat.cores[i].resources.bram18;
i = i + 1;
}
return total;
}
fn total_dsp48(cat: IpCatalog) -> u32 {
var total : u32 = 0;
var i : u32 = 0;
while (i < cat.core_count) {
total = total + cat.cores[i].resources.dsp48;
i = i + 1;
}
return total;
}
fn fits_board(cat: IpCatalog, board: BoardResources) -> bool {
if (total_luts(cat) > board.luts) {
return false;
}
if (total_ffs(cat) > board.ffs) {
return false;
}
if (total_bram18(cat) > board.bram18) {
return false;
}
if (total_dsp48(cat) > board.dsp48) {
return false;
}
return true;
}
fn luts_remaining(cat: IpCatalog, board: BoardResources) -> u32 {
if (total_luts(cat) > board.luts) {
return 0;
}
return board.luts - total_luts(cat);
}
fn utilization_percent(cat: IpCatalog, board: BoardResources) -> u32 {
if (board.luts == 0) {
return 0;
}
return total_luts(cat) * 100 / board.luts;
}
// === Validation ===
fn validate_ip(ip: IpCore) -> u32 {
var errors : u32 = 0;
if (ip.name == "") {
errors = errors + 1;
}
if (ip.clock_freq_mhz == 0) {
errors = errors + 1;
}
return errors;
}
// === Tests ===
test zero_resources
given r = zero_resources()
then r.luts == 0
and r.ffs == 0
and r.bram18 == 0
and r.dsp48 == 0
test resources_creation
given r = resources(100, 50, 2, 1, 8)
then r.luts == 100
and r.ffs == 50
and r.bram18 == 2
and r.dsp48 == 1
and r.io_pins == 8
test ip_core_creation
given ip = ip_core("uart_tx", 0, 200, 100, 1, 0, 4, 100)
then ip.name == "uart_tx"
and ip.kind == 0
and ip.resources.luts == 200
and ip.clock_freq_mhz == 100
test empty_catalog_creation
given cat = empty_catalog("t27_stdlib")
then cat.core_count == 0
and total_luts(cat) == 0
test add_core_luts
given cat = empty_catalog("test")
and cat2 = IpCatalog{.name = "test", .cores = [32]IpCore{ip_core("uart_tx", 0, 200, 100, 1, 0, 4, 100), IpCore{.name = "", .kind = 0, .version = 0, .resources = zero_resources(), .clock_freq_mhz = 0, .vendor = "", .verified = false}, IpCore{.name = "", .kind = 0, .version = 0, .resources = zero_resources(), .clock_freq_mhz = 0, .vendor = "", .verified = false}, IpCore{.name = "", .kind = 0, .version = 0, .resources = zero_resources(), .clock_freq_mhz = 0, .vendor = "", .verified = false}, IpCore{.name = "", .kind = 0, .version = 0, .resources = zero_resources(), .clock_freq_mhz = 0, .vendor = "", .verified = false}, IpCore{.name = "", .kind = 0, .version = 0, .resources = zero_resources(), .clock_freq_mhz = 0, .vendor = "", .verified = false}, IpCore{.name = "", .kind = 0, .version = 0, .resources = zero_resources(), .clock_freq_mhz = 0, .vendor = "", .verified = false}, IpCore{.name = "", .kind = 0, .version = 0, .resources = zero_resources(), .clock_freq_mhz = 0, .vendor = "", .verified = false}, IpCore{.name = "", .kind = 0, .version = 0, .resources = zero_resources(), .clock_freq_mhz = 0, .vendor = "", .verified = false}, IpCore{.name = "", .kind = 0, .version = 0, .resources = zero_resources(), .clock_freq_mhz = 0, .vendor = "", .verified = false}, IpCore{.name = "", .kind = 0, .version = 0, .resources = zero_resources(), .clock_freq_mhz = 0, .vendor = "", .verified = false}, IpCore{.name = "", .kind = 0, .version = 0, .resources = zero_resources(), .clock_freq_mhz = 0, .vendor = "", .verified = false}, IpCore{.name = "", .kind = 0, .version = 0, .resources = zero_resources(), .clock_freq_mhz = 0, .vendor = "", .verified = false}, IpCore{.name = "", .kind = 0, .version = 0, .resources = zero_resources(), .clock_freq_mhz = 0, .vendor = "", .verified = false}, IpCore{.name = "", .kind = 0, .version = 0, .resources = zero_resources(), .clock_freq_mhz = 0, .vendor = "", .verified = false}, IpCore{.name = "", .kind = 0, .version = 0, .resources = zero_resources(), .clock_freq_mhz = 0, .vendor = "", .verified = false}, IpCore{.name = "", .kind = 0, .version = 0, .resources = zero_resources(), .clock_freq_mhz = 0, .vendor = "", .verified = false}, IpCore{.name = "", .kind = 0, .version = 0, .resources = zero_resources(), .clock_freq_mhz = 0, .vendor = "", .verified = false}, IpCore{.name = "", .kind = 0, .version = 0, .resources = zero_resources(), .clock_freq_mhz = 0, .vendor = "", .verified = false}, IpCore{.name = "", .kind = 0, .version = 0, .resources = zero_resources(), .clock_freq_mhz = 0, .vendor = "", .verified = false}, IpCore{.name = "", .kind = 0, .version = 0, .resources = zero_resources(), .clock_freq_mhz = 0, .vendor = "", .verified = false}, IpCore{.name = "", .kind = 0, .version = 0, .resources = zero_resources(), .clock_freq_mhz = 0, .vendor = "", .verified = false}, IpCore{.name = "", .kind = 0, .version = 0, .resources = zero_resources(), .clock_freq_mhz = 0, .vendor = "", .verified = false}, IpCore{.name = "", .kind = 0, .version = 0, .resources = zero_resources(), .clock_freq_mhz = 0, .vendor = "", .verified = false}, IpCore{.name = "", .kind = 0, .version = 0, .resources = zero_resources(), .clock_freq_mhz = 0, .vendor = "", .verified = false}, IpCore{.name = "", .kind = 0, .version = 0, .resources = zero_resources(), .clock_freq_mhz = 0, .vendor = "", .verified = false}, IpCore{.name = "", .kind = 0, .version = 0, .resources = zero_resources(), .clock_freq_mhz = 0, .vendor = "", .verified = false}, IpCore{.name = "", .kind = 0, .version = 0, .resources = zero_resources(), .clock_freq_mhz = 0, .vendor = "", .verified = false}, IpCore{.name = "", .kind = 0, .version = 0, .resources = zero_resources(), .clock_freq_mhz = 0, .vendor = "", .verified = false}, IpCore{.name = "", .kind = 0, .version = 0, .resources = zero_resources(), .clock_freq_mhz = 0, .vendor = "", .verified = false}, IpCore{.name = "", .kind = 0, .version = 0, .resources = zero_resources(), .clock_freq_mhz = 0, .vendor = "", .verified = false}, IpCore{.name = "", .kind = 0, .version = 0, .resources = zero_resources(), .clock_freq_mhz = 0, .vendor = "", .verified = false}}, .core_count = 1}
then total_luts(cat2) == 200
test arty_a7_resources
given board = arty_a7_resources()
then board.luts == 33800
and board.bram18 == 60
and board.dsp48 == 90
test xc7a100t_resources
given board = xc7a100t_resources()
then board.luts == 63400
test fits_board_empty_catalog
given cat = empty_catalog("test")
and board = arty_a7_resources()
then fits_board(cat, board) == true
test utilization_zero
given cat = empty_catalog("test")
and board = arty_a7_resources()
then utilization_percent(cat, board) == 0
test validate_ip_ok
given ip = ip_core("uart_tx", 0, 200, 100, 1, 0, 4, 100)
then validate_ip(ip) == 0
test validate_ip_empty_name
given ip = ip_core("", 0, 200, 100, 1, 0, 4, 0)
then validate_ip(ip) > 0
test validate_ip_zero_clock
given ip = ip_core("test", 0, 100, 50, 0, 0, 4, 0)
then validate_ip(ip) > 0
test total_ffs_empty
given cat = empty_catalog("test")
then total_ffs(cat) == 0
test total_dsp48_empty
given cat = empty_catalog("test")
then total_dsp48(cat) == 0
test luts_remaining_full_board
given cat = empty_catalog("test")
and board = xc7a100t_resources()
then luts_remaining(cat, board) == 63400
test ip_kind_values
then 0 == 0
and 1 == 1
test ip_core_vendor
given ip = ip_core("uart_tx", 0, 200, 100, 1, 0, 4, 100)
then ip.vendor == "t27"
and ip.version == 1
and ip.verified == false
// === Invariants ===
invariant arty_luts_positive
given board = arty_a7_resources()
assert board.luts > 0
invariant xc7a100t_luts_positive
given board = xc7a100t_resources()
assert board.luts > 0
invariant zero_resources_are_zero
given r = zero_resources()
assert r.luts == 0
and r.ffs == 0
and r.bram18 == 0
and r.dsp48 == 0
invariant empty_catalog_zero_totals
given cat = empty_catalog("inv")
assert total_luts(cat) == 0
and total_bram18(cat) == 0
and total_dsp48(cat) == 0
// === Benchmarks ===
bench fits_board_latency
measure: nanoseconds for fits_board(empty_catalog("b"), arty_a7_resources())
target: < 200ns
}
// phi^2 + 1/phi^2 = 3 | TRINITY
All lessons
Module 1 · The chip
What an FPGA is, which chip we use, and how its pins meet the board.
Module 2 · Numbers in hardware
Bits, trits and number formats, and what arithmetic costs in logic.
Module 3 · Your t27 program
Write a spec, test it, and see why compiling is not the same as being right.
Module 4 · Inside t27c
How the compiler reads a spec and what it writes, including the native t27b.
Module 5 · From spec to hardware
The Verilog t27c writes, the cells it becomes, and what one LUT does.
Module 6 · Reading synthesis
What yosys reports about your design, and which warnings matter.
Module 7 · Place, route, timing
Where the cells land on the die, and whether the clock is met.
Module 8 · The bitstream
How a routed design becomes the bits the chip loads, with no Vivado.
Module 9 · On the board
Ask the chip who it is, load the bits, and check them.