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
15 -- | The VHDL Bit type
16 bit_ty :: AST.TypeMark
17 bit_ty = AST.unsafeVHDLBasicId "Bit"
19 -- Translate a Haskell type to a VHDL type
20 vhdl_ty :: Type.Type -> AST.TypeMark
21 vhdl_ty ty = Maybe.fromMaybe
22 (error $ "Unsupported Haskell type: " ++ (showSDoc $ ppr ty))
25 -- Translate a Haskell type to a VHDL type
26 vhdl_ty_maybe :: Type.Type -> Maybe AST.TypeMark
28 case Type.splitTyConApp_maybe ty of
30 let name = TyCon.tyConName tycon in
31 -- TODO: Do something more robust than string matching
32 case Name.getOccString name of
38 mkVHDLId :: String -> AST.VHDLId
39 mkVHDLId = AST.unsafeVHDLBasicId