mirror of https://github.com/zachjs/sv2v.git
remove legacy ordered binding handling in logic conversion
This commit is contained in:
parent
13c84e4c7a
commit
69bc64ed15
|
|
@ -130,18 +130,17 @@ traverseModuleItem ports scopes =
|
||||||
where
|
where
|
||||||
comment = MIPackageItem $ Decl $ CommentDecl
|
comment = MIPackageItem $ Decl $ CommentDecl
|
||||||
"rewrote reg-to-output bindings"
|
"rewrote reg-to-output bindings"
|
||||||
(bindings', newItemsList) =
|
(bindings', newItemsList) = unzip $ map fixBinding bindings
|
||||||
unzip $ map (uncurry fixBinding) $ zip bindings [0..]
|
|
||||||
newItems = concat newItemsList
|
newItems = concat newItemsList
|
||||||
fixBinding :: PortBinding -> Int -> (PortBinding, [ModuleItem])
|
fixBinding :: PortBinding -> (PortBinding, [ModuleItem])
|
||||||
fixBinding (portName, expr) portIdx =
|
fixBinding (portName, expr) =
|
||||||
if not outputBound || not usesReg
|
if not outputBound || not usesReg
|
||||||
then ((portName, expr), [])
|
then ((portName, expr), [])
|
||||||
else ((portName, tmpExpr), items)
|
else ((portName, tmpExpr), items)
|
||||||
where
|
where
|
||||||
outputBound = portDir == Just Output
|
outputBound = portDir == Just Output
|
||||||
usesReg = Just True == fmap isReg (exprToLHS expr)
|
usesReg = Just True == fmap isReg (exprToLHS expr)
|
||||||
portDir = lookupPortDir portName portIdx
|
portDir = maybeModulePorts >>= lookup portName
|
||||||
tmp = "sv2v_tmp_" ++ instanceName ++ "_" ++ portName
|
tmp = "sv2v_tmp_" ++ instanceName ++ "_" ++ portName
|
||||||
tmpExpr = Ident tmp
|
tmpExpr = Ident tmp
|
||||||
t = Net (NetType TWire) Unspecified
|
t = Net (NetType TWire) Unspecified
|
||||||
|
|
@ -155,17 +154,7 @@ traverseModuleItem ports scopes =
|
||||||
error $ "bad non-lhs, non-net expr "
|
error $ "bad non-lhs, non-net expr "
|
||||||
++ show expr ++ " connected to output port "
|
++ show expr ++ " connected to output port "
|
||||||
++ portName ++ " of " ++ instanceName
|
++ portName ++ " of " ++ instanceName
|
||||||
lookupPortDir :: Identifier -> Int -> Maybe Direction
|
maybeModulePorts = Map.lookup moduleName ports
|
||||||
lookupPortDir "" portIdx =
|
|
||||||
case Map.lookup moduleName ports of
|
|
||||||
Nothing -> Nothing
|
|
||||||
Just l -> if portIdx >= length l
|
|
||||||
then Nothing
|
|
||||||
else Just $ snd $ l !! portIdx
|
|
||||||
lookupPortDir portName _ =
|
|
||||||
case Map.lookup moduleName ports of
|
|
||||||
Nothing -> Nothing
|
|
||||||
Just l -> lookup portName l
|
|
||||||
fixModuleItem other = other
|
fixModuleItem other = other
|
||||||
|
|
||||||
traverseDeclM :: Decl -> ST Decl
|
traverseDeclM :: Decl -> ST Decl
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue