Skip to content

Commit 6226cd7

Browse files
committed
abrev setup
Signed-off-by: James Cherry <cherry@parallaxsw.com>
1 parent 4cc6e95 commit 6226cd7

6 files changed

Lines changed: 85 additions & 56 deletions

File tree

include/sta/Sta.hh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -985,6 +985,7 @@ public:
985985
void setReportPathFieldOrder(const StringSeq &field_names);
986986
void setReportPathFields(const StringSeq &fields);
987987
ReportField *findReportPathField(std::string_view name);
988+
ReportField *findReportPathFieldAbrev(std::string_view name);
988989
void makeReportPathField(std::string_view name,
989990
std::string_view title,
990991
size_t width,

search/ReportPath.cc

Lines changed: 23 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ ReportField::ReportField(std::string_view name,
8585
size_t width,
8686
bool left_justify,
8787
Unit *unit,
88-
const ReportFieldGetValue &get_value) :
88+
ReportFieldGetValue get_value) :
8989
name_(name),
9090
title_(title),
9191
left_justify_(left_justify),
@@ -137,6 +137,11 @@ ReportPath::ReportPath(StaState *sta) :
137137
setDigits(2);
138138
}
139139

140+
ReportPath::~ReportPath()
141+
{
142+
deleteContents(fields_);
143+
}
144+
140145
void
141146
ReportPath::makeFields()
142147
{
@@ -171,20 +176,25 @@ ReportPath::makeField(std::string_view name,
171176
size_t width,
172177
bool left_justify,
173178
Unit *unit,
174-
const ReportFieldGetValue &get_value)
179+
ReportFieldGetValue get_value)
175180
{
176-
std::string sname(name);
177-
field_map_.try_emplace(sname, sname, title, width, left_justify,
178-
unit, get_value);
179-
ReportField *field = findKeyValuePtr(field_map_, sname);
181+
ReportField *field = new ReportField(name, title, width, left_justify, unit, get_value);
180182
fields_.push_back(field);
183+
std::string sname(name);
184+
field_map_[sname] = field;
181185
return field;
182186
}
183187

184188
ReportField *
185189
ReportPath::findField(std::string_view name)
186190
{
187-
return findKeyValuePtr(field_map_, std::string(name));
191+
return findKey(field_map_, std::string(name));
192+
}
193+
194+
ReportField *
195+
ReportPath::findFieldAbrev(std::string_view name)
196+
{
197+
return findKeyValue(field_map_, std::string(name));
188198
}
189199

190200
void
@@ -214,13 +224,12 @@ ReportPath::setReportFieldOrder(const StringSeq &field_names)
214224
void
215225
ReportPath::setReportFields(const StringSeq &fields)
216226
{
217-
for (auto &[field_name, field] : field_map_) {
218-
bool enabled = (field_name == "incr"
219-
|| field_name == "total"
220-
|| field_name == "description"
221-
|| field_name == "edge");
222-
field.setEnabled(enabled);
223-
}
227+
for (ReportField *field : fields_)
228+
field->setEnabled(false);
229+
field_incr_->setEnabled(true);
230+
field_total_->setEnabled(true);
231+
field_description_->setEnabled(true);
232+
field_edge_->setEnabled(true);
224233
// These are not real fields; they are flags.
225234
report_input_pin_ = false;
226235
report_hier_pins_ = false;

search/ReportPath.hh

Lines changed: 42 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -50,16 +50,53 @@ namespace sta {
5050

5151
class Scene;
5252
class PathExpanded;
53-
class ReportField;
5453

55-
using ReportFieldSeq = std::vector<ReportField*>;
56-
using ReportFieldMap = std::map<std::string, ReportField, std::less<>>;
5754
using ReportFieldGetValue = std::function<std::string (const Path*)>;
5855

56+
class ReportField
57+
{
58+
public:
59+
ReportField(std::string_view name,
60+
std::string_view title,
61+
size_t width,
62+
bool left_justify,
63+
Unit *unit,
64+
ReportFieldGetValue get_value);
65+
~ReportField();
66+
void setProperties(std::string_view title,
67+
size_t width,
68+
bool left_justify);
69+
const std::string &name() const { return name_; }
70+
const std::string &title() const { return title_; }
71+
size_t width() const { return width_; }
72+
void setWidth(size_t width);
73+
bool leftJustify() const { return left_justify_; }
74+
Unit *unit() const { return unit_; }
75+
const std::string &blank() const { return blank_; }
76+
void setEnabled(bool enabled);
77+
bool enabled() const { return enabled_; }
78+
std::string value(const Path *path) const;
79+
const ReportFieldGetValue &getValue() const { return get_value_; }
80+
81+
protected:
82+
std::string name_;
83+
std::string title_;
84+
size_t width_;
85+
bool left_justify_;
86+
Unit *unit_;
87+
bool enabled_{false};
88+
ReportFieldGetValue get_value_;
89+
std::string blank_;
90+
};
91+
92+
using ReportFieldSeq = std::vector<ReportField*>;
93+
using ReportFieldMap = std::map<std::string, ReportField*, std::less<>>;
94+
5995
class ReportPath : public StaState
6096
{
6197
public:
6298
ReportPath(StaState *sta);
99+
~ReportPath() override;
63100
ReportPathFormat pathFormat() const { return format_; }
64101
void setPathFormat(ReportPathFormat format);
65102
void setReportFieldOrder(const StringSeq &field_names);
@@ -68,6 +105,7 @@ public:
68105
void setDigits(int digits);
69106
void setNoSplit(bool no_split);
70107
ReportField *findField(std::string_view name);
108+
ReportField *findFieldAbrev(std::string_view name);
71109

72110
// Header above reportPathEnd results.
73111
void reportPathEndHeader() const;
@@ -167,7 +205,7 @@ public:
167205
bool left_justify,
168206
// nullptr for string fields.
169207
Unit *unit,
170-
const ReportFieldGetValue &get_value);
208+
ReportFieldGetValue get_value);
171209
ReportField *fieldSlew() const { return field_slew_; }
172210
ReportField *fieldFanout() const { return field_fanout_; }
173211
ReportField *fieldCapacitance() const { return field_capacitance_; }
@@ -514,40 +552,4 @@ protected:
514552
static const float field_skip_;
515553
};
516554

517-
class ReportField
518-
{
519-
public:
520-
ReportField(std::string_view name,
521-
std::string_view title,
522-
size_t width,
523-
bool left_justify,
524-
Unit *unit,
525-
const ReportFieldGetValue &get_value);
526-
~ReportField();
527-
void setProperties(std::string_view title,
528-
size_t width,
529-
bool left_justify);
530-
const std::string &name() const { return name_; }
531-
const std::string &title() const { return title_; }
532-
size_t width() const { return width_; }
533-
void setWidth(size_t width);
534-
bool leftJustify() const { return left_justify_; }
535-
Unit *unit() const { return unit_; }
536-
const std::string &blank() const { return blank_; }
537-
void setEnabled(bool enabled);
538-
bool enabled() const { return enabled_; }
539-
std::string value(const Path *path) const;
540-
const ReportFieldGetValue &getValue() const { return get_value_; }
541-
542-
protected:
543-
std::string name_;
544-
std::string title_;
545-
size_t width_;
546-
bool left_justify_;
547-
Unit *unit_;
548-
bool enabled_{false};
549-
const ReportFieldGetValue &get_value_;
550-
std::string blank_;
551-
};
552-
553555
} // namespace sta

search/Search.i

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -412,6 +412,17 @@ set_report_path_fields(StringSeq fields)
412412
Sta::sta()->setReportPathFields(fields);
413413
}
414414

415+
const char *
416+
find_report_path_field_abrev(const char *name)
417+
{
418+
Sta *sta = Sta::sta();
419+
ReportField *field = sta->findReportPathFieldAbrev(name);
420+
if (field)
421+
return field->name().c_str();
422+
else
423+
return "";
424+
}
425+
415426
void
416427
set_report_path_field_properties(const char *field_name,
417428
const char *title,

search/Search.tcl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -723,10 +723,10 @@ proc parse_report_path_options { cmd args_var default_format
723723
lappend fields "input_pin"
724724
} elseif { [string match "hier*" $field] } {
725725
lappend fields "hierarchical_pin"
726-
} elseif { [string match "cap*" $field] } {
727-
lappend fields "capacitance"
728726
} elseif { [string match "net" $field] } {
729727
lappend fields "net"
728+
} elseif { [string match "cap*" $field] } {
729+
lappend fields "capacitance"
730730
} elseif { [string match "slew" $field] } {
731731
lappend fields "slew"
732732
} elseif { [string match "fanout" $field] } {

search/Sta.cc

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2827,6 +2827,12 @@ Sta::findReportPathField(std::string_view name)
28272827
return report_path_->findField(name);
28282828
}
28292829

2830+
ReportField *
2831+
Sta::findReportPathFieldAbrev(std::string_view name)
2832+
{
2833+
return report_path_->findFieldAbrev(name);
2834+
}
2835+
28302836
void
28312837
Sta::makeReportPathField(std::string_view name,
28322838
std::string_view title,

0 commit comments

Comments
 (0)