Skip to content

Commit 0ff7c2d

Browse files
feat: implement clear3Dbx, server exit handling, and web UI tweaks
Signed-off-by: Jorge Ferreira <jorge.ferreira@precisioninno.com>
1 parent d14d526 commit 0ff7c2d

15 files changed

Lines changed: 154 additions & 21 deletions

include/ord/OpenRoad.hh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -227,6 +227,7 @@ class OpenRoad
227227

228228
void read3Dbv(const std::string& filename);
229229
void read3Dbx(const std::string& filename);
230+
void clear3Dbx();
230231
void write3Dbv(const std::string& filename);
231232
void write3Dbx(const std::string& filename);
232233
void read3DBloxBMap(const std::string& filename);

src/OpenRoad.cc

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -499,8 +499,20 @@ void OpenRoad::read3Dbv(const std::string& filename)
499499
parser.readDbv(filename);
500500
}
501501

502+
void OpenRoad::clear3Dbx()
503+
{
504+
std::vector<odb::dbChip*> chips;
505+
for (odb::dbChip* chip : db_->getChips()) {
506+
chips.push_back(chip);
507+
}
508+
for (odb::dbChip* chip : chips) {
509+
odb::dbChip::destroy(chip);
510+
}
511+
}
512+
502513
void OpenRoad::read3Dbx(const std::string& filename)
503514
{
515+
clear3Dbx();
504516
odb::ThreeDBlox parser(logger_, db_, sta_);
505517
parser.readDbx(filename);
506518
check3DBlox();

src/OpenRoad.i

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -380,6 +380,13 @@ read_3dbx_cmd(const char *filename)
380380
ord->read3Dbx(filename);
381381
}
382382

383+
void
384+
clear_3dbx_cmd()
385+
{
386+
OpenRoad *ord = getOpenRoad();
387+
ord->clear3Dbx();
388+
}
389+
383390
void
384391
read_3dblox_bmap_cmd(const char *filename)
385392
{

src/OpenRoad.tcl

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -213,6 +213,14 @@ proc read_3dbx { args } {
213213
ord::read_3dbx_cmd $filename
214214
}
215215

216+
sta::define_cmd_args "clear_3dbx" {}
217+
218+
proc clear_3dbx { args } {
219+
sta::parse_key_args "clear_3dbx" args keys {} flags {}
220+
sta::check_argc_eq0 "clear_3dbx" $args
221+
ord::clear_3dbx_cmd
222+
}
223+
216224
sta::define_cmd_args "read_3dblox_bmap" {filename}
217225

218226
proc read_3dblox_bmap { args } {

src/odb/src/db/dbChip.cpp

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -744,6 +744,13 @@ void dbChip::destroy(dbChip* chip_)
744744
auto chipConn = *chip_conns_itr++;
745745
dbChipConn::destroy(chipConn);
746746
}
747+
// destroy chip nets
748+
auto chip_nets = chip_->getChipNets();
749+
auto chip_nets_itr = chip_nets.begin();
750+
while (chip_nets_itr != chip_nets.end()) {
751+
auto chipNet = *chip_nets_itr++;
752+
dbChipNet::destroy(chipNet);
753+
}
747754
// destroy chip insts
748755
auto chip_insts = chip_->getChipInsts();
749756
auto chip_insts_itr = chip_insts.begin();

src/odb/test/BUILD

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -186,6 +186,7 @@ COMPULSORY_TESTS = [
186186
"read_abstract_lef",
187187
"read_3dbv",
188188
"read_3dbx",
189+
"read_3dbx_multiple",
189190
"read_db",
190191
"read_def",
191192
"read_def58",

src/odb/test/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ or_integration_tests(
4242
read_abstract_lef
4343
read_3dbv
4444
read_3dbx
45+
read_3dbx_multiple
4546
read_db
4647
read_def
4748
read_def58

src/odb/test/read_3dbx_multiple.ok

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
pass
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
source "helpers.tcl"
2+
3+
# 1. First read
4+
read_3dbx "data/example.3dbx"
5+
set db [ord::get_db]
6+
if { [$db getChip] == "NULL" } {
7+
puts "FAIL: First read 3dbx Failed"
8+
exit 1
9+
}
10+
11+
# 2. Clear using explicit command
12+
clear_3dbx
13+
if { [$db getChip] != "NULL" } {
14+
puts "FAIL: clear_3dbx failed to remove chip"
15+
exit 1
16+
}
17+
18+
# 3. Read again (should succeed since we cleared it)
19+
read_3dbx "data/example.3dbx"
20+
if { [$db getChip] == "NULL" } {
21+
puts "FAIL: Second read 3dbx Failed"
22+
exit 1
23+
}
24+
25+
# 4. Third read without explicit clear (should automatically clear and succeed)
26+
read_3dbx "data/example.3dbx"
27+
if { [$db getChip] == "NULL" } {
28+
puts "FAIL: Third read 3dbx Failed (auto-clear failed)"
29+
exit 1
30+
}
31+
32+
puts "pass"

src/sta

Submodule sta updated 399 files

0 commit comments

Comments
 (0)