diff options
author | Claire Xen <claire@clairexen.net> | 2022-02-11 17:30:32 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-02-11 17:30:32 +0100 |
commit | ca876e7c12856ed52e2a30e3ebbc7836ae18dfb9 (patch) | |
tree | 6243476d4a24e74779d726adb4b3a0dc8cfabc16 /kernel/yosys.cc | |
parent | fc7d78f0714f4314424e599e609a962b263e5b95 (diff) | |
parent | 49545c73f7f5a5cf73d287fd371f2ff39311f621 (diff) | |
download | yosys-ca876e7c12856ed52e2a30e3ebbc7836ae18dfb9.tar.gz yosys-ca876e7c12856ed52e2a30e3ebbc7836ae18dfb9.tar.bz2 yosys-ca876e7c12856ed52e2a30e3ebbc7836ae18dfb9.zip |
Merge pull request #2376 from nmoroze/clk2ff-better-names
clk2fflogic: nice names for autogenerated signals
Diffstat (limited to 'kernel/yosys.cc')
-rw-r--r-- | kernel/yosys.cc | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/kernel/yosys.cc b/kernel/yosys.cc index 102f9e737..09909696b 100644 --- a/kernel/yosys.cc +++ b/kernel/yosys.cc @@ -618,6 +618,23 @@ RTLIL::IdString new_id(std::string file, int line, std::string func) return stringf("$auto$%s:%d:%s$%d", file.c_str(), line, func.c_str(), autoidx++); } +RTLIL::IdString new_id_suffix(std::string file, int line, std::string func, std::string suffix) +{ +#ifdef _WIN32 + size_t pos = file.find_last_of("/\\"); +#else + size_t pos = file.find_last_of('/'); +#endif + if (pos != std::string::npos) + file = file.substr(pos+1); + + pos = func.find_last_of(':'); + if (pos != std::string::npos) + func = func.substr(pos+1); + + return stringf("$auto$%s:%d:%s$%s$%d", file.c_str(), line, func.c_str(), suffix.c_str(), autoidx++); +} + RTLIL::Design *yosys_get_design() { return yosys_design; |