Skip to content

Commit 3af7c69

Browse files
committed
added tests for new verilog features
1 parent 744e518 commit 3af7c69

File tree

2 files changed

+37
-6
lines changed

2 files changed

+37
-6
lines changed

tests/simple/arraycells.v

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
2+
module test001(a, b, c, y);
3+
input a;
4+
input [31:0] b, c;
5+
input [31:0] y;
6+
7+
aoi12 p [31:0] (a, b, c, y);
8+
endmodule
9+
10+
module aoi12(a, b, c, y);
11+
input a, b, c;
12+
output y;
13+
assign y = ~((a & b) | c);
14+
endmodule
15+

tests/simple/repwhile.v

Lines changed: 22 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
module test001(output [63:0] y);
1+
module test001(input [5:0] a, output [7:0] y, output [31:0] x);
2+
23
function [7:0] mylog2;
34
input [31:0] value;
45
begin
@@ -10,11 +11,26 @@ module test001(output [63:0] y);
1011
end
1112
endfunction
1213

13-
genvar i;
14-
generate
14+
function [31:0] myexp2;
15+
input [7:0] value;
16+
begin
17+
myexp2 = 1;
18+
repeat (value)
19+
myexp2 = myexp2 << 1;
20+
end
21+
endfunction
22+
23+
reg [7:0] y_table [63:0];
24+
reg [31:0] x_table [63:0];
25+
26+
integer i;
27+
initial begin
1528
for (i = 0; i < 64; i = i+1) begin
16-
localparam tmp = mylog2(i);
17-
assign y[i] = tmp;
29+
y_table[i] <= mylog2(i);
30+
x_table[i] <= myexp2(i);
1831
end
19-
endgenerate
32+
end
33+
34+
assign y = y_table[a];
35+
assign x = x_table[a];
2036
endmodule

0 commit comments

Comments
 (0)