support for type param without parameter keyword

This commit is contained in:
Zachary Snow
2019-10-01 22:02:30 -04:00
parent 3807ab6736
commit 2b84bdb7e2
3 changed files with 23 additions and 2 deletions
+14
View File
@@ -67,6 +67,17 @@ module o_nodef #(
end
endmodule
module p #(
type T = logic, U = logic
);
T x = 0;
U y = 1;
initial begin
$display("p %b %b %d", x, x+1, $bits(T));
$display("p %b %b %d", y, y+1, $bits(U));
end
endmodule
module top; endmodule
// Top level modules appear to be generally instantiated in lexicographic order,
@@ -98,3 +109,6 @@ module f_1; o_nodef #(1, logic [1:0], logic [2:0], 0) x(); endmodule
module f_2; o_nodef #(.T(logic [1:0]), .U(logic), .b(1), .a(0)) x(); endmodule
module f_3; o_nodef #(0, logic [1:0], logic [2:0], 1) x(); endmodule
module f_4; o_nodef #(.T(logic [1:0]), .U(logic), .b(0), .a(1)) x(); endmodule
module p_1; p #(logic [1:0], logic [2:0]) x(); endmodule
module p_2; p x(); endmodule
+4
View File
@@ -36,5 +36,9 @@ module top;
$display("n_nodef b= 1 001 00000000000000000000000000000010 3");
$display("n_nodef a= 1 01 00000000000000000000000000000010 2");
$display("n_nodef b= 0 0 00000000000000000000000000000001 1");
$display("p 00 00000000000000000000000000000001 2");
$display("p 001 00000000000000000000000000000010 3");
$display("p 0 00000000000000000000000000000001 1");
$display("p 1 00000000000000000000000000000010 1");
end
endmodule