aboutsummaryrefslogtreecommitdiffstats
path: root/kernel/yosys.h
diff options
context:
space:
mode:
authorMiodrag Milanovic <mmicko@gmail.com>2019-08-18 11:47:46 +0200
committerMiodrag Milanovic <mmicko@gmail.com>2019-08-18 11:47:46 +0200
commit4a32e29445f65edd1726808a7353a9d0e2560c00 (patch)
tree179544dd193fe72b3658269cb22a6eae66bee8a1 /kernel/yosys.h
parent5f561bdcb1d562d6f975b4a27beca1b8b7af908f (diff)
parent98a54353b7d893752d856b3726853d4921c6aa1f (diff)
downloadyosys-4a32e29445f65edd1726808a7353a9d0e2560c00.tar.gz
yosys-4a32e29445f65edd1726808a7353a9d0e2560c00.tar.bz2
yosys-4a32e29445f65edd1726808a7353a9d0e2560c00.zip
Merge remote-tracking branch 'upstream/master' into anlogic_fixes
Diffstat (limited to 'kernel/yosys.h')
-rw-r--r--kernel/yosys.h13
1 files changed, 11 insertions, 2 deletions
diff --git a/kernel/yosys.h b/kernel/yosys.h
index 09e8139bb..a80cb00b4 100644
--- a/kernel/yosys.h
+++ b/kernel/yosys.h
@@ -305,8 +305,17 @@ RTLIL::IdString new_id(std::string file, int line, std::string func);
#define NEW_ID \
YOSYS_NAMESPACE_PREFIX new_id(__FILE__, __LINE__, __FUNCTION__)
-#define ID(_str) \
- ([]() { static YOSYS_NAMESPACE_PREFIX RTLIL::IdString _id(_str); return _id; })()
+// Create a statically allocated IdString object, using for example ID(A) or ID($add).
+//
+// Recipe for Converting old code that is using conversion of strings like "\\A" and
+// "$add" for creating IdStrings: Run below SED command on the .cc file and then use for
+// example "meld foo.cc foo.cc.orig" to manually compile errors, if necessary.
+//
+// sed -i.orig -r 's/"\\\\([a-zA-Z0-9_]+)"/ID(\1)/g; s/"(\$[a-zA-Z0-9_]+)"/ID(\1)/g;' <filename>
+//
+#define ID(_id) ([]() { const char *p = "\\" #_id, *q = p[1] == '$' ? p+1 : p; \
+ static const YOSYS_NAMESPACE_PREFIX RTLIL::IdString id(q); return id; })()
+namespace ID = RTLIL::ID;
RTLIL::Design *yosys_get_design();
std::string proc_self_dirname();