aboutsummaryrefslogtreecommitdiffstats
path: root/kernel/yosys.cc
diff options
context:
space:
mode:
authorNoah Moroze <noahmoroze@gmail.com>2021-03-02 18:28:56 -0500
committerNoah Moroze <noahmoroze@gmail.com>2021-03-02 18:28:56 -0500
commit90b40aa51f7d666792d4f0b1830ee75b81678a1f (patch)
tree13c0b084d9d6e02128ebc7cbf3af348d0e600a4a /kernel/yosys.cc
parent375af199ef4df45ccf02c66e0171b4282c6cf1eb (diff)
downloadyosys-90b40aa51f7d666792d4f0b1830ee75b81678a1f.tar.gz
yosys-90b40aa51f7d666792d4f0b1830ee75b81678a1f.tar.bz2
yosys-90b40aa51f7d666792d4f0b1830ee75b81678a1f.zip
clk2fflogic: nice names for autogenerated signals
Diffstat (limited to 'kernel/yosys.cc')
-rw-r--r--kernel/yosys.cc17
1 files changed, 17 insertions, 0 deletions
diff --git a/kernel/yosys.cc b/kernel/yosys.cc
index dcaf364e9..1caf80c11 100644
--- a/kernel/yosys.cc
+++ b/kernel/yosys.cc
@@ -616,6 +616,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;