-
Notifications
You must be signed in to change notification settings - Fork 259
Sta update latest 0505 #357
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 6 commits
15c59e7
6fd3194
f622da7
bd1cbef
f813d94
c1ebbb9
ccce34f
bfbbe0d
5b9d0f3
20af8fd
c74dac5
e0ddce7
afa2286
0968c3f
7fca318
801d621
9065d91
9ccaa8c
b31ae3c
4ec11fe
2290ed9
fa3c89f
2a2450f
ac7dfe5
00f4f5e
8f7e85a
aa0b352
76c4d6d
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -42,31 +42,38 @@ proc_redirect read_sdc { | |
| check_argc_eq1 "read_sdc" $args | ||
| set echo [info exists flags(-echo)] | ||
| set filename [file nativename [lindex $args 0]] | ||
| set mode_name {} | ||
|
|
||
| if { [info exists keys(-mode)] } { | ||
| set mode_name $keys(-mode) | ||
| } | ||
| set prev_mode [cmd_mode_name] | ||
| try { | ||
| set_mode_cmd $mode_name | ||
| include_file $filename $echo 0 | ||
| } finally { | ||
| if { $prev_mode != "default" } { | ||
| set_mode_cmd $prev_mode | ||
| set prev_mode [cmd_mode_name] | ||
| try { | ||
| set_cmd_mode $mode_name | ||
| include_file $filename $echo 0 | ||
| } finally { | ||
| if { $prev_mode != "default" } { | ||
| set_cmd_mode $prev_mode | ||
| } | ||
| } | ||
| } else { | ||
| include_file $filename $echo 0 | ||
| } | ||
| } | ||
|
|
||
| ################################################################ | ||
|
|
||
| define_cmd_args "write_sdc" \ | ||
| {[-map_hpins] [-digits digits] [-gzip] [-no_timestamp] filename} | ||
| {[-mode mode] [-map_hpins] [-digits digits] [-gzip] [-no_timestamp] filename} | ||
|
|
||
| proc write_sdc { args } { | ||
| parse_key_args "write_sdc" args keys {-digits -significant_digits} \ | ||
| parse_key_args "write_sdc" args keys {-mode -digits} \ | ||
| flags {-map_hpins -compatible -gzip -no_timestamp} | ||
| check_argc_eq1 "write_sdc" $args | ||
|
|
||
| set mode [cmd_mode] | ||
| if { [info exists keys(-mode)] } { | ||
| set mode $keys(-mode) | ||
| } | ||
|
Comment on lines
+72
to
+75
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There is a potential bug in how the
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Search.i:822 cmd_mode() returns Mode* (SWIG pointer string _xxx_p_Mode). Line 48 already uses [cmd_mode_name] for prev_mode. Same pattern needed in line 72
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ignore |
||
|
|
||
| set digits 4 | ||
| if { [info exists keys(-digits)] } { | ||
| set digits $keys(-digits) | ||
|
|
@@ -78,7 +85,7 @@ proc write_sdc { args } { | |
| set no_timestamp [info exists flags(-no_timestamp)] | ||
| set map_hpins [info exists flags(-map_hpins)] | ||
| set native [expr ![info exists flags(-compatible)]] | ||
| write_sdc_cmd $filename $map_hpins $native $digits $gzip $no_timestamp | ||
| write_sdc_cmd $filename $mode $map_hpins $native $digits $gzip $no_timestamp | ||
| } | ||
|
|
||
| ################################################################ | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -570,30 +570,46 @@ Sta::clearNonSdc() | |
| Sdc * | ||
| Sta::cmdSdc() const | ||
| { | ||
| return cmdMode()->sdc(); | ||
| return cmd_mode_->sdc(); | ||
| } | ||
|
|
||
| void | ||
| Sta::setCmdMode(std::string_view mode_name) | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The check for an empty
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Commit f622da7 removed if (!mode_name.empty()) guard. Now empty mode_name:
Fix: guard early in function: Or
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ignore |
||
| { | ||
| if (!mode_name.empty()) { | ||
| if (!mode_name_map_.contains(mode_name)) { | ||
| if (modes_.size() == 1 && modes_[0]->name() == "default") { | ||
| // No need for default mode if one is defined. | ||
| delete modes_[0]; | ||
| mode_name_map_.clear(); | ||
| modes_.clear(); | ||
| Mode *mode = findKey(mode_name_map_, std::string(mode_name)); | ||
| if (mode) { | ||
| // Sync scene with mode. Note that multiple scenes can share a mode. | ||
| Scene *mode_scene = nullptr; | ||
| for (Scene *scene : scenes_) { | ||
| if (scene->mode() == mode) { | ||
| if (mode_scene) { | ||
| report_->warn(1556, "multiple scenes reference mode {}", mode_name); | ||
| break; | ||
| } | ||
| mode_scene = scene; | ||
| } | ||
| Mode *mode = new Mode(mode_name, mode_name_map_.size(), this); | ||
| mode_name_map_[std::string(mode_name)] = mode; | ||
| modes_.push_back(mode); | ||
| mode->sim()->setMode(mode); | ||
| mode->sim()->setObserver(new StaSimObserver(this)); | ||
|
|
||
| if (scenes_.size() == 1 && scenes_[0]->name() == "default") | ||
| scenes_[0]->setMode(mode); | ||
| updateComponentsState(); | ||
| } | ||
| if (mode_scene) | ||
| cmd_scene_ = mode_scene; | ||
| cmd_mode_ = mode; | ||
| } | ||
| else { | ||
| if (modes_.size() == 1 && modes_[0]->name() == "default") { | ||
| // No need for default mode if one is defined. | ||
| delete modes_[0]; | ||
| mode_name_map_.clear(); | ||
| modes_.clear(); | ||
| } | ||
| Mode *mode = new Mode(mode_name, mode_name_map_.size(), this); | ||
| mode_name_map_[std::string(mode_name)] = mode; | ||
| modes_.push_back(mode); | ||
| mode->sim()->setMode(mode); | ||
| mode->sim()->setObserver(new StaSimObserver(this)); | ||
| cmd_mode_ = mode; | ||
|
|
||
| if (scenes_.size() == 1 && scenes_[0]->name() == "default") | ||
| scenes_[0]->setMode(mode); | ||
| updateComponentsState(); | ||
| } | ||
| } | ||
|
|
||
|
|
@@ -2190,6 +2206,22 @@ Sta::checkExceptionToPins(ExceptionTo *to, | |
| } | ||
| } | ||
|
|
||
| void | ||
| Sta::writeSdc(std::string_view filename, | ||
| std::string_view mode_name, | ||
| bool leaf, | ||
| bool native, | ||
| int digits, | ||
| bool gzip, | ||
| bool no_timestamp) | ||
| { | ||
| Mode *mode = findMode(mode_name); | ||
| if (mode) | ||
| writeSdc(mode->sdc(), filename, leaf, native, digits, gzip, no_timestamp); | ||
| else | ||
| report_->warn(1561, "mode {} not found.", mode_name); | ||
| } | ||
|
|
||
| void | ||
| Sta::writeSdc(const Sdc *sdc, | ||
| std::string_view filename, | ||
|
|
@@ -2514,6 +2546,7 @@ Sta::makeDefaultScene() | |
| makeScene(name, mode, parasitics); | ||
|
|
||
| cmd_scene_ = scenes_[0]; | ||
| cmd_mode_ = mode; | ||
| } | ||
|
|
||
| // define_corners (before read_liberty). | ||
|
|
@@ -2603,8 +2636,8 @@ Sta::makeScene(const std::string &name, | |
| if (scenes_.size() == 1 && findScene("default")) | ||
| deleteScenes(); | ||
|
|
||
| Scene *scene = | ||
| new Scene(name, scenes_.size(), mode, parasitics_min, parasitics_max); | ||
| Scene *scene = new Scene(name, scenes_.size(), mode, | ||
| parasitics_min, parasitics_max); | ||
| scene_name_map_[name] = scene; | ||
| scenes_.push_back(scene); | ||
| mode->addScene(scene); | ||
|
|
@@ -2696,6 +2729,7 @@ void | |
| Sta::setCmdScene(Scene *scene) | ||
| { | ||
| cmd_scene_ = scene; | ||
| cmd_mode_ = scene->mode(); | ||
| } | ||
|
|
||
| SceneSeq | ||
|
|
@@ -3529,7 +3563,7 @@ Sta::findRequired(Vertex *vertex) | |
| search_->findAllArrivals(); | ||
| if (search_->isEndpoint(vertex) | ||
| // Need to include downstream required times if there is fanout. | ||
| && !hasFanout(vertex, search_->searchAdj(), graph_, cmdMode())) | ||
| && !hasFanout(vertex, search_->searchAdj(), graph_, cmd_mode_)) | ||
| search_->seedRequired(vertex); | ||
| else | ||
| search_->findRequireds(vertex->level()); | ||
|
|
@@ -3927,14 +3961,14 @@ Sta::findLogicConstants() | |
| { | ||
| ensureGraph(); | ||
| // Sdc independent constants so any mode should return the same values. | ||
| Sim *sim = cmdMode()->sim(); | ||
| Sim *sim = cmd_mode_->sim(); | ||
| sim->findLogicConstants(); | ||
| } | ||
|
|
||
| void | ||
| Sta::clearLogicConstants() | ||
| { | ||
| Sim *sim = cmdMode()->sim(); | ||
| Sim *sim = cmd_mode_->sim(); | ||
| sim->clear(); | ||
| } | ||
|
|
||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -447,12 +447,13 @@ VerilogWriter::writeAssigns(const Instance *inst) | |
| if (term) { | ||
| Net *net = network_->net(term); | ||
| Port *port = network_->port(pin); | ||
| if (port | ||
| if (net | ||
| && port | ||
| && (include_pwr_gnd_ | ||
| || !(network_->isPower(net) || network_->isGround(net))) | ||
| && (network_->direction(port)->isAnyOutput() | ||
| || (include_pwr_gnd_ && network_->direction(port)->isPowerGround())) | ||
| && !stringEqual(network_->name(port), network_->name(net))) { | ||
| && network_->name(port) != network_->name(net)) { | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This condition compares two && std::string(network_->name(port)) != std::string(network_->name(net))) {
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Hallucination: Both Network::name(Port*) and Network::name(Net*) return std::string, not const char*. operator!= on std::string does content comparison. No bug |
||
| // Port name is different from net name. | ||
| std::string port_vname = netVerilogName(std::string(network_->name(port))); | ||
| std::string net_vname = netVerilogName(std::string(network_->name(net))); | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There appears to be a typo in the example provided. The note is about the
write_sdccommand, but the example showsread_sdc. To avoid confusion, the example should probably be forwrite_sdc.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed