mirror of https://github.com/zachjs/sv2v.git
fix ports bound to decls inlined from an interface expansion
This commit is contained in:
parent
a059b6e83c
commit
c8e776265c
|
|
@ -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) =
|
||||||
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 =
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue