Skip to content

Commit 43888c0

Browse files
committed
sta::make_report_path_attr_field
Signed-off-by: James Cherry <cherry@parallaxsw.com>
1 parent cc500ee commit 43888c0

6 files changed

Lines changed: 40 additions & 23 deletions

File tree

include/sta/Sta.hh

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,8 @@ using CheckErrorSeq = std::vector<CheckError*>;
8383
enum class CmdNamespace { sta, sdc };
8484
using ParasiticsNameMap = std::map<std::string, Parasitics*, std::less<>>;
8585
using GraphLoopSeq = std::vector<GraphLoop*>;
86-
using ReportFieldGetValue = std::function<std::string (const Path*)>;
86+
using ReportFieldGetValue = std::function<std::string (const Path *path,
87+
const StaState *sta)>;
8788

8889
// Initialize sta functions that are not part of the Sta class.
8990
void initSta();

network/Network.i

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -655,6 +655,15 @@ get_attribute(const char *key)
655655
return Sta::sta()->ensureLinked()->getAttribute(self, key);
656656
}
657657

658+
void
659+
set_attribute(const char *key,
660+
const char *value)
661+
{
662+
sta::Sta *sta = Sta::sta();
663+
sta->ensureLinked();
664+
sta->networkReader()->setAttribute(self, key, value);
665+
}
666+
658667
} // Instance methods
659668

660669
%extend InstanceChildIterator {
@@ -813,4 +822,3 @@ bool has_next() { return self->hasNext(); }
813822
const Pin *next() { return self->next(); }
814823
void finish() { delete self; }
815824
} // NetConnectedPinIterator methods
816-

search/ReportPath.cc

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -121,9 +121,10 @@ ReportField::setEnabled(bool enabled)
121121
}
122122

123123
std::string
124-
ReportField::value(const Path *path) const
124+
ReportField::value(const Path *path,
125+
const StaState *sta) const
125126
{
126-
return get_value_(path);
127+
return get_value_(path, sta);
127128
}
128129

129130
////////////////////////////////////////////////////////////////
@@ -2840,13 +2841,13 @@ ReportPath::reportPath6(const Path *path,
28402841
if (field_fanout_->enabled())
28412842
fanout = drvrFanout(vertex, scene, min_max);
28422843
const std::string what = descriptionField(vertex);
2843-
reportLine(what, path, cap, slew, fanout,
2844+
reportLine(what, path1, cap, slew, fanout,
28442845
incr, field_blank_, time, false, min_max, rf, src_attr,
28452846
line_case);
28462847

28472848
if (report_net_) {
28482849
const std::string what2 = descriptionNet(pin);
2849-
reportLine(what2, path, field_blank_, field_blank_, field_blank_,
2850+
reportLine(what2, path1, field_blank_, field_blank_, field_blank_,
28502851
field_blank_, field_blank_, field_blank_, false, min_max,
28512852
nullptr, src_attr, "");
28522853
}
@@ -2859,7 +2860,7 @@ ReportPath::reportPath6(const Path *path,
28592860
|| (i == path_last_index)
28602861
|| is_clk_start) {
28612862
const std::string what = descriptionField(vertex);
2862-
reportLine(what, path, field_blank_, slew, field_blank_,
2863+
reportLine(what, path1, field_blank_, slew, field_blank_,
28632864
incr, field_blank_, time, false, min_max, rf, src_attr,
28642865
line_case);
28652866
prev_time = time;
@@ -3253,7 +3254,7 @@ ReportPath::reportLine(std::string_view what,
32533254
else if (field == field_case_)
32543255
line += line_case;
32553256
else if (field->getValue())
3256-
line += field->value(path);
3257+
line += field->value(path, this);
32573258

32583259
first_field = false;
32593260
}

search/ReportPath.hh

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,8 @@ namespace sta {
5151
class Scene;
5252
class PathExpanded;
5353

54-
using ReportFieldGetValue = std::function<std::string (const Path*)>;
54+
using ReportFieldGetValue = std::function<std::string (const Path *path,
55+
const StaState *sta)>;
5556

5657
class ReportField
5758
{
@@ -76,7 +77,8 @@ public:
7677
const std::string &blank() const { return blank_; }
7778
void setEnabled(bool enabled);
7879
bool enabled() const { return enabled_; }
79-
std::string value(const Path *path) const;
80+
std::string value(const Path *path,
81+
const StaState *sta) const;
8082
const ReportFieldGetValue &getValue() const { return get_value_; }
8183

8284
protected:

search/Search.i

Lines changed: 17 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -413,15 +413,23 @@ set_report_path_fields(StringSeq fields)
413413
}
414414

415415
void
416-
make_report_path_field(const char *name,
417-
const char *name_abrev,
418-
const char *title,
419-
int width,
420-
bool left_justify,
421-
Unit *unit)
422-
{
423-
Sta::sta()->makeReportPathField(name, name_abrev, title, width, left_justify,
424-
unit, ReportFieldGetValue());
416+
make_report_path_attr_field(std::string attr_name,
417+
int width)
418+
{
419+
Sta *sta = Sta::sta();
420+
sta->makeReportPathField(attr_name, attr_name, attr_name, width, true,
421+
nullptr,
422+
[attr_name] (const Path *path,
423+
const StaState *sta) -> std::string {
424+
if (path) {
425+
const Network *network = sta->network();
426+
const Pin *pin = path->pin(sta);
427+
const Instance *inst = network->instance(pin);
428+
return network->getAttribute(inst, attr_name);
429+
}
430+
else
431+
return "";
432+
});
425433
}
426434

427435
const char *

search/Search.tcl

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -158,8 +158,6 @@ proc find_timing_paths_cmd { cmd args_var } {
158158
sta_error 511 "$cmd command failed."
159159
}
160160

161-
check_for_key_args $cmd args
162-
163161
if { [info exists flags(-unconstrained)] } {
164162
set unconstrained 1
165163
} elseif { [info exists sta_report_unconstrained_paths] } {
@@ -230,7 +228,6 @@ proc find_timing_paths_cmd { cmd args_var } {
230228
sta_error 515 "positional arguments not supported."
231229
}
232230
}
233-
234231
set path_ends [find_path_ends $from $thrus $to $unconstrained \
235232
$scenes $min_max \
236233
$group_path_count $endpoint_path_count \
@@ -692,7 +689,7 @@ proc parse_report_path_options { cmd args_var default_format
692689
unset path_options
693690
}
694691
parse_key_args $cmd args path_options {-format -digits -fields} \
695-
path_options {-no_line_splits} $unknown_key_is_error
692+
path_options {-no_line_splits} 1
696693

697694
set format $default_format
698695
if [info exists path_options(-format)] {

0 commit comments

Comments
 (0)