Skip to content

ram: add nangate45 cross-platform regression test#9680

Open
DeepanshuDadhich wants to merge 1 commit intoThe-OpenROAD-Project:masterfrom
DeepanshuDadhich:fix/9468-nangate45-ram-test
Open

ram: add nangate45 cross-platform regression test#9680
DeepanshuDadhich wants to merge 1 commit intoThe-OpenROAD-Project:masterfrom
DeepanshuDadhich:fix/9468-nangate45-ram-test

Conversation

@DeepanshuDadhich
Copy link

add test make_7x7_nangate45 exercising generate_ram with Nangate45 standard cells. Uses an intentionally odd 7-word x 1-byte (56-bit) configuration to stress the decoder logic on a non-power-of-2 count.

also fix a latent bug in makeCellBit() where the clock-pin name probe only checked for CLK (sky130hd) or GATE (latch cells), silently missing CK which is the Nangate45 DFF_X1 clock pin name. The probe chain is extended to CLK -> CK -> GATE.

Resolves #9468.

@DeepanshuDadhich DeepanshuDadhich marked this pull request as ready for review March 7, 2026 00:19
Copy link
Contributor

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

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 addresses a bug in the RAM generator's clock pin probing logic and adds a new regression test for the Nangate45 technology. The fix correctly extends the probe chain to include the "CK" pin, which is necessary for Nangate45 cells. The new test case is well-structured, exercising the fix with a non-power-of-2 word count to stress the decoder logic. The changes are sound and enhance the tool's reliability. I have one suggestion to improve the maintainability of the clock pin probing logic.

Comment on lines +123 to +128
const char* clk_pin = "GATE";
if (storage_cell_->findMTerm("CLK")) {
clk_pin = "CLK";
} else if (storage_cell_->findMTerm("CK")) {
clk_pin = "CK";
}
Copy link
Contributor

Choose a reason for hiding this comment

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

medium

For better maintainability and extensibility, you could use a data-driven approach to find the clock pin. This makes it easier to add more possible clock pin names in the future without adding more else if statements.

  const char* clk_pin = "GATE";
  for (const char* name : {"CLK", "CK"}) {
    if (storage_cell_->findMTerm(name)) {
      clk_pin = name;
      break;
    }
  }

Comment on lines +119 to +128
// Resolve the clock-pin name for the storage cell.
// sky130hd DFFs use "CLK", Nangate45 DFFs use "CK", and some latch-type
// storage cells use "GATE". Check in priority order so the correct pin
// is always found regardless of the technology node.
const char* clk_pin = "GATE";
if (storage_cell_->findMTerm("CLK")) {
clk_pin = "CLK";
} else if (storage_cell_->findMTerm("CK")) {
clk_pin = "CK";
}
Copy link
Collaborator

Choose a reason for hiding this comment

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

Instead of setting a fixed pin name you should use the OpenSTA APIs to query for the clock pin. Which is populated by the liberty data.

You can turn the cell name into a LibertyCell then iterate all of its ports then check which pin is the clock pin.

https://github.com/parallaxsw/OpenSTA/blob/master/include/sta/Liberty.hh#L832

Copy link
Author

Choose a reason for hiding this comment

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

got it...thanks for the suggestion..i look into it...

@maliberty maliberty requested a review from rovinski March 7, 2026 02:48
@DeepanshuDadhich DeepanshuDadhich force-pushed the fix/9468-nangate45-ram-test branch from 9d5f2c9 to 329659e Compare March 7, 2026 15:06
add test make_7x7_nangate45 exercising generate_ram with Nangate45
standard cells. Uses an intentionally odd 7-word x 1-byte (56-bit)
configuration to stress the decoder logic on a non-power-of-2 count.

also fix a latent bug in makeCellBit() where the clock-pin name probe
only checked for CLK (sky130hd) or GATE (latch cells), silently
missing CK which is the Nangate45 DFF_X1 clock pin name.
The probe chain is extended to CLK -> CK -> GATE.

Resolves The-OpenROAD-Project#9468.

Signed-off-by: OpenROAD Contributor <contributor@openroad.org>
@DeepanshuDadhich DeepanshuDadhich force-pushed the fix/9468-nangate45-ram-test branch from 329659e to 15b0301 Compare March 7, 2026 15:09
@DeepanshuDadhich
Copy link
Author

Thanks for the helpful suggestions!

I’ve updated the implementation based on the feedback. Instead of relying on hard-coded clock pin names, the code now queries the Liberty data through the OpenSTA API to determine the clock pin for the storage cell.

This should make the detection logic more robust and technology-independent, without assuming specific pin names like CLK, CK, or GATE.

I also reran the regression tests, including the Nangate45 test added in this PR, and verified that the RAM generation flow still works as expected.

Please let me know if there’s anything else I should adjust or improve.


set def_file [make_result_file make_7x7_nangate45.def]
write_def $def_file
diff_files make_7x7_nangate45.defok $def_file
Copy link
Member

Choose a reason for hiding this comment

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

I see no defok

Copy link
Collaborator

Choose a reason for hiding this comment

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

nor lefok

Copy link
Collaborator

@rovinski rovinski left a comment

Choose a reason for hiding this comment

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

Please include layout screenshots to verify that the output looks correct

Comment on lines +28 to +30
-routing_layer {metal1 0.07} \
-ver_layer {metal2 0.07 0.42} \
-hor_layer {metal3 0.07 0.42} \
Copy link
Collaborator

Choose a reason for hiding this comment

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

How were these values determined?

-ver_layer {metal2 0.07 0.42} \
-hor_layer {metal3 0.07 0.42} \
-filler_cells {FILLCELL_X1 FILLCELL_X2 FILLCELL_X4 FILLCELL_X8} \
-write_behavioral_verilog $behavioral_file
Copy link
Collaborator

Choose a reason for hiding this comment

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

I don't think we need to test the behavioral flag. This really isn't significantly different from the 8x8 test.


set def_file [make_result_file make_7x7_nangate45.def]
write_def $def_file
diff_files make_7x7_nangate45.defok $def_file
Copy link
Collaborator

Choose a reason for hiding this comment

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

nor lefok

Copy link
Collaborator

Choose a reason for hiding this comment

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

I don't think .vok is needed for this test

@rovinski
Copy link
Collaborator

rovinski commented Mar 9, 2026

@DeepanshuDadhich I would kindly ask that you not take issues which are already assigned to others as mentioned in #9468. There are many many other issues not yet being worked on in #9392 which you could request assignment on.

One of the main reasons is that @braydenlouie and I discussed this and we decided to pause this while waiting on #9690 which will probably affect this PR significantly.

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.

ram: Cross platform testing - nangate45

4 participants