Commit c1f027e1 by Zachary Snow

$readmemh/$readmemb imply reg (resolves #57)

parent 58ad1fea
......@@ -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) =
......
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