Commit ea81d55c by Zachary Snow

fix duplicate param type modules

parent 790312d2
...@@ -91,7 +91,7 @@ convert files = ...@@ -91,7 +91,7 @@ convert files =
else if all isNothing maybeTypeMap then else if all isNothing maybeTypeMap then
[] []
else else
filter (not . flip elem existing) $ filter (not . alreadyExists) $
(:) (removeDefaultTypeParams part) $ (:) (removeDefaultTypeParams part) $
if isNothing typeMap if isNothing typeMap
then [] then []
...@@ -99,6 +99,11 @@ convert files = ...@@ -99,6 +99,11 @@ convert files =
where where
maybeTypeMap = snd $ info Map.! name maybeTypeMap = snd $ info Map.! name
typeMap = defaultInstance maybeTypeMap typeMap = defaultInstance maybeTypeMap
existingNames = map maybeModuleName existing
alreadyExists = (flip elem existingNames) . maybeModuleName
maybeModuleName :: Description -> Maybe Identifier
maybeModuleName (Part _ _ _ _ x _ _) = Just x
maybeModuleName _ = Nothing
replaceDefault _ other = [other] replaceDefault _ other = [other]
removeDefaultTypeParams :: Description -> Description removeDefaultTypeParams :: Description -> Description
...@@ -235,7 +240,7 @@ convertModuleItemM info (orig @ (Instance m bindings x r p)) = ...@@ -235,7 +240,7 @@ convertModuleItemM info (orig @ (Instance m bindings x r p)) =
else if any (not . isSimpleType) resolvedTypes then do else if any (not . isSimpleType) resolvedTypes then do
let defaults = Map.map Left resolvedTypes let defaults = Map.map Left resolvedTypes
let bindingsDefaulted = Map.toList $ Map.union bindingsMap defaults let bindingsDefaulted = Map.toList $ Map.union bindingsMap defaults
if isDefaultName m || bindingsDefaulted /= Map.toList bindingsMap if isDefaultName m || bindingsDefaulted == Map.toList bindingsMap
then return $ Instance m bindingsNamed x r p then return $ Instance m bindingsNamed x r p
else return $ Instance (moduleDefaultName m) bindingsDefaulted x r p else return $ Instance (moduleDefaultName m) bindingsDefaulted x r p
else do else do
......
module foo_default #(
parameter size = 0
);
initial $display("foo %d %d", 1, size);
endmodule
module bar_default #(
parameter size = 0
);
initial $display("bar %d %d", 1, size);
endmodule
module foo_byte #( module foo_byte #(
parameter size = 0 parameter size = 0
); );
......
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