Skip to content

UPF: add upf_version#9743

Draft
DivyanshuX9 wants to merge 4 commits into
The-OpenROAD-Project:masterfrom
DivyanshuX9:Upf_5617_issue_resolve_by_Divyanshu
Draft

UPF: add upf_version#9743
DivyanshuX9 wants to merge 4 commits into
The-OpenROAD-Project:masterfrom
DivyanshuX9:Upf_5617_issue_resolve_by_Divyanshu

Conversation

@DivyanshuX9

@DivyanshuX9 DivyanshuX9 commented Mar 12, 2026

Copy link
Copy Markdown

upf: validate and persist upf_version

This adds support for parsing upf_version, validates supported UPF versions
(1.0, 2.0, 2.1, 3.0, 3.1), stores the selected version on dbBlock, and writes
it back out through write_upf.

Adds regression coverage for:

  • accepted versions
  • invalid versions
  • persistence across updates

This is an incremental step toward broader UPF support.

@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 introduces the upf_version command. The implementation is straightforward, but there's an issue with error handling. Currently, if an invalid version string is provided, the Tcl command succeeds while only printing a warning. My feedback focuses on propagating the error status from the C++ layer to the Tcl script to ensure the command fails correctly, which is more consistent with typical command-line tool behavior.

Comment thread src/upf/src/upf.i Outdated
Comment on lines +223 to +226
void upf_version_cmd(const char* version) {
odb::dbDatabase* db = getOpenRoad()->getDb();
upf::upf_version(getOpenRoad()->getLogger(), db->getChip()->getBlock(), version);
}

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.

medium

The upf_version_cmd function should propagate the success/failure status from upf::upf_version. This allows the Tcl script to handle errors properly. Please change the return type to bool and return the result of the call.

  bool upf_version_cmd(const char* version) {
    odb::dbDatabase* db = getOpenRoad()->getDb();
    return upf::upf_version(getOpenRoad()->getLogger(), db->getChip()->getBlock(), version);
  }

Comment thread src/upf/src/upf.tcl Outdated
sta::check_argc_eq1 "upf_version" $args

set version [lindex $args 0]
upf::upf_version_cmd $version

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.

medium

The Tcl command should check the return value of upf::upf_version_cmd and report an error if it fails. This ensures that invalid calls (e.g., with an empty version string) cause the Tcl command to fail, which is standard practice. This change depends on the suggested change in src/upf/src/upf.i.

  if {![upf::upf_version_cmd $version]} {
    sta::error "Failed to set UPF version."
  }

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Bro I Updated the implementation to propagate the return status
from C++ to Tcl as per your suggestion
Changed upf_version_cmd to return bool, Updated Tcl to check return value, Fixed function signature in header
Also fixed my commit with Signed-off-by for DCO.

Please review again.

@DivyanshuX9 DivyanshuX9 marked this pull request as ready for review March 12, 2026 18:36
@DivyanshuX9 DivyanshuX9 marked this pull request as draft March 12, 2026 18:36
@DivyanshuX9 DivyanshuX9 force-pushed the Upf_5617_issue_resolve_by_Divyanshu branch 3 times, most recently from 3b647ad to 8eab67f Compare March 14, 2026 10:51
Signed-off-by: Divyanshu_Sharma <divyanshu88999@gmail.com>
@DivyanshuX9 DivyanshuX9 force-pushed the Upf_5617_issue_resolve_by_Divyanshu branch from 8eab67f to 3aac0e7 Compare March 14, 2026 11:25
@github-actions

Copy link
Copy Markdown
Contributor

clang-tidy review says "All clean, LGTM! 👍"

@DivyanshuX9 DivyanshuX9 marked this pull request as ready for review May 2, 2026 09:48
@DivyanshuX9 DivyanshuX9 requested a review from a team as a code owner June 7, 2026 05:56
@DivyanshuX9 DivyanshuX9 requested a review from maliberty June 7, 2026 05:56
@github-actions github-actions Bot added the size/S label Jun 7, 2026
@maliberty

Copy link
Copy Markdown
Member
[2026-06-07T06:00:56.164Z] #11 69.19 Error: UPF 0001 used 2 times, next free message id is 26
[2026-06-07T06:00:56.164Z] #11 69.19   Appears in upf.cpp on line 1598 
[2026-06-07T06:00:56.164Z] #11 69.19   Appears in upf.cpp on line 31 

Comment thread src/upf/src/upf.cpp Outdated
logger->warn(utl::UPF, 62, "upf_version requires a version string");
return false;
}
logger->info(utl::UPF, 1, "UPF version set to {}", version);

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.

This doesn't do anything besides print a message.

@maliberty

Copy link
Copy Markdown
Member

Stores version in dbBlock using setUPFVersion

False advertising

DivyanshuX9 and others added 2 commits June 7, 2026 17:02
- Add setUPFVersion/getUPFVersion to dbBlock (odb layer)
- Bump schema to kSchemaBlockUpfVersion=133 for DB stream compat
- Implement set_upf_version in upf.cpp; validates and persists version
- Fix duplicate logger ID: use UPF 46 (was colliding with UPF 1)
- Add upf_version Tcl command with proper failure propagation
- Add SWIG wrapper set_upf_version_cmd in upf.i
- Write version to UPF output file via writer.cpp
- Add upf_version regression test (valid, multi-call, invalid-empty)

Fixes The-OpenROAD-Project#5617

Signed-off-by: Divyanshu Sharma <divyanshu88999@gmail.com>
@DivyanshuX9 DivyanshuX9 requested a review from a team as a code owner June 7, 2026 11:51
@DivyanshuX9 DivyanshuX9 requested a review from osamahammad21 June 7, 2026 11:51
@github-actions github-actions Bot added size/XL and removed size/S labels Jun 7, 2026
@DivyanshuX9 DivyanshuX9 marked this pull request as draft June 7, 2026 11:52
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.

2 participants