mirror of https://github.com/zachjs/sv2v.git
fix early conversion cast struct types
This commit is contained in:
parent
12618d541e
commit
30677b3dcb
|
|
@ -15,6 +15,7 @@
|
||||||
* Fixed `--write path/to/dir/` with directives like `` `default_nettype ``
|
* Fixed `--write path/to/dir/` with directives like `` `default_nettype ``
|
||||||
* Fixed `logic` incorrectly converted to `wire` even when provided to a task or
|
* Fixed `logic` incorrectly converted to `wire` even when provided to a task or
|
||||||
function output port
|
function output port
|
||||||
|
* Fixed conversion of fields accessed from explicitly-cast structs
|
||||||
* Fixed conversion of enum item names and typenames nested deeply within the
|
* Fixed conversion of enum item names and typenames nested deeply within the
|
||||||
left-hand side of an assignment
|
left-hand side of an assignment
|
||||||
* Fixed `input signed` ports of interface-using modules producing invalid
|
* Fixed `input signed` ports of interface-using modules producing invalid
|
||||||
|
|
|
||||||
|
|
@ -298,10 +298,6 @@ convertExpr scopes struct@(Struct _ fields []) (Pattern itemsOrig) =
|
||||||
Just value = numberToInteger n
|
Just value = numberToInteger n
|
||||||
Right (Number n) = item
|
Right (Number n) = item
|
||||||
|
|
||||||
convertExpr scopes _ (Cast (Left t) expr) =
|
|
||||||
Cast (Left t') $ convertExpr scopes t expr
|
|
||||||
where t' = convertType t
|
|
||||||
|
|
||||||
convertExpr scopes (Implicit _ []) expr =
|
convertExpr scopes (Implicit _ []) expr =
|
||||||
traverseSinglyNestedExprs (convertExpr scopes UnknownType) expr
|
traverseSinglyNestedExprs (convertExpr scopes UnknownType) expr
|
||||||
convertExpr scopes (Implicit sg rs) expr =
|
convertExpr scopes (Implicit sg rs) expr =
|
||||||
|
|
@ -495,7 +491,7 @@ convertSubExpr scopes (Call e args) =
|
||||||
(retType, _) = fallbackType scopes e
|
(retType, _) = fallbackType scopes e
|
||||||
args' = convertCall scopes e args
|
args' = convertCall scopes e args
|
||||||
convertSubExpr scopes (Cast (Left t) e) =
|
convertSubExpr scopes (Cast (Left t) e) =
|
||||||
(t', Cast (Left t') e')
|
(t, Cast (Left t') e')
|
||||||
where
|
where
|
||||||
e' = convertExpr scopes t $ snd $ convertSubExpr scopes e
|
e' = convertExpr scopes t $ snd $ convertSubExpr scopes e
|
||||||
t' = convertType t
|
t' = convertType t
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,8 @@
|
||||||
|
module top;
|
||||||
|
localparam type U = struct packed { integer s; };
|
||||||
|
localparam type T = struct packed { U x, y, z; };
|
||||||
|
localparam T L = '{x: '{s: 1}, y: '{s: 2}, z: '{s: 3}};
|
||||||
|
logic [L.x.s-1:0] a;
|
||||||
|
logic [T'(L).y.s-1:0] b;
|
||||||
|
logic [U'(T'(L).z).s-1:0] c;
|
||||||
|
endmodule
|
||||||
|
|
@ -0,0 +1,5 @@
|
||||||
|
module top;
|
||||||
|
wire a;
|
||||||
|
wire [1:0] b;
|
||||||
|
wire [2:0] c;
|
||||||
|
endmodule
|
||||||
Loading…
Reference in New Issue