Repository navigation
flow: AUTO_MEMORIES generated memory macros via FakeRAM2.0 (experimental) - #4389
Conversation
There was a problem hiding this comment.
Code Review
This pull request introduces AUTO_MEMORIES, an experimental feature for the asap7 platform that automatically detects memory-shaped modules in Verilog RTL pre-synthesis and generates abstract .lib and .lef macro views using FakeRAM2.0. The changes include comprehensive documentation, Bazel build rules, a demo design configuration, Python scripts for scanning and evaluating memories, and integration with the Yosys synthesis flow. Feedback on the implementation highlights several robustness and cross-platform improvements: handling parameter lists in the Verilog port parser, wrapping the FakeRAM subprocess call in a try-except block to prevent raw tracebacks, catching OSError when reading user-supplied memory files, and stripping carriage returns when reading the blackbox list in Tcl to ensure Windows compatibility.
|
@jeffng-or @maliberty The idea is to carry the FakeRAM2.0 patch here until churn is done so that ORFS+bazel can test test this new flow. Once we know what is needed and we think it is ready, a FakeRAM2.0 PR can be articulated and this can be cleaned up. We also regularly merge PRs with patches upstream and then clean out the patches as they land upstream, it all depends on what is practical in each case. |
5dd06ae to
0a439a6
Compare
|
/gemini review |
|
/gemini review |
There was a problem hiding this comment.
Code Review
This pull request introduces the experimental AUTO_MEMORIES feature, which detects memory-shaped modules in RTL pre-synthesis and generates abstract .lib and .lef macro views for them using FakeRAM. It integrates this flow into the Makefile, Bazel build rules, and TCL scripts, while updating several design configurations and rules-base files. The review feedback highlights several robustness improvements: addressing a bug in schema.py where merging overrides could silently reset a memory's idiomatic status to False, making the Verilog parser in detect.py more resilient to whitespace, and replacing a fragile Tcl list conversion in synth_preamble.tcl with a safer regexp approach.
There was a problem hiding this comment.
Code Review
This pull request introduces AUTO_MEMORIES, an experimental feature for the asap7 platform that automatically detects memory-shaped modules in RTL pre-synthesis, generates abstract .lib and .lef macro views for them using FakeRAM2.0, and blackboxes them during synthesis. The changes span documentation, Python detection and schema scripts, unit tests, Makefile/Bazel build rules, and Tcl integration. The review feedback is highly constructive, pointing out critical issues such as a merge override bug in schema.py that could silently reset idiomatic memories, a missing default fallback for FAKERAM_RUN_PY in gen_memories.py, and the need to support multi-corner analysis in read_liberty.tcl. Additionally, defensive type checks were recommended for JSON parsing to prevent cryptic runtime errors.
2248398 to
4f1e11c
Compare
|
Replaced the ad-hoc Python regex scanner with Yosys's native memory inference pass ( |
|
Fixed DCO signoff and cleaned up Python import linting nits. |
|
Restored |
|
Removed the raw Verilog regex scanner from |
|
I have updated the PR to address the remaining review comments:
All Bazel tests ( |
753ec8e to
224d88b
Compare
|
fakeram has been moved over to ORFS so this PR needs updating |
Fixed |
| self.snap_height_nm = ( | ||
| int(json_data["snap_height_nm"]) if "snap_height_nm" in json_data else 1 | ||
| ) | ||
| self.min_macro_height_um = float(json_data.get("min_macro_height_um", 0.0)) |
There was a problem hiding this comment.
IIRC I added it to account for cases where the number of pins required can't fit in the computed height. So, this is an option to "grow" the height so that the pins can fit.
There was a problem hiding this comment.
It enforces a minimum macro height, ensuring that generated memories meet specific PDK layout rules/minimum row heights (like the 3.5um limit in ASAP7), preventing invalid power grid routing. I have added a comment in the code to clarify this.
There was a problem hiding this comment.
No, we've deferred the bazel-orfs integration to avoid churn here. I'll upstream it to bazel-orfs once this is merged. I have removed the patch and the other bazel-related changes from this PR.
There was a problem hiding this comment.
Correction: Yes, this patch is still relevant. We will complete the churn for bazel-orfs integration in this PR, and then upstream it to bazel-orfs once this is merged. I've restored the patch and related changes.
There was a problem hiding this comment.
no changes to the PR since this statement
|
@maliberty Any more FakeRAM asks today? |
|
Waiting for drive-by-fixes to be merged with master, then I'll merge this with master again to simplify. |
…tal) Detect memory-shaped modules (firtool R*/W*/RW*_ port convention) in the RTL before synthesis, inventory them in results/memories.json, and generate .lib/.lef macro views via FakeRAM2.0 for the ones idiomatic as SRAM macros. Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
…erence pass Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
…ector Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
|
You set automerge, but there's a nit that needs to be fixed: trim verific. |
Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
Head branch was pushed to by a user without write access
|
@maliberty Fixed verific word that triggered a failure, please re-apply automerge. |
🔍 QoR checkMetrics reflect the PR merge build — i.e. what will land on the target branch. Advisory — results are log-only and do not affect build status. The authoritative QoR gate remains the local rules-file check. Commit 61 design(s) checked — 0 with regression(s), 7 without a comparable baseline.
|
Summary
This PR introduces pre-synthesis AUTO_MEMORIES support into ORFS by integrating FakeRAM2.0 as a Bazel dependency (
git_override) carrying an isolatedorfs_asap7backend patch (//patches/fakeram:0001-Add-ORFS-ASAP7-backend.patch).This PR supersedes #4367 by rearticulating memory macro generation around the dedicated FakeRAM2.0 repository instead of adding custom ASAP7 generator scripts directly into the ORFS tree.
Highlights & Architecture
fakerammodule override inMODULE.bazelpointing to base commit6f62c655952b683cda679d80850cb557cc3c262e(The-OpenROAD-Project/FakeRAM2.0) and applyingpatches/fakeram/0001-Add-ORFS-ASAP7-backend.patch.flow/scripts/memories/gen_memories.pynow scans RTL, applies the idiomatic gate, dumpsmemories.json, and invokes FakeRAM2.0 via subprocess (--orfs_asap7_backend) to generate.lib,.lef, andblackboxes.txt.bazelisk test //flow:memories_tests).Supersedes #4367