mirror of
https://github.com/YosysHQ/yosys
synced 2025-07-30 16:03:17 +00:00
clk2fflogic: nice names for autogenerated signals
This commit is contained in:
parent
375af199ef
commit
90b40aa51f
3 changed files with 39 additions and 9 deletions
|
@ -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;
|
||||
|
|
|
@ -321,9 +321,12 @@ Tcl_Interp *yosys_get_tcl_interp();
|
|||
extern RTLIL::Design *yosys_design;
|
||||
|
||||
RTLIL::IdString new_id(std::string file, int line, std::string func);
|
||||
RTLIL::IdString new_id_suffix(std::string file, int line, std::string func, std::string suffix);
|
||||
|
||||
#define NEW_ID \
|
||||
YOSYS_NAMESPACE_PREFIX new_id(__FILE__, __LINE__, __FUNCTION__)
|
||||
#define NEW_ID_SUFFIX(suffix) \
|
||||
YOSYS_NAMESPACE_PREFIX new_id_suffix(__FILE__, __LINE__, __FUNCTION__, suffix)
|
||||
|
||||
// Create a statically allocated IdString object, using for example ID::A or ID($add).
|
||||
//
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue