Repository navigation
upf: add supply-net commands, upf_version, and supply options (#5617) - #10720
saurav-fermions wants to merge 7 commits into
Conversation
There was a problem hiding this comment.
Code Review
This pull request introduces support for UPF supply ports, supply nets, and versioning in OpenROAD. Since the odb schema lacks dedicated objects for these constructs, they are persisted as string properties on the block, power domain, or isolation strategy. The changes include new C++ functions, SWIG/Tcl bindings, and integration tests. Feedback is provided regarding connect_supply_net, which currently overwrites the connection property with the last port specified; it should instead append ports to support connecting a supply net to multiple supply ports.
| } | ||
| } | ||
|
|
||
| setStringProperty(block, kSupplyNetConnPrefix + net, port); |
There was a problem hiding this comment.
Currently, connect_supply_net overwrites the connection property kSupplyNetConnPrefix + net with the last port specified. In UPF, a supply net can be connected to multiple supply ports (e.g., via -ports {VDD1 VDD2}). To support multiple port connections correctly, we should append the port to the existing space-separated list of ports instead of overwriting it.
const std::string conn_prop = kSupplyNetConnPrefix + net;
odb::dbStringProperty* prop = odb::dbStringProperty::find(block, conn_prop.c_str());
if (prop != nullptr) {
std::string existing = prop->getValue();
if (!existing.empty() && !port.empty()) {
existing += " " + port;
} else if (existing.empty()) {
existing = port;
}
prop->setValue(existing.c_str());
} else {
odb::dbStringProperty::create(block, conn_prop.c_str(), port.c_str());
}|
Code should be formatted with clang-format |
2958413 to
4d18841
Compare
connect_supply_net is invoked once per port (the tcl loops over -ports), so overwriting the connection property kept only the last port and silently dropped earlier ones. Store the ports as a space-separated, de-duplicated list instead, and extend supply.tcl to cover the multi-port case. Addresses gemini-code-assist review on The-OpenROAD-Project#10720. Signed-off-by: Saurav Singh <saurav.singh@fermions.co>
|
Both addressed: clang-format is clean now, and |
|
Needs a tclfmt as well. @LucasYuki I'll leave the functional review to you. |
Apply tclfmt (spaces-in-braces) to the test per repo Tcl style. Addresses @maliberty review on The-OpenROAD-Project#10720. Signed-off-by: Saurav Singh <saurav.singh@fermions.co>
|
Done — ran |
|
This pull request has been automatically marked as stale because it has not had recent activity. It will be closed in 21 days if no further activity occurs. Remove the |
|
@LucasYuki you need to review |
|
|
||
| } // namespace | ||
|
|
||
| bool set_upf_version(utl::Logger* logger, |
There was a problem hiding this comment.
We are using the IEEE 1801-2013 – UPF 2.1 standard.
Could you add a warning to inform the user if the version is different?
| sta::define_cmd_args "create_power_domain" { [-elements elements] name } | ||
| sta::define_cmd_args "create_power_domain" { \ | ||
| [-elements elements] \ | ||
| [-include_scope] \ |
There was a problem hiding this comment.
In UPF 2.1 this flag is already deprecated.
| logger->warn(utl::UPF, 84, "Supply net {} already exists", name); | ||
| return false; | ||
| } | ||
| // -reuse: tolerate the redeclaration, refresh the domain association. |
There was a problem hiding this comment.
The reuse flag is for making an existing net available in another domain, not for changing the domain of an existing supply net.
When this flag is used, the domain must be given on both the original command and the -reuse one.
| [-clamp_value clamp_value] \ | ||
| [-isolation_signal isolation_signal] \ | ||
| [-isolation_sense isolation_sense] \ | ||
| [-isolation_supply isolation_supply] \ |
There was a problem hiding this comment.
The option name is isolation_supply_set in UPF 2.1.
| sta::check_argc_eq1 "create_supply_port" $args | ||
|
|
||
| set port_name [lindex $args 0] | ||
| set direction "" |
There was a problem hiding this comment.
The default direction is "in".
| const std::string& name, | ||
| const std::string& direction) | ||
| { | ||
| if (!direction.empty() && direction != "in" && direction != "out") { |
| } | ||
|
|
||
| if { [llength $ports] == 0 } { | ||
| upf::connect_supply_net_cmd $net_name "" |
There was a problem hiding this comment.
If there are no ports, you should raise an error.
|
|
||
| if (!port.empty()) { | ||
| const std::string port_prop = kSupplyPortPrefix + port; | ||
| if (odb::dbStringProperty::find(block, port_prop.c_str()) == nullptr) { |
There was a problem hiding this comment.
-ports accepts rooted port names, including design ports and hierarchical names, not just ports declared with create_supply_port.
| proc create_power_domain { args } { | ||
| upf::check_block_exists | ||
|
|
||
| sta::parse_key_args "create_power_domain" args \ |
There was a problem hiding this comment.
The -supply can be used multiple times in the same command and sta::parse_key_args does not support this.
To parse this option, you can do the following modifications:
ord::parse_list_args "create_power_domain" args list {-supply}
sta::parse_key_args "create_power_domain" args \
keys {-elements} flags {-include_scope}
...
foreach supply_arg $list(-supply) {
if { [llength $supply_arg] < 1 || [llength $supply_arg] > 2 } {
utl::error UPF 89 \
"-supply expects {supply_set_handle \[supply_set_ref\]}, got {$supply_arg}"
}
lassign [upf::process_list_arg $supply_arg 2] handle ref
upf::set_power_domain_supply_cmd $domain_name $handle $ref
}
…enROAD-Project#5617) Implements a conservative, tested subset of the missing UPF surface from issue The-OpenROAD-Project#5617 that maps onto existing odb structures without a schema bump: New commands: - upf_version (validate known versions, store as block property) - create_supply_port (store as block string-property) - create_supply_net (store as block property, supports -domain/-reuse) - connect_supply_net (validate net/port refs, store connection) New options on existing commands: - create_power_domain -include_scope (maps to '.' element) and -supply (stored as a property on the domain) - set_isolation -isolation_supply / -source / -sink (stored as properties on the dbIsolation object) Supply-net/port constructs have no dedicated odb object, so they are persisted via the generic dbStringProperty mechanism, keeping them queryable and round-trippable through DB save/load without new schema. PST, create_supply_set, set_port_attributes, and add_port_state are deferred (they require new odb schema). See AGENT_REPORT.md. Adds src/upf/test/supply.tcl exercising all new commands/options and asserting the resulting odb state, registered in both CMake and Bazel. Signed-off-by: Saurav Singh <saurav.singh@fermions.co>
connect_supply_net is invoked once per port (the tcl loops over -ports), so overwriting the connection property kept only the last port and silently dropped earlier ones. Store the ports as a space-separated, de-duplicated list instead, and extend supply.tcl to cover the multi-port case. Addresses gemini-code-assist review on The-OpenROAD-Project#10720. Signed-off-by: Saurav Singh <saurav.singh@fermions.co>
Apply tclfmt (spaces-in-braces) to the test per repo Tcl style. Addresses @maliberty review on The-OpenROAD-Project#10720. Signed-off-by: Saurav Singh <saurav.singh@fermions.co>
Address review feedback on the supply-net support:
- upf_version: warn (UPF-0080) when the version is not 2.1, the
IEEE 1801-2013 revision OpenROAD implements.
- create_power_domain: -supply may be given multiple times (parsed with
ord::parse_list_args); each {handle [ref]} is validated (UPF-0089)
and stored per handle. -include_scope is deprecated in UPF 2.1 and
now warns (UPF-0090) while still mapping to the '.' element.
- create_supply_port: default -direction is in; inout is accepted.
- create_supply_net -reuse: makes an existing net available in another
domain instead of changing its domain. -domain is required with
-reuse (UPF-0092), the net must exist (UPF-0093) and must have been
created with -domain (UPF-0094).
- connect_supply_net: -ports is required (UPF-0091) and accepts rooted
names: supply ports, design ports, leaf instance pins and
hierarchical module-instance ports.
- set_isolation: rename -isolation_supply to the UPF 2.1 option
-isolation_supply_set.
- Include Exception.i in upf.i so errors raised from C++ become Tcl
errors.
Extend upf.supply and add upf.supply_hier to cover these behaviors.
Signed-off-by: Saurav Singh <saurav.singh@fermions.co>
Add README entries for upf_version, create_supply_port, create_supply_net and connect_supply_net, and for the new create_power_domain and set_isolation options, so the man/Tcl command-count doc check matches. Update the readme message check golden accordingly. Signed-off-by: Saurav Singh <saurav.singh@fermions.co>
56b688a to
e88a882
Compare
|
@LucasYuki sorry for the churn. A force-push landed on this branch before I was ready, and it rewrote the history you reviewed, so "changes since last review" won't line up. I'm still checking the changes against your comments. I'll follow up here with a point-by-point reply once that's done, so it's probably not worth re-reviewing until then. |
The supported version is IEEE 1801-2013 (UPF 2.1); the inline comment still cited 2.0 as the example. Signed-off-by: Saurav Singh <saurav.singh@fermions.co>
|
@LucasYuki following up. All nine points are addressed in
UPF-related tests pass (14/14) and formatting is clean. I haven't run Bazel. |
Resolve the two conflicts: - src/upf/test/CMakeLists.txt: master removed the CMake build; the supply and supply_hier tests stay registered in src/upf/test/BUILD. - src/upf/src/upf.i: master now includes Exception.i itself, the same include this branch added. Signed-off-by: Saurav Singh <saurav.singh@fermions.co>
|
Merged current master (which removed the CMake build) into this branch. Two trivial conflicts, no change to the code you reviewed. CI is green again, including Mac-Build. @LucasYuki, could you take another look when you have a chance? |
Summary
Adds a coherent, tested subset of the UPF supply-net commands,
upf_version, and supply options that the UPF reader was missing, mapped onto existing ODB structures. Scoped conservatively: anything requiring new ODB schema is explicitly deferred.Type of Change
Impact
UPF scripts using the added commands now parse and apply instead of erroring; existing flows unaffected.
Verification
ctest -R '^upf\.'5/5.Related Issues
Fixes #5617
Developed with SAIGE, Fermions' autonomous RTL/EDA debugging agent; root-caused, tested, and signed off by the submitter (@saurav-fermions).