kernel: Use constids.inc for global/constant IdStrings

This commit is contained in:
Eddie Hung 2020-03-12 12:54:30 -07:00
parent 37f42fe102
commit 164dd0f6b2
4 changed files with 37 additions and 17 deletions

27
kernel/constids.inc Normal file
View File

@ -0,0 +1,27 @@
X(A)
X(B)
X(S)
X(Y)
X(keep)
X(src)
X(whitebox)
X(blackbox)
X(allconst)
X(allseq)
X(anyconst)
X(anyseq)
X(defaultvalue)
X(fsm_encoding)
X(full_case)
X(gclk)
X(initial_top)
X(is_interface)
X(mem2reg)
X(noblackbox)
X(nolatches)
X(nomem2reg)
X(nosync)
X(parallel_case)
X(top)
X(wand)
X(wor)

View File

@ -41,12 +41,10 @@ int RTLIL::IdString::last_created_idx_[8];
int RTLIL::IdString::last_created_idx_ptr_; int RTLIL::IdString::last_created_idx_ptr_;
#endif #endif
IdString RTLIL::ID::A; #define X(_id) IdString RTLIL::ID::_id;
IdString RTLIL::ID::B; #include "constids.inc"
IdString RTLIL::ID::Y; #undef X
IdString RTLIL::ID::keep;
IdString RTLIL::ID::whitebox;
IdString RTLIL::ID::blackbox;
dict<std::string, std::string> RTLIL::constpad; dict<std::string, std::string> RTLIL::constpad;
RTLIL::Const::Const() RTLIL::Const::Const()

View File

@ -370,11 +370,9 @@ namespace RTLIL
}; };
namespace ID { namespace ID {
// defined in rtlil.cc, initialized in yosys.cc #define X(_id) extern IdString _id;
extern IdString A, B, Y; #include "constids.inc"
extern IdString keep; #undef X
extern IdString whitebox;
extern IdString blackbox;
}; };
extern dict<std::string, std::string> constpad; extern dict<std::string, std::string> constpad;

View File

@ -515,12 +515,9 @@ void yosys_setup()
return; return;
already_setup = true; already_setup = true;
RTLIL::ID::A = "\\A"; #define X(_id) RTLIL::ID::_id = "\\" # _id;
RTLIL::ID::B = "\\B"; #include "constids.inc"
RTLIL::ID::Y = "\\Y"; #undef X
RTLIL::ID::keep = "\\keep";
RTLIL::ID::whitebox = "\\whitebox";
RTLIL::ID::blackbox = "\\blackbox";
#ifdef WITH_PYTHON #ifdef WITH_PYTHON
PyImport_AppendInittab((char*)"libyosys", INIT_MODULE); PyImport_AppendInittab((char*)"libyosys", INIT_MODULE);