Skip to content

FakeRAM2.0: apply the ORFS asap7 backend to the vendored copy - #4603

Merged
maliberty merged 2 commits into
The-OpenROAD-Project:masterfrom
oharboe:fakeram-fold-asap7-backend
Oct 3, 2026
Merged

maliberty merged 2 commits into
The-OpenROAD-Project:masterfrom
oharboe:fakeram-fold-asap7-backend

Conversation

@oharboe

@oharboe oharboe commented Oct 2, 2026 •

Copy link
Copy Markdown
Collaborator

TL;DR: cleanup with no new code. patches/fakeram/0001 was left over from ORFS's bazel days, and nothing applies it. This PR applies it to tools/FakeRAM2.0, where FakeRAM now lives, and deletes it. Commit 1 is verbatim (there's a one-line check below), and commit 2 is black formatting.

What

This moves code; it adds none. patches/fakeram/0001-Add-ORFS-ASAP7-backend.patch already holds the ASAP7 backend that AUTO_MEMORIES calls (run.py --orfs_asap7_backend, from flow/scripts/memories/gen_memories.py). This PR applies that patch to tools/FakeRAM2.0, where FakeRAM now lives, and deletes the patch file. Code that was a diff in patches/ becomes the files it described.

The diffstat looks bigger than the change because each line appears twice: once removed from the patch file, once added in its real home.

file what it is
patches/fakeram/0001-...patch (−169) the patch file, deleted
tools/FakeRAM2.0/orfs_asap7/generate.py (+83) not new: the patch's own generate.py, unchanged
tools/FakeRAM2.0/orfs_asap7/__init__.py (+1) the same
tools/FakeRAM2.0/run.py, utils/class_process.py the patch's hunks for these two files

What the patch brought in but this PR leaves out: its BUILD.bazel and MODULE.bazel, which only made FakeRAM a bazel module.

Why the patch was never applied

The patch dates from when FakeRAM2.0 was a separate repository: ORFS's MODULE.bazel fetched FakeRAM and applied it there. Then FakeRAM moved into tools/FakeRAM2.0 and ORFS dropped bazel. The patch stayed behind with nothing applying it, so run.py in this tree has never known --orfs_asap7_backend.

Commits

  1. Apply the patch verbatim and delete patches/fakeram. To check that nothing else changed, run this at that commit; it succeeds:
    git show HEAD^:patches/fakeram/0001-Add-ORFS-ASAP7-backend.patch \
      | git apply -R --check --directory=tools/FakeRAM2.0 \
          --exclude=tools/FakeRAM2.0/BUILD.bazel --exclude=tools/FakeRAM2.0/MODULE.bazel
    
  2. black-format the three Python files. The patch predates FakeRAM2.0's black formatting, so its code had never been through black. Formatting only.

Testing

This is the code bazel-orfs has been running AUTO_MEMORIES with. It carries the same patch, re-pathed onto tools/FakeRAM2.0.

The width floor from #4597, and other later backend changes, will follow as ordinary diffs to tools/FakeRAM2.0.

🤖 Generated with Claude Code

AUTO_MEMORIES calls tools/FakeRAM2.0/run.py --orfs_asap7_backend
(flow/scripts/memories/gen_memories.py). The backend was shipped as
patches/fakeram/0001-Add-ORFS-ASAP7-backend.patch, which ORFS's
MODULE.bazel applied to the external FakeRAM2.0 repository. FakeRAM is
now vendored here and ORFS no longer builds with bazel, so nothing
applied the patch and run.py rejected the flag.

Apply it to tools/FakeRAM2.0 and remove patches/fakeram. The patch's
BUILD.bazel and MODULE.bazel are left out: they only made FakeRAM a
bazel module.

Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request adds Bazel build configuration, a new orfs_asap7 backend for memory generation, and CLI support in run.py. It also updates the macro dimension calculation in class_process.py to enforce a minimum height constraint. The review feedback recommends specifying utf-8 encoding for all file read/write operations to ensure cross-platform compatibility, and adding defensive checks when parsing the input JSON configuration to prevent potential exceptions.

Comment thread tools/FakeRAM2.0/orfs_asap7/generate.py Resolved
Comment thread tools/FakeRAM2.0/orfs_asap7/generate.py Resolved
Comment thread tools/FakeRAM2.0/orfs_asap7/generate.py Resolved
Comment thread tools/FakeRAM2.0/orfs_asap7/generate.py Resolved
The patch predates black-formatting FakeRAM2.0 (3388907), so the
code it carried was never formatted. Formatting only.

Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
@oharboe
oharboe requested a review from maliberty October 2, 2026 07:21
@openroad-ci

openroad-ci commented Oct 2, 2026 •

Copy link
Copy Markdown
Member

🔍 QoR check

Metrics reflect the PR merge build — i.e. what will land on the target branch.

Commit a24a1fc · Jenkins build #1 · Baseline: build · View build on dashboard

62 design(s) checked — 0 with regression(s), 0 without a comparable baseline.

total_height += additional_height

min_height = max(
3.5, self.snap_height_nm / 1000.0 if self.snap_height_nm else 0

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Where did 3.5 come from?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good question. I can't find a source. It came in as a bare literal in the original AUTO_MEMORIES patch (a632406, patches/fakeram/0001), with no rationale. This PR moves it verbatim. Since snap_height_nm = 1400 rounds up after the floor, the effective minimum height is 4.2 µm.

I don't see a PDN reason for a height floor. The macro's M4 power rails are horizontal and the M5 straps are vertical, so strap coverage depends on the macro's width, not its height. That's the floor that will follow (#4597), derived from the 5.4 µm M5 pitch in grid_strategy-M1-M2-M5-M6.tcl. The PDK doesn't expose that pitch to FakeRAM today, so it would be a commented constant next to ASAP7_PROCESS_CONFIG too.

I'd rather keep this PR a verbatim move and decide in a follow-up whether to drop the 3.5 floor or move it into generate.py with a reason. Dropping it changes the generated macros, so it deserves its own diff.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fine but please do follow up

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Follow-up: #4608. Nothing in the history explained the 3.5, so the first commit drops it and a forced 4×25 memory fails with "not enough tracks". The second commit sizes the height from the pin count instead: 2 * y_offset + num_pins * pin_pitch.

Other cleanup that came up in the sweep:

@oharboe
oharboe requested a review from maliberty October 2, 2026 17:26
@maliberty
maliberty merged commit d2b74aa into The-OpenROAD-Project:master Oct 3, 2026
12 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants