Skip to content

Commit ff3266a

Browse files
authored
Merge pull request #291 from The-OpenROAD-Project/ord_flow_clear
Ord flow clear
2 parents 8cb1ce1 + 367ea9a commit ff3266a

File tree

10 files changed

+58
-40
lines changed

10 files changed

+58
-40
lines changed

src/OpenRoad.cc

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -219,7 +219,9 @@ OpenRoad::readLef(const char *filename,
219219
}
220220

221221
void
222-
OpenRoad::readDef(const char *filename, bool order_wires, bool continue_on_errors)
222+
OpenRoad::readDef(const char *filename,
223+
bool order_wires,
224+
bool continue_on_errors)
223225
{
224226
odb::defin def_reader(db_);
225227
std::vector<odb::dbLib *> search_libs;
@@ -229,18 +231,17 @@ OpenRoad::readDef(const char *filename, bool order_wires, bool continue_on_error
229231
def_reader.continueOnErrors();
230232
}
231233
dbChip* chip = def_reader.createChip(search_libs, filename);
232-
if (chip == nullptr) { // parser failed
233-
return;
234-
}
235-
dbBlock* block = chip->getBlock();
236-
if (order_wires) {
237-
odb::orderWires(block,
238-
nullptr /* net_name_or_id*/,
239-
false /* force */);
240-
}
234+
if (chip) {
235+
dbBlock* block = chip->getBlock();
236+
if (order_wires) {
237+
odb::orderWires(block,
238+
nullptr /* net_name_or_id*/,
239+
false /* force */);
240+
}
241241

242-
for (Observer* observer : observers_) {
243-
observer->postReadDef(block);
242+
for (Observer* observer : observers_) {
243+
observer->postReadDef(block);
244+
}
244245
}
245246
}
246247

src/OpenRoad.tcl

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -154,6 +154,12 @@ proc ensure_units_initialized { } {
154154
}
155155
}
156156

157+
proc clear {} {
158+
[get_db] clear
159+
sta::clear_network
160+
sta::clear_sta
161+
}
162+
157163
# namespace ord
158164
}
159165

src/TritonCTS/src/tritoncts.tcl

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -159,4 +159,6 @@ proc clock_tree_synthesis { args } {
159159
}
160160

161161
$cts run_triton_cts
162+
# CTS changed the network behind the STA's back.
163+
sta::network_changed
162164
}

src/dbSta/include/db_sta/dbNetwork.hh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,8 +48,8 @@ public:
4848
virtual void clear();
4949

5050
void readLefAfter(dbLib *lib);
51-
void readDefAfter();
52-
void readDbAfter();
51+
void readDefAfter(dbBlock* block);
52+
void readDbAfter(dbDatabase* db);
5353
void readLibertyAfter(LibertyLibrary *lib);
5454

