sv2v/Convert.hs

34 lines
649 B
Haskell
Raw Normal View History

{- sv2v
- Author: Zachary Snow <zach@zachjs.com>
-
- SystemVerilog to Verilog conversion
-}
module Convert (convert) where
import Language.SystemVerilog.AST
import qualified Convert.AlwaysKW
import qualified Convert.Logic
2019-02-18 09:59:17 +01:00
import qualified Convert.Typedef
2019-02-18 09:59:17 +01:00
type Phase = AST -> AST
phases :: [Phase]
phases =
[ Convert.AlwaysKW.convert
, Convert.Logic.convert
2019-02-18 09:59:17 +01:00
, Convert.Typedef.convert
]
run :: Phase
run = foldr (.) id phases
convert :: Phase
2019-02-18 09:59:17 +01:00
convert descriptions =
let descriptions' = run descriptions
in
2019-02-18 09:59:17 +01:00
if descriptions == descriptions'
then descriptions
else convert descriptions'