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
+12
View File
@@ -8,6 +8,12 @@ module top;
localparam [0:127] G = { 32'h1, 32'h2, 32'h3, 32'h4 };
localparam [0:31] H = { 8'h1, 8'h2, 8'h3, 8'h4 };
localparam [0:3] I = { 1'h1, 1'h0, 1'h1, 1'h0 };
localparam [0:127] J = { 32'h0, 32'hFFFFFFFF, 32'h5, 32'h6 };
localparam [0:31] K = { 8'h0, 8'hFF, 8'h5, 8'h6 };
localparam [0:3] L = { 1'h0, 1'h1, 1'h1, 1'h0 };
localparam [0:127] M = { 32'h0, 32'hFFFFFFFF, 32'h5, 32'h6 };
localparam [0:31] N = { 8'h0, 8'hFF, 8'h5, 8'h6 };
localparam [0:3] O = { 1'h0, 1'h1, 1'h1, 1'h0 };
initial begin
$display("%b %2d %2d", A, $bits(A), 32);
$display("%b %2d %2d", B, $bits(B), 8);
@@ -18,6 +24,12 @@ module top;
$display("%b %2d %2d", G, $bits(G), 32);
$display("%b %2d %2d", H, $bits(H), 8);
$display("%b %2d %2d", I, $bits(I), 1);
$display("%b %2d %2d", J, $bits(J), 32);
$display("%b %2d %2d", K, $bits(K), 8);
$display("%b %2d %2d", L, $bits(L), 1);
$display("%b %2d %2d", M, $bits(M), 32);
$display("%b %2d %2d", N, $bits(N), 8);
$display("%b %2d %2d", O, $bits(O), 1);
end
localparam [3:0] P = 4'b1100;