Commit c8e77626 by Zachary Snow

fix ports bound to decls inlined from an interface expansion

parent a059b6e8
...@@ -53,7 +53,7 @@ convertDescription interfaces (Part extern Module lifetime name ports items) = ...@@ -53,7 +53,7 @@ convertDescription interfaces (Part extern Module lifetime name ports items) =
case t of case t of
InterfaceT interfaceName (Just modportName) [] -> InterfaceT interfaceName (Just modportName) [] ->
tell (Map.empty, Map.singleton ident modportDecls) tell (Map.empty, Map.singleton ident modportDecls)
where modportDecls = lookupModport Nothing interfaceName modportName where Just modportDecls = lookupModport Nothing interfaceName modportName
_ -> return () _ -> return ()
collectInterface (Instance part _ ident Nothing _) = collectInterface (Instance part _ ident Nothing _) =
if Map.member part interfaces if Map.member part interfaces
...@@ -88,14 +88,16 @@ convertDescription interfaces (Part extern Module lifetime name ports items) = ...@@ -88,14 +88,16 @@ convertDescription interfaces (Part extern Module lifetime name ports items) =
case Map.lookup instanceName instances of case Map.lookup instanceName instances of
Nothing -> [origBinding] Nothing -> [origBinding]
Just interfaceName -> Just interfaceName ->
map mapper modportDecls case modportDecls of
Nothing -> [(portName, Just $ Ident $ instanceName ++ "_" ++ modportName)]
Just decls -> map mapper decls
where where
modportDecls = lookupModport (Just instanceName) interfaceName modportName modportDecls = lookupModport (Just instanceName) interfaceName modportName
mapper (_, x, me) = (portName ++ "_" ++ x, me) mapper (_, x, me) = (portName ++ "_" ++ x, me)
expandPortBinding other = [other] expandPortBinding other = [other]
lookupModport :: Maybe Identifier -> Identifier -> Identifier -> [ModportDecl] lookupModport :: Maybe Identifier -> Identifier -> Identifier -> Maybe [ModportDecl]
lookupModport instanceName interfaceName = (Map.!) modportMap lookupModport instanceName interfaceName = (Map.!?) modportMap
where where
prefix = maybe "" (++ "_") instanceName prefix = maybe "" (++ "_") instanceName
interfaceItems = interfaceItems =
......
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