Skip to content

ram: Enable optional user-provided name for power rails#10572

Merged
maliberty merged 4 commits into
The-OpenROAD-Project:masterfrom
tnguy19:optional-power-rails
Jun 1, 2026
Merged

ram: Enable optional user-provided name for power rails#10572
maliberty merged 4 commits into
The-OpenROAD-Project:masterfrom
tnguy19:optional-power-rails

Conversation

@tnguy19
Copy link
Copy Markdown
Contributor

@tnguy19 tnguy19 commented May 31, 2026

Summary

Allow users to change the names of power rails or leave as default (power_net=VDD, ground_net=VSS). README.md is also updated to include information on this change

Type of Change

  • New feature
  • Documentation update

Impact

Allow user-defined name for power rails

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 #10563

@rovinski

Signed-off-by: Thinh Nguyen <nguyenthinh19011@gmail.com>
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 adds support for custom power and ground net names in the RAM generator by introducing the optional -power_net_name and -ground_net_name arguments (defaulting to VDD and VSS). These parameters are propagated from the TCL interface down to the C++ implementation. Feedback on the changes suggests adding defensive checks in the C++ code to handle null or empty net names and to look up existing nets before creation, preventing potential segmentation faults.

Comment thread src/ram/src/ram.cpp Outdated
Comment on lines +894 to +895
auto power_net = dbNet::create(block_, power_net_name);
auto ground_net = dbNet::create(block_, ground_net_name);
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

To prevent potential crashes (segmentation faults) if power_net_name or ground_net_name are null/empty, or if the nets already exist in the block (in which case dbNet::create returns nullptr), we should defensively check for null/empty names, try to find the existing nets first, and verify that the nets were successfully retrieved or created before using them.

  if (power_net_name == nullptr || power_net_name[0] == '\0') {
    power_net_name = "VDD";
  }
  if (ground_net_name == nullptr || ground_net_name[0] == '\0') {
    ground_net_name = "VSS";
  }

  auto power_net = block_->findNet(power_net_name);
  if (!power_net) {
    power_net = dbNet::create(block_, power_net_name);
  }
  auto ground_net = block_->findNet(ground_net_name);
  if (!ground_net) {
    ground_net = dbNet::create(block_, ground_net_name);
  }

  if (!power_net) {
    logger_->error(RAM, 38, "Failed to find or create power net: {}", power_net_name);
  }
  if (!ground_net) {
    logger_->error(RAM, 39, "Failed to find or create ground net: {}", ground_net_name);
  }

Copy link
Copy Markdown
Contributor Author

@tnguy19 tnguy19 May 31, 2026

Choose a reason for hiding this comment

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

Safety checks are added in 9639564

tnguy19 added 3 commits May 31, 2026 12:55
Signed-off-by: Thinh Nguyen <nguyenthinh19011@gmail.com>
…rguments

Signed-off-by: Thinh Nguyen <nguyenthinh19011@gmail.com>
Signed-off-by: Thinh Nguyen <nguyenthinh19011@gmail.com>
@tnguy19 tnguy19 marked this pull request as ready for review June 1, 2026 03:02
@tnguy19 tnguy19 requested a review from a team as a code owner June 1, 2026 03:02
@tnguy19 tnguy19 requested a review from maliberty June 1, 2026 03:02
@maliberty maliberty merged commit 9e7706d into The-OpenROAD-Project:master Jun 1, 2026
16 checks passed
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: enable optional user-provided name of power rails

3 participants