refactor cast conversion

- delegate cast type and sign resolution to TypeOf conversion
- internal support for injecting data declarations into statements
- fix size and sign of unbased unsized literals used in casts
- avoid generating many unnecessary explicit casts
- support casts which depend on localparams within procedures
- expression traversal correctly visits types within type casts
- fix typeof on expressions of net types
- handle additional edge cases for unsized integer array patterns
- preserve signedness of implicitly flattened unpacked integer arrays
This commit is contained in:
Zachary Snow
2021-02-03 16:28:53 -05:00
parent c656cbb977
commit dd1a9efb40
28 changed files with 647 additions and 312 deletions
+13
View File
@@ -1,4 +1,5 @@
module top;
parameter ONE = 1;
localparam integer A [4] = { 1, 2, 3, 4 };
localparam byte B [4] = { 1, 2, 3, 4 };
localparam bit C [4] = { 1, 2, 3, 4 };
@@ -8,6 +9,12 @@ module top;
localparam integer G [4] = '{ 1, 2, 3, 4 };
localparam byte H [4] = '{ 1, 2, 3, 4 };
localparam bit I [4] = '{ 1, 2, 3, 4 };
localparam integer J [4] = { ONE * '0, ONE * '1, 5 * ONE, ONE * 6 };
localparam byte K [4] = { ONE * '0, ONE * '1, 5 * ONE, ONE * 6 };
localparam bit L [4] = { '0, ONE * '1, 5 * ONE, ONE * 6 };
localparam integer unsigned M [4] = { ONE * '0, ONE * '1, 5 * ONE, ONE * 6 };
localparam byte unsigned N [4] = { ONE * '0, ONE * '1, 5 * ONE, ONE * 6 };
localparam bit unsigned O [4] = { '0, ONE * '1, 5 * ONE, ONE * 6 };
initial begin
`define PRINT(X) \
$display("%b %2d %2d", {X[0], X[1], X[2], X[3]}, $bits(X), $bits(X[0]));
@@ -20,6 +27,12 @@ module top;
`PRINT(G);
`PRINT(H);
`PRINT(I);
`PRINT(J);
`PRINT(K);
`PRINT(L);
`PRINT(M);
`PRINT(N);
`PRINT(O);
end
localparam [1:0][0:1] P = '{'{default:'d1}, '{default:'d2}};