2 -- Functions to generate VHDL from FlatFunctions
10 import qualified Maybe
11 import Outputable ( showSDoc, ppr )
12 import qualified ForSyDe.Backend.VHDL.AST as AST
14 -- | The VHDL Bit type
15 bit_ty :: AST.TypeMark
16 bit_ty = AST.unsafeVHDLBasicId "Bit"
18 -- Translate a Haskell type to a VHDL type
19 vhdl_ty :: Type.Type -> AST.TypeMark
20 vhdl_ty ty = Maybe.fromMaybe
21 (error $ "Unsupported Haskell type: " ++ (showSDoc $ ppr ty))
24 -- Translate a Haskell type to a VHDL type
25 vhdl_ty_maybe :: Type.Type -> Maybe AST.TypeMark
27 case Type.splitTyConApp_maybe ty of
29 let name = TyCon.tyConName tycon in
30 -- TODO: Do something more robust than string matching
31 case Name.getOccString name of
37 mkVHDLId :: String -> AST.VHDLId
38 mkVHDLId = AST.unsafeVHDLBasicId