1 {-# LANGUAGE TemplateHaskell, DeriveDataTypeable #-}
3 module CLasH.HardwareTypes
5 , module Data.Param.Vector
6 , module Data.Param.Index
7 , module Data.Param.Signed
8 , module Data.Param.Unsigned
21 import qualified Prelude as P
22 import Prelude (Bool(..),Num(..),Eq(..),Ord(..),snd,fst,otherwise,(&&),(||),not)
24 import Data.Param.Vector
25 import Data.Param.Index
26 import Data.Param.Signed
27 import Data.Param.Unsigned
29 import Language.Haskell.TH.Lift
32 newtype State s = State s deriving (P.Show)
36 deriving (P.Show, Eq, P.Read, Typeable)
40 hwand :: Bit -> Bit -> Bit
41 hwor :: Bit -> Bit -> Bit
42 hwxor :: Bit -> Bit -> Bit
45 High `hwand` High = High
52 High `hwxor` Low = High
53 Low `hwxor` High = High
59 type RAM s a = Vector s a
60 type MemState s a = State (RAM s a)
70 blockRAM (State mem) data_in rdaddr wraddr wrenable =
71 ((State mem'), data_out)
74 -- Only write data_in to memory if write is enabled
75 mem' = if wrenable then
76 replace mem wraddr data_in