UPF: Add -supply option to create_power_domain#10170
UPF: Add -supply option to create_power_domain#10170Waleed99i wants to merge 1 commit intoThe-OpenROAD-Project:masterfrom
Conversation
Signed-off-by: Waleed <Waleed99i@users.noreply.github.com>
f01e9e6 to
d5b3633
Compare
There was a problem hiding this comment.
Code Review
This pull request introduces the ability to associate a supply with a power domain by adding the update_power_domain_supply function and updating the create_power_domain TCL command. Review feedback identifies a logic error where the code incorrectly attempts to create a domain instead of finding it to verify existence, a design issue regarding the use of global static maps for state storage which should be replaced with database properties for proper scoping, and the redundant redefinition of the TCL procedure instead of modifying the existing implementation.
| if (odb::dbPowerDomain::create(block, name.c_str()) == nullptr) { | ||
| logger->warn(utl::UPF, 62, | ||
| "Power domain {} not found", | ||
| name); | ||
| return false; | ||
| } |
There was a problem hiding this comment.
The function update_power_domain_supply incorrectly uses odb::dbPowerDomain::create to check for the existence of a power domain. In OpenDB, create returns nullptr if an object with the same name already exists. Consequently, this function will always fail when called on an existing domain. It should use block->findPowerDomain(name.c_str()) instead. Additionally, unexpected failures should be logged as errors rather than warnings to ensure critical failure messages are not missed by the user.
| if (odb::dbPowerDomain::create(block, name.c_str()) == nullptr) { | |
| logger->warn(utl::UPF, 62, | |
| "Power domain {} not found", | |
| name); | |
| return false; | |
| } | |
| if (block->findPowerDomain(name.c_str()) == nullptr) { | |
| logger->error(utl::UPF, 62, | |
| "Power domain {} not found", | |
| name); | |
| return false; | |
| } |
References
- Unexpected failures should be logged as an error, not a warning, to ensure critical failure messages are not missed by the user.
| return true; | ||
| } | ||
|
|
||
| static std::unordered_map<std::string, std::string> power_domain_supply_map; |
There was a problem hiding this comment.
Using a static std::unordered_map for power domain supplies introduces global state that persists across different designs and does not account for multiple blocks. If two different blocks have power domains with the same name, their supply associations will collide. Consider using odb::dbStringProperty to attach the supply information directly to the odb::dbPowerDomain object. This ensures the data is correctly scoped to the block and design, avoiding state leaks between sessions and ensuring correct behavior when multiple designs are active.
References
- To ensure the correct design context is used, state should be properly scoped to the design or block, especially when multiple designs may be active.
| sta::define_cmd_args "create_power_domain" { [-elements elements] [-supply supply] name } | ||
| proc create_power_domain { args } { |
This PR adds support for the
-supplyoption in thecreate_power_domaincommand in the UPF flow.Summary
The
create_power_domaincommand is extended to accept an optional-supplyargument, allowing users to associate a supply set with a power domain during creation.Resolving issue #5617Changes
-supplyargument increate_power_domainupdate_power_domain_supply_cmdupdate_power_domain_supplyin C++ to store the mappingImplementation Details
std::unordered_map<std::string, std::string>) sincedbPowerDomaindoes not yet support supply attributesExample Usage
create_power_domain PD1 -supply ss_GNDD_VDDD
Notes
Impact