Skip to content

Commit c59a2b0

Browse files
xiotawidlarizer
authored andcommitted
verilog_parser: add port renaming tests
1 parent e6599bb commit c59a2b0

File tree

7 files changed

+105
-0
lines changed

7 files changed

+105
-0
lines changed
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
# Equivalence
2+
read_verilog << EOF
3+
module gold(input a, input b, output c);
4+
assign c = a + b;
5+
endmodule
6+
7+
module gate_header (
8+
.a(x),
9+
.b(y),
10+
.c(z)
11+
);
12+
input x;
13+
input y;
14+
output z;
15+
16+
assign z = x + y;
17+
endmodule
18+
EOF
19+
20+
equiv_make gold gate_header equiv_header
21+
equiv_simple
22+
equiv_status -assert
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
# Multiple names for the same inout port
2+
logger -expect error "Missing details for module port" 1
3+
read_verilog << EOF
4+
module gate_multi_inout (
5+
.i(a),
6+
.o(a)
7+
);
8+
inout a;
9+
endmodule
10+
EOF
11+
logger -check-expected
12+
design -reset
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
# Multiple names for the same input port
2+
logger -expect error "Missing details for module port" 1
3+
read_verilog << EOF
4+
module gate_multi_inout (
5+
.i(a),
6+
.j(a)
7+
);
8+
input a;
9+
endmodule
10+
EOF
11+
logger -check-expected
12+
design -reset
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
# Multiple names for an output port
2+
logger -expect error "Missing details for module port" 1
3+
read_verilog << EOF
4+
module gate_multi_output (
5+
a,
6+
.c(b),
7+
.b(b)
8+
);
9+
input a;
10+
output b;
11+
assign b = a;
12+
endmodule
13+
EOF
14+
logger -check-expected
15+
design -reset
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
# Swapping names for two ports
2+
logger -expect error "not declared in module header" 1
3+
read_verilog << EOF
4+
module gate_swap (
5+
.a(b),
6+
.b(a),
7+
c
8+
);
9+
input a;
10+
input b;
11+
output c;
12+
assign c = a & !b;
13+
endmodule
14+
EOF
15+
logger -check-expected
16+
design -reset
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
# ANSI-style renaming
2+
logger -expect error "syntax error" 1
3+
read_verilog << EOF
4+
module gate_ansi (
5+
input .alias_a(a),
6+
output .alias_b(b)
7+
);
8+
wire a;
9+
wire b;
10+
assign b = a;
11+
endmodule
12+
EOF
13+
logger -check-expected
14+
design -reset
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
# Partial aliasing
2+
read_verilog << EOF
3+
module gate_swap (
4+
.a(a),
5+
.b(b),
6+
c
7+
);
8+
input a;
9+
input b;
10+
output c;
11+
assign c = a & !b;
12+
endmodule
13+
EOF
14+
design -reset

0 commit comments

Comments
 (0)