Commit 5de77ab6 by Zachary Snow

fix function and task input types

parent edaff3dc
...@@ -25,9 +25,17 @@ convert :: AST -> AST ...@@ -25,9 +25,17 @@ convert :: AST -> AST
convert = traverseDescriptions convertDescription convert = traverseDescriptions convertDescription
convertDescription :: Description -> Description convertDescription :: Description -> Description
convertDescription (orig @ (Part _ Module _ _ _ _)) = convertDescription orig =
traverseModuleItems (traverseDecls convertDecl . convertModuleItem) orig if shouldConvert
then traverseModuleItems conversion orig
else orig
where where
shouldConvert = case orig of
Part _ Interface _ _ _ _ -> False
Part _ Module _ _ _ _ -> True
PackageItem _ -> True
Directive _ -> False
conversion = traverseDecls convertDecl . convertModuleItem
idents = execWriter (collectModuleItemsM regIdents orig) idents = execWriter (collectModuleItemsM regIdents orig)
convertModuleItem :: ModuleItem -> ModuleItem convertModuleItem :: ModuleItem -> ModuleItem
convertModuleItem (MIDecl (Variable dir (IntegerVector TLogic sg mr) ident a me)) = convertModuleItem (MIDecl (Variable dir (IntegerVector TLogic sg mr) ident a me)) =
...@@ -42,7 +50,6 @@ convertDescription (orig @ (Part _ Module _ _ _ _)) = ...@@ -42,7 +50,6 @@ convertDescription (orig @ (Part _ Module _ _ _ _)) =
convertDecl (Variable d (IntegerVector TLogic sg rs) x a me) = convertDecl (Variable d (IntegerVector TLogic sg rs) x a me) =
Variable d (IntegerVector TReg sg rs) x a me Variable d (IntegerVector TReg sg rs) x a me
convertDecl other = other convertDecl other = other
convertDescription other = other
regIdents :: ModuleItem -> Writer RegIdents () regIdents :: ModuleItem -> Writer RegIdents ()
regIdents (AlwaysC _ stmt) = regIdents (AlwaysC _ stmt) =
......
...@@ -779,8 +779,12 @@ makeInput (Variable _ t x a me) = Variable Input t x a me ...@@ -779,8 +779,12 @@ makeInput (Variable _ t x a me) = Variable Input t x a me
makeInput other = error $ "unexpected non-var decl: " ++ (show other) makeInput other = error $ "unexpected non-var decl: " ++ (show other)
defaultFuncInput :: Decl -> Decl defaultFuncInput :: Decl -> Decl
defaultFuncInput (Variable Input (Implicit sg rs) x a me) = defaultFuncInput (Variable dir (Implicit sg rs) x a me) =
Variable Input (IntegerVector TLogic sg rs) x a me Variable dir t x a me
where
t = if dir == Input || dir == Inout
then IntegerVector TLogic sg rs
else Implicit sg rs
defaultFuncInput other = other defaultFuncInput other = other
combineTags :: Maybe Identifier -> Maybe Identifier -> Maybe Identifier combineTags :: Maybe Identifier -> Maybe Identifier -> Maybe Identifier
......
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