Commit 698e3b0b by Zachary Snow

fix unbased unsized binding conversion for instances with type parameters

parent 50d6faa9
...@@ -47,13 +47,19 @@ collectPartsM _ = return () ...@@ -47,13 +47,19 @@ collectPartsM _ = return ()
convertModuleItem :: Parts -> ModuleItem -> ModuleItem convertModuleItem :: Parts -> ModuleItem -> ModuleItem
convertModuleItem parts (Instance moduleName params instanceName [] bindings) = 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 where
bindings' = zipWith convertBinding bindings [0..] bindings' = zipWith convertBinding bindings [0..]
(portNames, moduleItems) = (portNames, moduleItems) =
case Map.lookup moduleName parts of case Map.lookup moduleName parts of
Nothing -> error $ "could not find module: " ++ moduleName Nothing -> error $ "could not find module: " ++ moduleName
Just partInfo -> partInfo Just partInfo -> partInfo
isTypeParam :: ModuleItem -> Bool
isTypeParam (MIPackageItem (Decl ParamType{})) = True
isTypeParam _ = False
tag = Ident "~~uub~~" tag = Ident "~~uub~~"
convertBinding :: PortBinding -> Int -> PortBinding convertBinding :: PortBinding -> Int -> PortBinding
convertBinding (portName, expr) idx = convertBinding (portName, expr) idx =
......
...@@ -130,9 +130,10 @@ endmodule ...@@ -130,9 +130,10 @@ endmodule
module M(a, b, c, d); module M(a, b, c, d);
parameter W = 1; parameter W = 1;
input logic [W+0:1] a; parameter type T = logic;
input logic [W+1:1] b; input T [W+0:1] a;
input logic [W+2:1] c; input T [W+1:1] b;
input logic [W+3:1] d; 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); initial $display("M W=%0d %b %b %b %b", W, a, b, c, d);
endmodule endmodule
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment