sv2v/src/Convert/Unique.hs

44 lines
1.2 KiB
Haskell
Raw Normal View History

{- sv2v
- Author: Zachary Snow <zach@zachjs.com>
-
2019-12-02 05:25:33 +01:00
- Conversion for `unique`, `unique0`, and `priority` (verification checks)
-
2019-12-02 05:25:33 +01:00
- This conversion simply drops these keywords, as they are only used for
- optimization and verification. There may be ways to communicate these
- attributes to certain downstream toolchains.
-}
module Convert.Unique (convert) where
import Convert.Traverse
import Language.SystemVerilog.AST
convert :: [AST] -> [AST]
convert =
map $ traverseDescriptions $ traverseModuleItems $ traverseStmts $
traverseNestedStmts convertStmt
convertStmt :: Stmt -> Stmt
2019-12-02 05:25:33 +01:00
convertStmt (If _ cc s1 s2) =
If NoCheck cc s1 s2
convertStmt (Case Priority kw expr cases) =
StmtAttr caseAttr caseStmt
where
caseAttr = Attr [("synthesis", Nil), ("full_case", Nil)]
caseStmt = Case NoCheck kw expr cases
convertStmt (Case Unique kw expr cases) =
StmtAttr caseAttr caseStmt
where
caseAttr = Attr [("synthesis", Nil), ("parallel_case", Nil)]
caseStmt = Case NoCheck kw expr cases
convertStmt (Case Unique0 kw expr cases) =
convertStmt (Case Unique kw expr cases)
2019-12-02 05:25:33 +01:00
convertStmt (Case _ kw expr cases) =
Case NoCheck kw expr cases
convertStmt other = other