d37d7d7bf4f87c92f7b511b7d823a978a56ef13a
[ghc-hetmet.git] / ghc / tests / programs / jeff-bug / Memory.hs
1 module Memory where
2
3 import Word
4 import Ix
5 import Maybe
6 import Arithmetic
7 import Array
8 import Words
9
10 -- Begin Signature -------------------------------------------------
11
12 {- 
13    Some types to describe encodings of memory state and the 
14    communication to memory
15 -}
16
17 type ArrayDesc i v = ((i,i),[(i,i,v)])
18
19 type InstrMemoryState w i = ArrayDesc w i
20 type MemoryState w i = (InstrMemoryState w i,DataMemoryState w)
21 type DataMemoryState w = ArrayDesc w w
22
23 data WordSize = Byte | HalfWord | FullWord
24           deriving (Eq,Show, Read)
25
26 data LoadStoreOp = Load WordSize Sign
27                  | Store WordSize 
28                  | NOP  -- No operation
29            deriving (Eq,Show, Read)
30
31
32
33 -- Array request
34 data ArrReq i a  = ReadArr i |
35                    WriteArr i i a |
36                    WriteFn i (a -> a) | -- modify contents at location i
37                    FreezeArr
38                    deriving Show
39
40 -- Array response
41 data ArrResp i a = ReadVal a |
42                    Written |
43                    WrittenFn a |
44                    ArrayVal (Array i a)
45                    deriving Show
46
47 -- End Signature -------------------------------------------------------
48
49