3
0
Fork 0
mirror of https://github.com/YosysHQ/yosys synced 2025-07-24 05:08:56 +00:00

Merge pull request #5177 from YosysHQ/emil/rename-unescape

rename: add -unescape
This commit is contained in:
Emil J 2025-07-08 10:45:11 +02:00 committed by GitHub
commit 66035f706e
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 215 additions and 46 deletions

View file

@ -0,0 +1,41 @@
read_verilog <<EOF
module top();
wire \a[0] ;
wire \0b ;
wire c;
wire d_;
wire d$;
wire \$e ;
wire \wire ;
wire add = c + d$;
endmodule
EOF
dump
# Replace brackets with _
select -assert-count 1 w:a[0]
# Prefix first character numeric with _
select -assert-count 1 w:\0b
# Do nothing to simple identifiers
select -assert-count 1 w:c
select -assert-count 1 w:d_
# Replace dollars with _
# and resolve conflict with existing d_
select -assert-count 1 w:d$
# Public but starts with dollar is legal
select -assert-count 1 w:$e
# Colliding with keyword
select -assert-count 1 w:wire
# Don't touch internal names
select -assert-count 1 w:$add$<<EOF:*$1_Y
rename -unescape
select -assert-count 1 w:a_0_
select -assert-count 1 w:_0b
select -assert-count 1 w:c
select -assert-count 1 w:d_
select -assert-count 1 w:d__1
select -assert-count 1 w:_e
select -assert-count 1 w:wire_
select -assert-count 1 w:$add$<<EOF:*$1_Y