diff options
author | Clifford Wolf <clifford@clifford.at> | 2019-08-15 22:44:38 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-08-15 22:44:38 +0200 |
commit | 49301b733eede41f2a4165440eee68c1a71f36e6 (patch) | |
tree | 4fe0f872f39957888d09d363041fb9b1e18c1e83 /kernel/yosys.h | |
parent | 0c5db07cd6cc3c19b926da21a46599f97592b20f (diff) | |
parent | d8a2aaa46379df7a07f4b776b7f9981b04999215 (diff) | |
download | yosys-49301b733eede41f2a4165440eee68c1a71f36e6.tar.gz yosys-49301b733eede41f2a4165440eee68c1a71f36e6.tar.bz2 yosys-49301b733eede41f2a4165440eee68c1a71f36e6.zip |
Merge branch 'master' into clifford/fix1255
Diffstat (limited to 'kernel/yosys.h')
-rw-r--r-- | kernel/yosys.h | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/kernel/yosys.h b/kernel/yosys.h index 09e8139bb..49716ed52 100644 --- a/kernel/yosys.h +++ b/kernel/yosys.h @@ -305,8 +305,16 @@ 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; })() RTLIL::Design *yosys_get_design(); std::string proc_self_dirname(); |