Repository navigation
Conversation
A spec that names bit_folds bypasses the fold rule, so a pinned low fold (bit_folds 1 written out as a default) builds the array as named: a long, thin outline whose word selects and write enables run the full width. repair_design then buffers those long wires inside the array, where the only sites wide enough are the rows above and below it, and detailed placement cannot legalise the buffers. Factor the fold rule into _folds() and, when a spec names bit_folds, apply the rule to the array that fold builds. If the rule would fold it further, stop with the aspect ratio, the word span and the fold the rule would choose, instead of building it. A named fold at or above the rule's choice builds as before. Tests in gen_memories_test.py stub generate_ram to check the rule, the refusal and that a fold at the rule's choice is accepted. Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
There was a problem hiding this comment.
Code Review
This pull request refactors the word folding logic in regfile_ram.py by extracting it into a dedicated _folds helper function. It also introduces validation to refuse user-specified bit_folds configurations that are fewer than what the rule would choose, raising a SystemExit error with a descriptive message. Additionally, comprehensive unit tests are added in gen_memories_test.py to verify these folding rules and validation behaviors. I have no feedback to provide on these changes.
🔍 QoR checkMetrics reflect the PR merge build — i.e. what will land on the target branch. Commit 62 design(s) checked — 0 with regression(s), 0 without a comparable baseline. |
Before: a register-file spec that names
bit_foldsbypassesregfile_ram.py's fold rule. A spec that writes outbit_folds 1as a default therefore builds a long, thin array: every word's selects and write enables run the full width.repair_designbuffers those long wires inside the array, where the only sites wide enough are the rows above and below it, and detailed placement cannot legalise the buffers.Now: the fold rule is factored into
_folds(). When a spec namesbit_folds, the rule is applied to the array that fold builds; if it would fold further,generate()stops with the aspect ratio, the word span and the fold the rule would choose:A named fold at or above the rule's choice builds as before, and a spec without
bit_foldsis unchanged. No spec underflow/designsnamesbit_folds.Tests:
flow/scripts/memories/gen_memories_test.pygains tests that stubgenerate_ram(the generate script writes the outline, the views script stops the run): the rule's choices, the refusal and its message, a fold at the rule's choice accepted, and an unnamed fold built twice. The refusal tests fail without the change. Allflow/scripts/memories/*_test.pypass.🤖 Generated with Claude Code