mirror of https://github.com/zachjs/sv2v.git
$readmemh/$readmemb imply reg (resolves #57)
This commit is contained in:
parent
58ad1feab1
commit
c1f027e11a
|
|
@ -135,13 +135,20 @@ convertDescription ports orig =
|
|||
convertDecl other = other
|
||||
|
||||
regIdents :: ModuleItem -> Writer Idents ()
|
||||
regIdents (AlwaysC _ stmt) =
|
||||
regIdents (AlwaysC _ stmt) = do
|
||||
collectNestedStmtsM collectReadMemsM stmt
|
||||
collectNestedStmtsM (collectStmtLHSsM (collectNestedLHSsM lhsIdents)) $
|
||||
traverseNestedStmts removeTimings stmt
|
||||
traverseNestedStmts removeTimings stmt
|
||||
where
|
||||
removeTimings :: Stmt -> Stmt
|
||||
removeTimings (Timing _ s) = s
|
||||
removeTimings other = other
|
||||
collectReadMemsM :: Stmt -> Writer Idents ()
|
||||
collectReadMemsM (Subroutine (Ident f) (Args (_ : Just (Ident x) : _) [])) =
|
||||
if f == "$readmemh" || f == "$readmemb"
|
||||
then tell $ Set.singleton x
|
||||
else return ()
|
||||
collectReadMemsM _ = return ()
|
||||
regIdents (Initial stmt) =
|
||||
regIdents $ AlwaysC Always stmt
|
||||
regIdents (Final stmt) =
|
||||
|
|
|
|||
Loading…
Reference in New Issue