Memory

The SRAM segment store and the L1 cache analysis

Author
Affiliation

Taeho Lee

Published

August, 2026

Other Formats

1 The segment store

The coordinate space maps onto physical memory as a flat array: 11,172 slots of 16 bits each, addressed by the 14-bit offset from the decoder. The single-port SRAM macro is configured for SkyWater 130nm, and the macro generation is pending an OpenRAM PDK install. What is verified today is a behavioral model of the same address map and read/write behavior, checked exhaustively over all 11,172 slots with the 5,212 reserved addresses reading zero. The OpenRAM configuration is:

#| eval: false
word_size = 16          # one Hangul code point per word
num_words = 11172       # full Tagma space: U+AC00..U+D7A3, 19 x 21 x 28
num_rw_ports = 1        # single read-write port
tech_name = "sky130"

The full space is about 22 KB of raw storage, or 44 to 89 KB with values, depending on the value width. 11,172 is not a power of two; if the PDK flow requires one, the fallback is 16,384 words (2^14) with 5,212 reserved entries, since the 14-bit address space covers the valid range either way.

The size is worth stating in device terms, because it decides where this design’s cost sits. The store is 178,752 bits. The ECP5 25F carries 1,032,192 bits of block RAM in 56 blocks, so the store is 17.3 percent of the device, eleven blocks of the fifty-six. It fits, and a block RAM read costs one clock, or two with the output register, which is the same order as the decoder’s single cycle. The decoder is 2,826 um^2 in Sky130; the same bits in a Sky130 SRAM, at an estimated half to two square micrometres per bit, are 89,000 to 358,000 um^2, thirty-two to one hundred and twenty-seven times the decoder. The arithmetic is close to free and the memory is the design.

Figure 1: Where the silicon goes. Left: the segment store against the block RAM of the ECP5 25F. Right: decoder area against the store’s estimated area in Sky130, log scale, with the store drawn as a range because it has no measured macro yet.

That ratio is the answer to where the engineering goes. A decoder that costs 49 LUT4 on the ECP5 or 388 cells in Sky130 is not the thing to optimize; the store is, and its capacity and access pattern are the variables that move the result.

2 Latency: the honest comparison

Three measured paths are compared below. The software numbers come from the benchmark center sw/rust/benches/bench_hw.rs; the hardware number is the post place-and-route critical path on the UP5K. The comparison is shown in Figure Figure 2.

Figure 2: Per-decode latency, log scale: software reference vs hardware worst case on the UP5K. The arrow marks the software-to-hardware gap of the same decomposition.

The per-operation latency comparison is the central finding of this document:

Path Latency Note
CoordSpace.get (software) 0.38 ns whole space in L1 cache
Coord::to_axes (software) 1.44 ns reference decode
HW decoder (UP5K PnR) 59.55 ns worst-case critical path at 16.79 MHz

For the N=1 dense case, hardware is not a speedup. The whole working set fits in L1 cache and the software already runs at memory speed, which a block RAM at FPGA clock rates cannot beat.

A sweep is the other comparison and it goes the other way. The software loop decodes all 11,172 code points in 1.92 us. The device needs 80 us at 140 MHz, and 931 us at the 12 MHz the Sky130 flow closes. The CPU’s clock and execution width win that, and no arrangement of this arithmetic changes it.

Figure 3: One full sweep of the valid space, software against the device. The software loop finishes in 1.92 us and the device needs 80 us at 140 MHz, so throughput belongs to the CPU and not to this hardware. The figure is here to stop the decode rate being read as a speed claim.

So both the single lookup and the full sweep belong to the software, and neither is a hardware claim. What is left is the shape of the memory traffic, which is the next section.

3 What the anchor establishes

The hardware is a verification anchor, not a competitor to the software. The comparison above exists to bound what it can be cited for, not to score an axis. What it establishes is that the primitive runs, and what it makes visible is where a system’s cost would sit:

Axis Software Hardware
Range query over an axis iterative descent over a tree or a scan the bounds are computed from the code, so the iteration is an increment
Index storage a separate structure beside the records none, because the key is the order and the range address
Energy per access not measured in this series about 3.0 pJ per decode at 12 MHz, from the Sky130 flow at the workload’s measured activity
Latency determinism cache-dependent, variable fixed, independent of the input: one cycle combinational, four pipelined
Physical embedding impossible the primitive becomes a device, the chton signal-layer vision

The structural case is the first two rows and it is derived rather than measured: with records keyed by code, the key is the sort order and the range address, so a range walk is an increment and no index exists to store or to search. That is what the segment store would exercise, and it is the part not yet on a device.

The remaining case is the shape of the memory traffic. Where records live in a tree, a range or neighbourhood walk pays a dependent miss at every level, and the software’s own sparse fallback measures that cost as a spread from 0.87 to 53 ns per operation. A store keyed by code reads contiguous runs instead, so the walk pays one miss per cache line and the bounds are computed rather than compared. That is a claim about layout, it is derived rather than measured, and the store is what would demonstrate it.