File tree Expand file tree Collapse file tree 1 file changed +11
-0
lines changed Expand file tree Collapse file tree 1 file changed +11
-0
lines changed Original file line number Diff line number Diff line change 2323#include " kernel/yosys_common.h"
2424#include " kernel/yosys.h"
2525
26+ #include < charconv>
2627#include < string_view>
2728#include < unordered_map>
2829
@@ -208,6 +209,16 @@ struct RTLIL::IdString
208209 if ((unsigned )ch <= (unsigned )' ' )
209210 log_error (" Found control character or space (0x%02x) in string '%s' which is not allowed in RTLIL identifiers\n " , ch, std::string (p).c_str ());
210211
212+ if (p.substr (0 , 6 ) == " $auto$" ) {
213+ // Ensure new_id(_suffix) will not create collisions.
214+ size_t autoidx_pos = p.find_last_of (' $' );
215+ int p_autoidx;
216+ std::string_view v = p.substr (autoidx_pos + 1 );
217+ if (std::from_chars (v.begin (), v.end (), p_autoidx).ec == std::errc ()) {
218+ autoidx = std::max (autoidx, p_autoidx + 1 );
219+ }
220+ }
221+
211222 #ifndef YOSYS_NO_IDS_REFCNT
212223 if (global_free_idx_list_.empty ()) {
213224 log_assert (global_id_storage_.size () < 0x40000000 );
You can’t perform that action at this time.
0 commit comments