updated casting conventions

- explicit enum casts in source are converted to size casts
- conversion for basic pattern array literals of unsized numbers
- unsized number array literals preserve signing
- more aggressive ternary simplification
This commit is contained in:
Zachary Snow
2020-02-19 18:58:25 -05:00
parent 976f582287
commit 470fa01eb2
7 changed files with 54 additions and 29 deletions
+15 -3
View File
@@ -1,12 +1,24 @@
module top;
localparam integer B [4] = { 1, 2, 3, 4 };
localparam byte C [4] = { 1, 2, 3, 4 };
localparam bit D [4] = { 1, 2, 3, 4 };
localparam integer A [4] = { 1, 2, 3, 4 };
localparam byte B [4] = { 1, 2, 3, 4 };
localparam bit C [4] = { 1, 2, 3, 4 };
localparam integer signed D [4] = { -1, -2, -3, -4 };
localparam byte signed E [4] = { -1, -2, -3, -4 };
localparam bit signed F [4] = { -1, -2, -3, -4 };
localparam integer G [4] = '{ 1, 2, 3, 4 };
localparam byte H [4] = '{ 1, 2, 3, 4 };
localparam bit I [4] = '{ 1, 2, 3, 4 };
initial begin
`define PRINT(X) \
$display("%b %2d %2d", {X[0], X[1], X[2], X[3]}, $bits(X), $bits(X[0]));
`PRINT(A);
`PRINT(B);
`PRINT(C);
`PRINT(D);
`PRINT(E);
`PRINT(F);
`PRINT(G);
`PRINT(H);
`PRINT(I);
end
endmodule