diff options
author | Clifford Wolf <clifford@clifford.at> | 2014-11-07 14:40:06 +0100 |
---|---|---|
committer | Clifford Wolf <clifford@clifford.at> | 2014-11-07 14:40:06 +0100 |
commit | 461594bb83a3fd908bb6580763cf7f7aa37ef6a7 (patch) | |
tree | e5eee5158571aca0eac4d4f955ded034accb2c5f | |
parent | 4f4d729e02babd32ebf56de3e87408e05c5728bc (diff) | |
download | yosys-461594bb83a3fd908bb6580763cf7f7aa37ef6a7.tar.gz yosys-461594bb83a3fd908bb6580763cf7f7aa37ef6a7.tar.bz2 yosys-461594bb83a3fd908bb6580763cf7f7aa37ef6a7.zip |
Fixed generation of temp names in verilog backend
-rw-r--r-- | backends/verilog/verilog_backend.cc | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/backends/verilog/verilog_backend.cc b/backends/verilog/verilog_backend.cc index 814c87be7..7d08cc4e0 100644 --- a/backends/verilog/verilog_backend.cc +++ b/backends/verilog/verilog_backend.cc @@ -51,16 +51,17 @@ void reset_auto_counter_id(RTLIL::IdString id, bool may_rename) if (*str == '$' && may_rename && !norename) auto_name_map[id] = auto_name_counter++; - if (str[0] != '_' && str[1] != 0) + if (str[0] != '\\' || str[1] != '_' || str[2] == 0) return; - for (int i = 0; str[i] != 0; i++) { - if (str[i] == '_') + + for (int i = 2; str[i] != 0; i++) { + if (str[i] == '_' && str[i+1] == 0) continue; if (str[i] < '0' || str[i] > '9') return; } - int num = atoi(str+1); + int num = atoi(str+2); if (num >= auto_name_offset) auto_name_offset = num + 1; } |