Add the module hardware types, that exports all builtin types.
[matthijs/master-project/cλash.git] / cλash / CLasH / HardwareTypes.hs
1 {-# LANGUAGE TemplateHaskell, DeriveDataTypeable #-}
2
3 module CLasH.HardwareTypes
4   ( module Types
5   , module Data.Param.TFVec
6   , module Data.RangedWord
7   , module Data.SizedInt
8   , module Data.SizedWord
9   , module Prelude
10   , Bit(..)
11   , hwand
12   , hwor
13   , hwxor
14   , hwnot
15   ) where
16
17 import qualified Prelude as P
18 import Prelude hiding (
19   null, length, head, tail, last, init, take, drop, (++), map, foldl, foldr,
20   zipWith, zip, unzip, concat, reverse, iterate )
21 import Types
22 import Data.Param.TFVec
23 import Data.RangedWord
24 import Data.SizedInt
25 import Data.SizedWord 
26
27 import Language.Haskell.TH.Lift
28 import Data.Typeable
29
30 -- The plain Bit type
31 data Bit = High | Low
32   deriving (P.Show, P.Eq, P.Read, Typeable)
33
34 $(deriveLift1 ''Bit)
35
36 hwand :: Bit -> Bit -> Bit
37 hwor  :: Bit -> Bit -> Bit
38 hwxor :: Bit -> Bit -> Bit
39 hwnot :: Bit -> Bit
40
41 High `hwand` High = High
42 _ `hwand` _ = Low
43
44 High `hwor` _  = High
45 _ `hwor` High  = High
46 Low `hwor` Low = Low
47
48 High `hwxor` Low = High
49 Low `hwxor` High = High
50 _ `hwxor` _      = Low
51
52 hwnot High = Low
53 hwnot Low  = High