Skip to content

ram: auto-detect power and ground pin names#10580

Draft
tnguy19 wants to merge 7 commits into
The-OpenROAD-Project:masterfrom
tnguy19:auto-detect-power-ground
Draft

ram: auto-detect power and ground pin names#10580
tnguy19 wants to merge 7 commits into
The-OpenROAD-Project:masterfrom
tnguy19:auto-detect-power-ground

Conversation

@tnguy19
Copy link
Copy Markdown
Contributor

@tnguy19 tnguy19 commented Jun 2, 2026

Summary

Automatically detect power and ground pin names instead of requiring the user to manually specify using -power_pin and -ground_pin, then globally connect them. The RAM generator will only collect primary power/grounds. README.md and tcl files are updated to reflect this new change

Type of Change

  • New feature
  • Documentation update

Impact

User no longer need to manually specify power and ground names when using the tool

Verification

  • I have verified that the local build succeeds (./etc/Build.sh).
  • I have run the relevant tests and they pass.
  • My code follows the repository's formatting guidelines.
  • I have signed my commits (DCO).

Related Issues

Fixes #10562

@rovinski

Signed-off-by: Thinh Nguyen <nguyenthinh19011@gmail.com>
@github-actions github-actions Bot added the size/S label Jun 2, 2026
Copy link
Copy Markdown
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 removes the explicit -power_pin and -ground_pin arguments from the generate_ram command, instead automatically detecting power and ground pin names from the cell library and storing them in member sets. Feedback was provided regarding a potential state leakage issue where these member sets accumulate pin names across multiple runs in the same session, suggesting to clear them at the end of ramPdngen.

Important

The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.

Comment thread src/ram/src/ram.cpp
Comment on lines +922 to 930
for (const auto& pin_name : power_pin_names_) {
block_->addGlobalConnect(nullptr, ".*", pin_name.c_str(), power_net, true);
}

for (const auto& pin_name : ground_pin_names_) {
block_->addGlobalConnect(nullptr, ".*", pin_name.c_str(), ground_net, true);
}

block_->globalConnect(false, false);
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.

high

Since RamGen is a persistent object in the OpenROAD session (retrieved via ord::getRamGen()), the member variables power_pin_names_ and ground_pin_names_ will accumulate pin names across multiple runs of generate_ram in the same session. This can lead to incorrect global connections or errors if different libraries or designs are processed sequentially.

To prevent this state leakage, clear both sets at the end of ramPdngen once the global connections have been established.

Suggested change
for (const auto& pin_name : power_pin_names_) {
block_->addGlobalConnect(nullptr, ".*", pin_name.c_str(), power_net, true);
}
for (const auto& pin_name : ground_pin_names_) {
block_->addGlobalConnect(nullptr, ".*", pin_name.c_str(), ground_net, true);
}
block_->globalConnect(false, false);
for (const auto& pin_name : power_pin_names_) {
block_->addGlobalConnect(nullptr, ".*", pin_name.c_str(), power_net, true);
}
for (const auto& pin_name : ground_pin_names_) {
block_->addGlobalConnect(nullptr, ".*", pin_name.c_str(), ground_net, true);
}
block_->globalConnect(false, false);
power_pin_names_.clear();
ground_pin_names_.clear();

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

this is added in 382d8c7

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

It's unnecessary because you would not be creating more than one RAM per session. OpenROAD doesn't support operating on more than one design and likely won't in the future.

tnguy19 added 3 commits June 2, 2026 10:52
Signed-off-by: Thinh Nguyen <nguyenthinh19011@gmail.com>
Signed-off-by: Thinh Nguyen <nguyenthinh19011@gmail.com>
Signed-off-by: Thinh Nguyen <nguyenthinh19011@gmail.com>
Comment thread src/ram/src/ram.cpp
Comment on lines +585 to +592
for (auto& [role, name] : pin_map) {
if (role.type == PortRoleType::Power) {
power_pin_names_.insert(name);
} else if (role.type == PortRoleType::Ground) {
ground_pin_names_.insert(name);
}
}

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Does this guarantee that only one primary power is used? What if there are two different power pins found? We would want to error in that case.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I have added a error check in baf136e, ready for review

tnguy19 added 3 commits June 2, 2026 15:41
…cross cells, remove unnecessary clear function for pin sets

Signed-off-by: Thinh Nguyen <nguyenthinh19011@gmail.com>
Signed-off-by: Thinh Nguyen <nguyenthinh19011@gmail.com>
Signed-off-by: Thinh Nguyen <nguyenthinh19011@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

ram: add automatic detection of standard cell power/ground names

2 participants