Commit 698e3b0b by Zachary Snow

fix unbased unsized binding conversion for instances with type parameters

parent 50d6faa9
......@@ -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
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