3
0
Fork 0
mirror of https://github.com/YosysHQ/yosys synced 2025-11-22 13:41:27 +00:00

verilog_parser: add port renaming tests

This commit is contained in:
xiota 2025-10-18 01:03:41 +00:00
parent 5b989b53f5
commit 60ae44dae8
7 changed files with 105 additions and 0 deletions

View file

@ -0,0 +1,22 @@
# Equivalence
read_verilog << EOF
module gold(input a, input b, output c);
assign c = a + b;
endmodule
module gate_header (
.a(x),
.b(y),
.c(z)
);
input x;
input y;
output z;
assign z = x + y;
endmodule
EOF
equiv_make gold gate_header equiv_header
equiv_simple
equiv_status -assert

View file

@ -0,0 +1,12 @@
# Multiple names for the same inout port
logger -expect error "Missing details for module port" 1
read_verilog << EOF
module gate_multi_inout (
.i(a),
.o(a)
);
inout a;
endmodule
EOF
logger -check-expected
design -reset

View file

@ -0,0 +1,12 @@
# Multiple names for the same input port
logger -expect error "Missing details for module port" 1
read_verilog << EOF
module gate_multi_inout (
.i(a),
.j(a)
);
input a;
endmodule
EOF
logger -check-expected
design -reset

View file

@ -0,0 +1,15 @@
# Multiple names for an output port
logger -expect error "Missing details for module port" 1
read_verilog << EOF
module gate_multi_output (
a,
.c(b),
.b(b)
);
input a;
output b;
assign b = a;
endmodule
EOF
logger -check-expected
design -reset

View file

@ -0,0 +1,16 @@
# Swapping names for two ports
logger -expect error "not declared in module header" 1
read_verilog << EOF
module gate_swap (
.a(b),
.b(a),
c
);
input a;
input b;
output c;
assign c = a & !b;
endmodule
EOF
logger -check-expected
design -reset

View file

@ -0,0 +1,14 @@
# ANSI-style renaming
logger -expect error "syntax error" 1
read_verilog << EOF
module gate_ansi (
input .alias_a(a),
output .alias_b(b)
);
wire a;
wire b;
assign b = a;
endmodule
EOF
logger -check-expected
design -reset

View file

@ -0,0 +1,14 @@
# Partial aliasing
read_verilog << EOF
module gate_swap (
.a(a),
.b(b),
c
);
input a;
input b;
output c;
assign c = a & !b;
endmodule
EOF
design -reset