6 -- Begin Signature: Cell ----------------------------------------------
9 Cells are intended to be used to represent the source and destination
10 operands in machine instructions. Consider, for example:
14 Here the first cell (r1=?) is a register reference, and its value is
15 not known yet. The source cell r20=15 is a register reference with
16 its value calculated. 8 is the other source operand --- in this
17 case a constant. The Cell class hopes to capture this notion, while
18 allowing you freedom to define richer Cell-like structures.
20 The Cell's interface supports register references, constants,
21 PCs, speculative PCs and predicates.
23 See the DLX_Cell module for a concrete instance
25 Currently several of the Cell methods overlap with each other ----
26 Eventually we will slim the methods to the minimum set.
32 -- return a PC register reference with no value
33 pcNothing :: (Register r,Word w) => c r w
35 -- return the value within the cell (undefined if no value exists)
36 getVal :: (Register r,Word w) => c r w -> w
38 -- update the value within the cell
39 putVal :: (Register r,Word w) => c r w -> Maybe w -> c r w
41 -- place the cell in an invalid state
42 invalidate :: (Register r,Word w) => c r w -> c r w
44 -- is the cell a register reference?
45 isReg :: (Register r,Word w) => c r w -> Bool
47 -- is the cell a PC register reference?
48 isPC :: (Register r,Word w) => c r w -> Bool
50 -- is the cell a speculative PC register reference?
51 isSpecPC :: (Register r,Word w) => c r w -> Bool
53 -- is the cell indicates a location in memory?
54 isLoc :: (Register r,Word w) => c r w -> Bool
56 -- is the cell a constant value?
57 isVal :: (Register r,Word w) => c r w -> Bool
59 -- is the cell in an invalide state?
60 isInv :: (Register r,Word w) => c r w -> Bool
62 -- is the value of the cell is known?
63 -- isVal (r2=6) = True
64 -- isVal (r2=?) = False
65 isAss :: (Register r,Word w) => c r w -> Bool
67 -- is the cell a predicate register reference?
68 isPred :: (Register r,Word w) => c r w -> Bool
70 -- has the value been calculated? (ie. isAss || isInv)
71 isComputed :: (Register r,Word w) => c r w -> Bool
73 -- are the two cells both refering to the same register?
74 sameLoc :: (Register r,Word w) => c r w -> c r w -> Bool
76 -- true if sameLoc is true and neither cell is invalid
77 cellHazard :: (Register r,Word w) => c r w -> c r w -> Bool
79 -- get the register reference
80 getReg :: (Register r,Word w) => c r w -> r
82 -- construct a cell with a memory reference
83 loc :: Word w => w -> c r w
87 -- End Signature: Cell ----------------------------------------------