mirror of https://github.com/zachjs/sv2v.git
fix inline explicit struct casts
This commit is contained in:
parent
0454663901
commit
fe90c7bbf4
|
|
@ -15,6 +15,7 @@
|
|||
* Fixed an issue that prevented parsing tasks and functions with `inout` ports
|
||||
* Fixed conflicting genvar names when inlining interfaces and modules that use
|
||||
them; all genvars are now given a design-wide unique name
|
||||
* Fixed unconverted structs within explicit type casts
|
||||
* Fixed non-typenames (e.g., from packages or subsequent declarations)
|
||||
improperly shadowing the names of `struct` pattern fields
|
||||
* Fixed failure to resolve typenames suffixed with dimensions in contexts
|
||||
|
|
|
|||
|
|
@ -495,8 +495,11 @@ convertSubExpr scopes (Call e args) =
|
|||
(retType, _) = fallbackType scopes e
|
||||
args' = convertCall scopes e args
|
||||
convertSubExpr scopes (Cast (Left t) e) =
|
||||
(t, Cast (Left t) e')
|
||||
where (_, e') = convertSubExpr scopes e
|
||||
(t', Cast (Left t') e')
|
||||
where
|
||||
e' = convertExpr scopes t $ snd $ convertSubExpr scopes e
|
||||
t' = convertType t
|
||||
|
||||
convertSubExpr scopes (Pattern items) =
|
||||
if all (== Right Nil) $ map fst items'
|
||||
then (UnknownType, Concat $ map snd items')
|
||||
|
|
|
|||
|
|
@ -29,4 +29,20 @@ module top;
|
|||
$display("$bits(a.z.x) = %0d", $bits(a.z.x));
|
||||
$display("$bits(a.z.y) = %0d", $bits(a.z.y));
|
||||
end
|
||||
|
||||
typedef struct packed {
|
||||
logic x;
|
||||
} U;
|
||||
initial begin
|
||||
case (U'(0))
|
||||
U'(0): $display("1");
|
||||
endcase
|
||||
if (U'(1))
|
||||
$display("2");
|
||||
case (U'{x: 0})
|
||||
U'{x: 0}: $display("3");
|
||||
endcase
|
||||
if (U'{x: 1})
|
||||
$display("4");
|
||||
end
|
||||
endmodule
|
||||
|
|
|
|||
|
|
@ -17,4 +17,11 @@ module top;
|
|||
$display("$bits(a.z.x) = %0d", 32);
|
||||
$display("$bits(a.z.y) = %0d", 8);
|
||||
end
|
||||
|
||||
initial begin
|
||||
$display("1");
|
||||
$display("2");
|
||||
$display("3");
|
||||
$display("4");
|
||||
end
|
||||
endmodule
|
||||
|
|
|
|||
Loading…
Reference in New Issue