Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions src/odb/src/3dblox/3dblox.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,10 @@ ThreeDBlox::ThreeDBlox(utl::Logger* logger, odb::dbDatabase* db, sta::Sta* sta)

void ThreeDBlox::readDbv(const std::string& dbv_file)
{
if (!std::filesystem::exists(dbv_file)) {
logger_->error(
utl::ODB, 541, "3DBV file does not exist: {}", dbv_file);
}
read_files_.insert(std::filesystem::absolute(dbv_file).string());
DbvParser parser(logger_);
DbvData data = parser.parseFile(dbv_file);
Comment thread
oksaumya marked this conversation as resolved.
Outdated
Expand Down Expand Up @@ -174,6 +178,10 @@ void ThreeDBlox::buildChipNetsFromVerilog(dbChip* chip, const DbxData& data)

void ThreeDBlox::readDbx(const std::string& dbx_file)
{
if (!std::filesystem::exists(dbx_file)) {
logger_->error(
utl::ODB, 542, "3DBX file does not exist: {}", dbx_file);
Comment thread
oksaumya marked this conversation as resolved.
Outdated
}
read_files_.insert(std::filesystem::absolute(dbx_file).string());
DbxParser parser(logger_);
DbxData data = parser.parseFile(dbx_file);
Comment thread
oksaumya marked this conversation as resolved.
Outdated
Expand Down
4 changes: 3 additions & 1 deletion src/odb/src/db/dbBlock.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2998,7 +2998,9 @@ dbBlock* dbBlock::create(dbChip* chip_, const char* name_, char hier_delimiter_)
_dbBlock* top = chip->block_tbl_->create();
top->initialize(chip, nullptr, name_, hier_delimiter_);
chip->top_ = top->getOID();
top->dbu_per_micron_ = chip_->getTech()->getDbUnitsPerMicron();
if (chip_->getTech() != nullptr) {
top->dbu_per_micron_ = chip_->getTech()->getDbUnitsPerMicron();
Comment thread
oksaumya marked this conversation as resolved.
Outdated
Comment thread
oksaumya marked this conversation as resolved.
Outdated
}
return (dbBlock*) top;
}

Expand Down
2 changes: 2 additions & 0 deletions src/odb/test/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -186,6 +186,7 @@ COMPULSORY_TESTS = [
"read_abstract_lef",
"read_3dbv",
"read_3dbx",
"read_3dbx-fail",
"read_db",
"read_def",
"read_def58",
Expand Down Expand Up @@ -283,6 +284,7 @@ filegroup(
"data/design58.def",
"data/example.3dbv",
"data/example.3dbx",
"data/fail.3dbx",
"data/example.bmap",
"data/example1.bmap",
"data/example2.bmap",
Expand Down
1 change: 1 addition & 0 deletions src/odb/test/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ or_integration_tests(
read_abstract_lef
read_3dbv
read_3dbx
read_3dbx-fail
read_db
read_def
read_def58
Expand Down
9 changes: 9 additions & 0 deletions src/odb/test/data/fail.3dbx
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
Header:
version: "1.0"
unit: "micron"
precision: 2000
include:
- nonexistent_include.3dbv

Design:
name: "TestDesign"
3 changes: 3 additions & 0 deletions src/odb/test/read_3dbx-fail.ok
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
Caught expected error: main file not found
Caught expected error: include file not found
pass
22 changes: 22 additions & 0 deletions src/odb/test/read_3dbx-fail.tcl
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
source "helpers.tcl"

# Test that read_3dbx gives a proper error for a non-existent file
# rather than segfaulting (regression test for issue #10082)

# Test 1: Main file does not exist
if { [catch {read_3dbx "nonexistent_file.3dbx"} err_msg] } {
puts "Caught expected error: main file not found"
} else {
puts "FAIL: Expected an error for non-existent main file"
exit 1
}

# Test 2: Main file exists but references a non-existent include
if { [catch {read_3dbx "data/fail.3dbx"} err_msg] } {
puts "Caught expected error: include file not found"
} else {
puts "FAIL: Expected an error for non-existent include file"
exit 1
}
Comment thread
oksaumya marked this conversation as resolved.
Outdated

puts "pass"
Loading