5555
virtual bool linkNetwork(const char *top_cell_name,

src/dbSta/include/db_sta/dbSta.hh

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,8 @@ using odb::dbDatabase;
2828
using odb::dbLib;
2929
using odb::dbNet;
3030
using odb::dbBlock;
31+
using odb::dbTech;
32+
using odb::dbLib;
3133

3234
class dbSta : public Sta, public ord::OpenRoad::Observer
3335
{

src/dbSta/src/dbNetwork.cc

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -373,6 +373,7 @@ dbNetwork::setBlock(dbBlock *block)
373373
void
374374
dbNetwork::clear()
375375
{
376+
ConcreteNetwork::clear();
376377
db_ = nullptr;
377378
}
378379

@@ -763,20 +764,19 @@ dbNetwork::readLefAfter(dbLib *lib)
763764
}
764765

765766
void
766-
dbNetwork::readDefAfter()
767+
dbNetwork::readDefAfter(dbBlock* block)
767768
{
768-
dbChip *chip = db_->getChip();
769-
if (chip) {
770-
block_ = chip->getBlock();
771-
makeTopCell();
772-
}
769+
db_ = block->getDataBase();
770+
block_ = block;
771+
makeTopCell();
773772
}
774773

775774
// Make ConcreteLibrary/Cell/Port objects for the
776775
// db library/master/MTerm objects.
777776
void
778-
dbNetwork::readDbAfter()
777+
dbNetwork::readDbAfter(odb::dbDatabase *db)
779778
{
779+
db_ = db;
780780
dbChip *chip = db_->getChip();
781781
if (chip) {
782782
block_ = chip->getBlock();

src/dbSta/src/dbSta.cc

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -116,21 +116,22 @@ dbSta::makeSdcNetwork()
116116
sdc_network_ = new dbSdcNetwork(network_);
117117
}
118118

119-
void dbSta::postReadLef(odb::dbTech* tech, odb::dbLib* library)
119+
void dbSta::postReadLef(dbTech* tech,
120+
dbLib* library)
120121
{
121122
if (library) {
122123
db_network_->readLefAfter(library);
123124
}
124125
}
125126

126-
void dbSta::postReadDef(odb::dbBlock* block)
127+
void dbSta::postReadDef(dbBlock* block)
127128
{
128-
db_network_->readDefAfter();
129+
db_network_->readDefAfter(block);
129130
}
130131

131-
void dbSta::postReadDb(odb::dbDatabase* db)
132+
void dbSta::postReadDb(dbDatabase* db)
132133
{
133-
db_network_->readDbAfter();
134+
db_network_->readDbAfter(db);
134135
}
135136

136137
// Wrapper to sync db/liberty libraries.

test/flow.tcl

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,6 @@
11
source "flow_helpers.tcl"
22

3-
read_lef $tech_lef
4-
read_lef $std_cell_lef
5-
foreach file $extra_lef { read_lef $file }
6-
read_liberty $liberty_file
7-
foreach file $extra_liberty { read_liberty $file }
3+
read_libraries
84
read_verilog $synth_verilog
95
link_design $top_module
106
read_sdc $sdc_file
@@ -47,8 +43,6 @@ clock_tree_synthesis -lut_file $cts_lut_file \
4743
-sol_list $cts_sol_file \
4844
-root_buf $cts_buffer \
4945
-wire_unit 20
50-
# CTS changed the network behind the STA's back.
51-
sta::network_changed
5246

5347
set_placement_padding -global -left $detail_place_pad -right $detail_place_pad
5448
detailed_placement
@@ -78,8 +72,13 @@ catch "exec TritonRoute $tr_params" tr_log
7872
puts $tr_log
7973
regexp -all {number of violations = ([0-9]+)} $tr_log ignore drv_count
8074

81-
# Need a way to clear db to read def
82-
#read_def $routed_def
75+
################################################################
76+
77+
# Reinitialize libraries db with routed def.
78+
ord::clear
79+
read_libraries
80+
read_def $routed_def
81+
read_sdc $sdc_file
8382

8483
# final report
8584
# inlieu of rc extraction
@@ -98,5 +97,5 @@ if { ![info exists drv_count] } {
9897
} elseif { $drv_count > $max_drv_count } {
9998
puts "fail: max drv count exceeded $drv_count > $max_drv_count."
10099
} else {
101-
puts "pass"
100+
puts "pass: drv count $drv_count <= $drv_count."
102101
}

test/flow_helpers.tcl

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,13 @@
1+
proc read_libraries {} {
2+
global tech_lef std_cell_lef extra_lef liberty_file extra_liberty
3+
4+
read_lef $tech_lef
5+
read_lef $std_cell_lef
6+
foreach file $extra_lef { read_lef $file }
7+
read_liberty $liberty_file
8+
foreach file $extra_liberty { read_liberty $file }
9+
}
10+
111
proc have_macros {} {
212
set db [::ord::get_db]
313
set block [[$db getChip] getBlock]
@@ -42,6 +52,3 @@ proc make_tr_params { tr_lef cts_def route_guide routed_def } {
4252
close $stream
4353
return $tr_params
4454
}
45-
46-
47-

0 commit comments

Comments
 (0)