mirror of https://github.com/zachjs/sv2v.git
fix interface conversion erroneously renaming colliding pattern names
This commit is contained in:
parent
a15b0c735f
commit
afc3ea435b
|
|
@ -468,7 +468,16 @@ inlineInstance global ranges modportBindings items partName
|
||||||
case lookup (Bit expr Tag) exprReplacements of
|
case lookup (Bit expr Tag) exprReplacements of
|
||||||
Just resolved -> replaceArrTag (replaceExpr' local elt) resolved
|
Just resolved -> replaceArrTag (replaceExpr' local elt) resolved
|
||||||
Nothing -> Bit (replaceExpr' local expr) (replaceExpr' local elt)
|
Nothing -> Bit (replaceExpr' local expr) (replaceExpr' local elt)
|
||||||
replaceExpr' local expr =
|
replaceExpr' local (expr @ (Dot Ident{} _)) =
|
||||||
|
case lookup expr exprReplacements of
|
||||||
|
Just expr' -> expr'
|
||||||
|
Nothing -> checkExprResolution local expr $
|
||||||
|
traverseSinglyNestedExprs (replaceExprAny local) expr
|
||||||
|
replaceExpr' local (Ident x) =
|
||||||
|
checkExprResolution local (Ident x) (Ident x)
|
||||||
|
replaceExpr' local expr = replaceExprAny local expr
|
||||||
|
replaceExprAny :: Scopes Expr -> Expr -> Expr
|
||||||
|
replaceExprAny local expr =
|
||||||
case lookup expr exprReplacements of
|
case lookup expr exprReplacements of
|
||||||
Just expr' -> expr'
|
Just expr' -> expr'
|
||||||
Nothing -> checkExprResolution local expr $
|
Nothing -> checkExprResolution local expr $
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,18 @@
|
||||||
|
interface Interface;
|
||||||
|
logic x;
|
||||||
|
endinterface
|
||||||
|
|
||||||
|
module Module (
|
||||||
|
Interface p
|
||||||
|
);
|
||||||
|
typedef struct packed {
|
||||||
|
integer p;
|
||||||
|
} S;
|
||||||
|
S s = '{ p: 1 };
|
||||||
|
initial $display("%0d %0d", s, s.p);
|
||||||
|
endmodule
|
||||||
|
|
||||||
|
module top;
|
||||||
|
Interface intf();
|
||||||
|
Module mod(intf);
|
||||||
|
endmodule
|
||||||
|
|
@ -0,0 +1,3 @@
|
||||||
|
module top;
|
||||||
|
initial $display("%0d %0d", 1, 1);
|
||||||
|
endmodule
|
||||||
Loading…
Reference in New Issue