mirror of https://github.com/zachjs/sv2v.git
fix unbased unsized binding conversion for instances with type parameters
This commit is contained in:
parent
50d6faa9b0
commit
698e3b0b54
|
|
@ -47,13 +47,19 @@ collectPartsM _ = return ()
|
|||
|
||||
convertModuleItem :: Parts -> ModuleItem -> ModuleItem
|
||||
convertModuleItem parts (Instance moduleName params instanceName [] bindings) =
|
||||
convertModuleItem' $ Instance moduleName params instanceName [] bindings'
|
||||
if Map.member moduleName parts && not (any isTypeParam moduleItems)
|
||||
then convertModuleItem' $
|
||||
Instance moduleName params instanceName [] bindings'
|
||||
else Instance moduleName params instanceName [] bindings
|
||||
where
|
||||
bindings' = zipWith convertBinding bindings [0..]
|
||||
(portNames, moduleItems) =
|
||||
case Map.lookup moduleName parts of
|
||||
Nothing -> error $ "could not find module: " ++ moduleName
|
||||
Just partInfo -> partInfo
|
||||
isTypeParam :: ModuleItem -> Bool
|
||||
isTypeParam (MIPackageItem (Decl ParamType{})) = True
|
||||
isTypeParam _ = False
|
||||
tag = Ident "~~uub~~"
|
||||
convertBinding :: PortBinding -> Int -> PortBinding
|
||||
convertBinding (portName, expr) idx =
|
||||
|
|
|
|||
|
|
@ -130,9 +130,10 @@ endmodule
|
|||
|
||||
module M(a, b, c, d);
|
||||
parameter W = 1;
|
||||
input logic [W+0:1] a;
|
||||
input logic [W+1:1] b;
|
||||
input logic [W+2:1] c;
|
||||
input logic [W+3:1] d;
|
||||
parameter type T = logic;
|
||||
input T [W+0:1] a;
|
||||
input T [W+1:1] b;
|
||||
input T [W+2:1] c;
|
||||
input T [W+3:1] d;
|
||||
initial $display("M W=%0d %b %b %b %b", W, a, b, c, d);
|
||||
endmodule
|
||||
|
|
|
|||
Loading…
Reference in New Issue