kernel: Use constids.inc for global/constant IdStrings
authorEddie Hung <eddie@fpgeh.com>
Thu, 12 Mar 2020 19:54:30 +0000 (12:54 -0700)
committerEddie Hung <eddie@fpgeh.com>
Thu, 2 Apr 2020 14:14:08 +0000 (07:14 -0700)
kernel/constids.inc [new file with mode: 0644]
kernel/rtlil.cc
kernel/rtlil.h
kernel/yosys.cc

diff --git a/kernel/constids.inc b/kernel/constids.inc
new file mode 100644 (file)
index 0000000..18be122
--- /dev/null
@@ -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)
index d0452438770cbc29caae9ea77984be6f5ee51bdc..83e3245358b466403c4a81082d55f25825f22e80 100644 (file)
@@ -41,12 +41,10 @@ int RTLIL::IdString::last_created_idx_[8];
 int RTLIL::IdString::last_created_idx_ptr_;
 #endif
 
-IdString RTLIL::ID::A;
-IdString RTLIL::ID::B;
-IdString RTLIL::ID::Y;
-IdString RTLIL::ID::keep;
-IdString RTLIL::ID::whitebox;
-IdString RTLIL::ID::blackbox;
+#define X(_id) IdString RTLIL::ID::_id;
+#include "constids.inc"
+#undef X
+
 dict<std::string, std::string> RTLIL::constpad;
 
 RTLIL::Const::Const()
index a1754c8bd5bdd8d407cf999f602c9ba20182a929..7c1523f0bbef235bc4703731b72ff7c19f51316c 100644 (file)
@@ -370,11 +370,9 @@ namespace RTLIL
        };
 
        namespace ID {
-               // defined in rtlil.cc, initialized in yosys.cc
-               extern IdString A, B, Y;
-               extern IdString keep;
-               extern IdString whitebox;
-               extern IdString blackbox;
+#define X(_id) extern IdString _id;
+#include "constids.inc"
+#undef X
        };
 
        extern dict<std::string, std::string> constpad;
index 6d64e2e90133729159aae0200969b5a6d5263972..380f7030bd54a88e48cea5f5fe4f88803d18fb12 100644 (file)
@@ -515,12 +515,9 @@ void yosys_setup()
                return;
        already_setup = true;
 
-       RTLIL::ID::A = "\\A";
-       RTLIL::ID::B = "\\B";
-       RTLIL::ID::Y = "\\Y";
-       RTLIL::ID::keep = "\\keep";
-       RTLIL::ID::whitebox = "\\whitebox";
-       RTLIL::ID::blackbox = "\\blackbox";
+#define X(_id) RTLIL::ID::_id = "\\" # _id;
+#include "constids.inc"
+#undef X
 
        #ifdef WITH_PYTHON
                PyImport_AppendInittab((char*)"libyosys", INIT_MODULE);