Repository navigation
ternip: restore all three memories; add post-synthesis FakeRAM memory checks - #255
Merged
Merged
Conversation
…er flops) Since ae7666b (2026-05-13, D 1024->2560) none of the three ternip_pipelined_mem instances matched a branch in the fakeram wrapper, and the wrapper had no default: no storage was instantiated and read data was undriven, so every platform synthesized 0 macros, 0 memory flops and a pruned datapath (2,399 flops total). All ternip QoR since then measured that memoryless design. Map the current shapes: vector_registers 128x4096 -> 8 x fakeram_512x128, one bank per register tmatmul export 128x320 -> 1 x fakeram_512x128 tmatmul import 4096x10 -> flops (depth 10 below fakeram's minimum; SYNTH_MEMORY_MAX_BITS 16384 -> 40960) and end the generate block in $error so a config change can no longer silently delete memory. fakeram_512x16 replaced by fakeram_512x128 in all four cfgs and regenerated. Synth-verified on asap7/nangate45/sky130hd/gt2n: 9 macros each; asap7 flops 2,399 -> 71,708. DECISIONS.md corrected (the old notes said the array became flops; it had no storage at all).
Add a 'Memories that silently vanish' section from ternip (wrapper generate branches with no default: 0 macros, 2,399 flops for six months) and floonoc #254 (empty stub without (* blackbox *) dissolved by slang): wrappers must end in an $error branch, stubs carry logic or a blackbox attribute, shapes come from the actual config, and synth_stat.txt must show the expected macro count, every LEF used, and plausible flops. SYNTH_MEMORY_MAX_BITS does not catch a memory with no storage. Also fix the template: camelCase snap keys (snake_case is silently ignored), platform-neutral fakeram_ names, per-platform cfg + tools/regenerate_sram.sh, wd_in direction check, gt2n.
tools/check_sram_usage.py <platform> <design>: reads synth_stat.txt (top-module totals incl. submodules) and fails if any macro in the design's ADDITIONAL_LEFS is never instantiated, a count differs from sram/expected_macros.txt, or flops fall below its 'flops >=' floor. On a synth_stat with ternip's macros removed it fails pointing at the unused LEF, the symptom that went unnoticed May-Nov. Every k8s build now runs it and prints the result (advisory, never fails the job). tools/check_sram_cfg.py (added to the lint-sram-lef CI workflow): every bsg_fakeram cfg uses camelCase snap keys (snake_case is silently ignored; the 9 known asap7 cfgs are allowlisted until regenerated, and the list can only shrink) and its macro set equals the committed LEFs. tools/regenerate_sram.sh: refuses snake_case snap keys, fails if a generated LEF has the wd_in direction bug, and points at the usage check. ternip gets sram/expected_macros.txt (9 x fakeram_512x128, flops >= 40960); the generate-sram skill now walks through all three tools.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
A memory can vanish during synthesis with no error, and synthesis then prunes the logic behind it.
SYNTH_MEMORY_MAX_BITSdoesn't catch it, because a memory with no storage is never inferred.ae7666b1(2026-05-13, D 1024→2560), none of its threeternip_pipelined_meminstances matched a generate branch internip_pipelined_mem_fakeram.v, and the wrapper had no default branch. Every platform synthesized 0 macros and 2,399 flops (the memories alone hold 606,208 bits), so all ternip QoR since then is void.(* blackbox *)had the same effect.Changes
ternip
fakeram_512x128, one bank per registerfakeram_512x128SYNTH_MEMORY_MAX_BITS16384 → 40960)$errortools/check_sram_usage.py(new): after synthesis, fails if a macro inADDITIONAL_LEFSis never instantiated, if a count differs fromsram/expected_macros.txt, or if flops fall below its floor. k8s builds run it and log the result (advisory only).tools/check_sram_cfg.py(new, added to the lint-sram-lef CI workflow): checks for camelCase snap keys, since snake_case is silently ignored. The 9 existing asap7 cfgs with the bug are allowlisted, and the list can only shrink. It also checks that each cfg's macros match its committed LEFs.tools/regenerate_sram.sh: refuses snake_case snap keys and fails on thewd_indirection bug.generate-sram skill: new section "Memories that silently vanish", a mandatory post-synthesis check, and the stale template fixed (snap keys,
fakeram_names, per-platform cfg).Follow-up
An audit of the other designs' memories is in progress. Its findings will set
expected_macros.txtfor each design.