diff --git a/src/Convert.hs b/src/Convert.hs index 86bc89d..9dbc35a 100644 --- a/src/Convert.hs +++ b/src/Convert.hs @@ -28,7 +28,6 @@ type Phase = AST -> AST phases :: [Job.Exclude] -> [Phase] phases excludes = - extras ++ [ Convert.AsgnOp.convert , Convert.FuncRet.convert , Convert.Enum.convert @@ -40,7 +39,7 @@ phases excludes = , Convert.Typedef.convert , Convert.UnbasedUnsized.convert , Convert.Unique.convert - ] + ] ++ extras where availableExcludes = [ (Job.Interface, Convert.Interface.convert) diff --git a/src/Convert/Interface.hs b/src/Convert/Interface.hs index 21c5f65..4936f67 100644 --- a/src/Convert/Interface.hs +++ b/src/Convert/Interface.hs @@ -112,13 +112,13 @@ convertDescription interfaces (Part extern Module lifetime name ports items) = convertExpr :: Expr -> Expr convertExpr (orig @ (Dot (Ident x) y)) = - if Map.member x modports + if Map.member x modports || Map.member x instances then Ident (x ++ "_" ++ y) else orig convertExpr other = other convertLHS :: LHS -> LHS convertLHS (orig @ (LHSDot (LHSIdent x) y)) = - if Map.member x modports + if Map.member x modports || Map.member x instances then LHSIdent (x ++ "_" ++ y) else orig convertLHS other = other diff --git a/src/Convert/Logic.hs b/src/Convert/Logic.hs index c0812b1..b378845 100644 --- a/src/Convert/Logic.hs +++ b/src/Convert/Logic.hs @@ -47,6 +47,10 @@ convertDescription orig = convertModuleItem other = other -- all other logics (i.e. inside of functions) become regs convertDecl :: Decl -> Decl + convertDecl (Parameter (IntegerVector TLogic sg rs) x e) = + Parameter (Implicit sg rs) x e + convertDecl (Localparam (IntegerVector TLogic sg rs) x e) = + Localparam (Implicit sg rs) x e convertDecl (Variable d (IntegerVector TLogic sg rs) x a me) = Variable d (IntegerVector TReg sg rs) x a me convertDecl other = other diff --git a/src/Convert/Struct.hs b/src/Convert/Struct.hs index 10f37f9..783de3a 100644 --- a/src/Convert/Struct.hs +++ b/src/Convert/Struct.hs @@ -175,7 +175,14 @@ convertAsgn structs types (lhs, expr) = -- try expression conversion by looking at the *outermost* type first convertExpr :: Type -> Expr -> Expr - convertExpr (Struct _ fields []) (Pattern [(Just "default", e)]) = + -- TODO: This is really a conversion for using default patterns to + -- populate arrays. Maybe this should be somewhere else? + convertExpr (IntegerVector t sg (r:rs)) (Pattern [(Just "default", e)]) = + Repeat (rangeSize r) [e'] + where e' = convertExpr (IntegerVector t sg rs) e + convertExpr (Struct (Packed sg) fields (_:rs)) (Bit e _) = + convertExpr (Struct (Packed sg) fields rs) e + convertExpr (Struct (Packed _) fields _) (Pattern [(Just "default", e)]) = Concat $ take (length fields) (repeat e) convertExpr (Struct (Packed sg) fields []) (Pattern items) = if Map.notMember structTf structs