Skip to content

Commit

Permalink
const expr, add error message for undefined modtype. Signed-off-by: A…
Browse files Browse the repository at this point in the history
…ndy Fox <[email protected]>

Signed-off-by: andyfox-rushc <[email protected]>
  • Loading branch information
andyfox-rushc committed Jun 5, 2024
1 parent 0ad40ec commit 917f192
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 11 deletions.
2 changes: 2 additions & 0 deletions src/dbSta/include/db_sta/dbNetwork.hh
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ using odb::dbModule;
using odb::dbMTerm;
using odb::dbNet;
using odb::dbObject;
using odb::dbObjectType;
using odb::dbSet;
using odb::dbSigType;
using odb::Point;
Expand Down Expand Up @@ -103,6 +104,7 @@ class dbNetwork : public ConcreteNetwork
void addObserver(dbNetworkObserver* observer);
void removeObserver(dbNetworkObserver* observer);

ObjectId getDbNwkObjectId(dbObjectType typ, ObjectId db_id) const;
dbBlock* block() const { return block_; }
void makeLibrary(dbLib* lib);
void makeCell(Library* library, dbMaster* master);
Expand Down
28 changes: 17 additions & 11 deletions src/dbSta/src/dbNetwork.cc
Original file line number Diff line number Diff line change
Expand Up @@ -101,19 +101,19 @@ char* tmpStringCopy(const char* str)
// lower 4 bits used to encode type
//

#define DBITERM_ID 0x0
#define DBBTERM_ID 0x1
#define DBINST_ID 0x2
#define DBNET_ID 0x3
#define DBMODITERM_ID 0x4
#define DBMODBTERM_ID 0x5
#define DBMODINST_ID 0x6
#define DBMODNET_ID 0x7
#define DBMODULE_ID 0x8
static constexpr unsigned DBITERM_ID = 0x0;
static constexpr unsigned DBBTERM_ID = 0x1;
static constexpr unsigned DBINST_ID = 0x2;
static constexpr unsigned DBNET_ID = 0x3;
static constexpr unsigned DBMODITERM_ID = 0x4;
static constexpr unsigned DBMODBTERM_ID = 0x5;
static constexpr unsigned DBMODINST_ID = 0x6;
static constexpr unsigned DBMODNET_ID = 0x7;
static constexpr unsigned DBMODULE_ID = 0x8;
// Number of lower bits used
#define DBIDTAG_WIDTH 0x4
static constexpr unsigned DBIDTAG_WIDTH = 0x4;

ObjectId getDbNwkObjectId(dbObjectType typ, ObjectId db_id)
ObjectId dbNetwork::getDbNwkObjectId(dbObjectType typ, ObjectId db_id) const
{
switch (typ) {
case dbITermObj: {
Expand Down Expand Up @@ -144,6 +144,12 @@ ObjectId getDbNwkObjectId(dbObjectType typ, ObjectId db_id)
return ((db_id << DBIDTAG_WIDTH) | DBMODULE_ID);
} break;
default:
logger_->error(
ORD,
2017,
"Error: unknown database type passed into unique id generation");
// note the default "exception undefined case" in database is 0.
// so we reasonably expect upstream tools to handle this.
return 0;
break;
}
Expand Down

0 comments on commit 917f192

Please sign in to comment.