Home My Page Projects Code Snippets Project Openings SML/NJ
Summary Activity Forums Tracker Lists Tasks Docs Surveys News SCM Files

SCM Repository

[smlnj] Diff of /sml/branches/SMLNJ/src/MLRISC/sparc/instructions/sparcCells.sml
ViewVC logotype

Diff of /sml/branches/SMLNJ/src/MLRISC/sparc/instructions/sparcCells.sml

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 428, Wed Sep 8 09:47:00 1999 UTC revision 429, Wed Sep 8 09:47:00 1999 UTC
# Line 10  Line 10 
10       UNKNOWN       UNKNOWN
11     | MEM     | MEM
12     | CTRL     | CTRL
    | Y  
    | CC  
13     | PSR     | PSR
14       | CC
15       | Y
16       | FP
17     | GP     | GP
18     | FSR     | FSR
    | FP  
19     withtype cellset = (int list * int list * int list)     withtype cellset = (int list * int list * int list)
20     include CELLS_BASIS where type cellkind = mycellkind     include CELLS_BASIS where type cellkind = mycellkind
21     val showY : register -> string     val showPSR : cell -> string
22     val showCC : register -> string     val showCC : cell -> string
23     val showPSR : register -> string     val showY : cell -> string
24     val showGP : register -> string     val showFP : cell -> string
25     val showFSR : register -> string     val showGP : cell -> string
26     val showFP : register -> string     val showFSR : cell -> string
27     val newY : unit -> register     val addGP : (cell * cellset) -> cellset
28     val newCC : unit -> register     val addFP : (cell * cellset) -> cellset
29     val newPSR : unit -> register     val addPSR : (cell * cellset) -> cellset
30     val newGP : unit -> register     val psr : cell
31     val newFSR : unit -> register     val fasmTmp : cell
32     val newFP : unit -> register     val y : cell
33     val addGP : (register * cellset) -> cellset     val stackptrR : cell
34     val addFP : (register * cellset) -> cellset     val asmTmpR : cell
35     val addPSR : (register * cellset) -> cellset     val fsr : cell
36     val fsr : register     val linkReg : cell
37     val asmTmpR : register     val zeroReg : cellkind -> cell option
38     val stackptrR : register     val toString : cellkind -> cell -> string
39     val fasmTmp : register     val addCell : cellkind -> cell * cellset -> cellset
40     val linkReg : register     val rmvCell : cellkind -> cell * cellset -> cellset
41     val y : register     val addReg : cell * cellset -> cellset
42     val psr : register     val rmvReg : cell * cellset -> cellset
43     val zeroReg : cellkind -> register option     val addFreg : cell * cellset -> cellset
44     val toString : cellkind -> register -> string     val rmvFreg : cell * cellset -> cellset
45     val addCell : cellkind -> register * cellset -> cellset     val getCell : cellkind -> cellset -> cell list
46     val addReg : register * cellset -> cellset     val updateCell : cellkind -> cellset * cell list -> cellset
    val addFreg : register * cellset -> cellset  
    val getCell : cellkind -> cellset -> register list  
    val updateCell : cellkind -> cellset * register list -> cellset  
47     val empty : cellset     val empty : cellset
48     val cellsetToString : cellset -> string     val cellsetToString : cellset -> string
49     val cellsetToString' : (register -> register) -> cellset -> string     val cellsetToString' : (cell -> cell) -> cellset -> string
50     val cellsetToRegs : cellset -> register list     val cellsetToCells : cellset -> cell list
51  end  end
52    
53  structure SparcCells : SPARCCELLS =  structure SparcCells : SPARCCELLS =
# Line 59  Line 56 
56       UNKNOWN       UNKNOWN
57     | MEM     | MEM
58     | CTRL     | CTRL
    | Y  
    | CC  
59     | PSR     | PSR
60       | CC
61       | Y
62       | FP
63     | GP     | GP
64     | FSR     | FSR
    | FP  
65     withtype cellset = (int list * int list * int list)     withtype cellset = (int list * int list * int list)
66     exception SparcCells     exception SparcCells
67     structure SL = SortedList     structure SL = SortedList
68     fun error msg = MLRiscErrorMsg.error("SparcCells",msg)     fun error msg = MLRiscErrorMsg.error("SparcCells",msg)
69     val cellkindToString = (fn Y => "Y"     val cellkindToString = (fn PSR => "PSR"
70                              | CC => "CC"                              | CC => "CC"
71                              | PSR => "PSR"                              | Y => "Y"
72                                | FP => "FP"
73                              | GP => "GP"                              | GP => "GP"
74                              | FSR => "FSR"                              | FSR => "FSR"
                             | FP => "FP"  
75                              | MEM => "MEM"                              | MEM => "MEM"
76                              | CTRL => "CTRL"                              | CTRL => "CTRL"
77                              | UNKNOWN => "UNKNOWN"                              | UNKNOWN => "UNKNOWN"
# Line 87  Line 84 
84         val INT = GP         val INT = GP
85         val FLOAT = FP         val FLOAT = FP
86         val firstPseudo = 256         val firstPseudo = 256
87         val kinds = [Y, CC, PSR, GP, FSR, FP, MEM, CTRL]         val kinds = [PSR, CC, Y, FP, GP, FSR, MEM, CTRL]
88         val physical = [{from=64, to=64, kind=Y}, {from=67, to=0, kind=CC}, {from=65, to=65, kind=PSR}, {from=0, to=31, kind=GP}, {from=66, to=66, kind=FSR}, {from=32, to=63, kind=FP}]         val physical = [{from=65, to=65, kind=PSR}, {from=67, to=0, kind=CC}, {from=64, to=64, kind=Y}, {from=32, to=63, kind=FP}, {from=0, to=31, kind=GP}, {from=66, to=66, kind=FSR}]
89        )        )
90    
91     open MyCellsBasis     open MyCellsBasis
92     val offsetY = 64     val offsetPSR = 65
93    and offsetCC = 67    and offsetCC = 67
94    and offsetPSR = 65    and offsetY = 64
95      and offsetFP = 32
96    and offsetGP = 0    and offsetGP = 0
97    and offsetFSR = 66    and offsetFSR = 66
98    and offsetFP = 32    and cellnames = ["PSR", "CC", "Y", "FP", "GP", "FSR"]
   and newY = (newCell Y)  
   and newCC = (newCell CC)  
   and newPSR = (newCell PSR)  
   and newGP = (newCell GP)  
   and newFSR = (newCell FSR)  
   and newFP = (newCell FP)  
   and cellnames = ["Y", "CC", "PSR", "GP", "FSR", "FP"]  
99    and cellsetnames = ["GP", "FP", "PSR"]    and cellsetnames = ["GP", "FP", "PSR"]
100     val fsr = (0 + offsetFSR)     val psr = (0 + offsetPSR)
    val asmTmpR = (10 + offsetGP)  
    val stackptrR = (14 + offsetGP)  
101     val fasmTmp = (30 + offsetFP)     val fasmTmp = (30 + offsetFP)
    val linkReg = (15 + offsetGP)  
102     val y = (0 + offsetY)     val y = (0 + offsetY)
103     val psr = (0 + offsetPSR)     val stackptrR = (14 + offsetGP)
104       val asmTmpR = (10 + offsetGP)
105       val fsr = (0 + offsetFSR)
106       val linkReg = (15 + offsetGP)
107    
108     fun showY r = let     fun showPSR r = let
109            val r = (if (r <= 64)            val r = (if (r <= 65)
110                  then (r - 64)                  then (r - 65)
111                  else r)                  else r)
112         in ((fn _ => "%y"         in ((fn 0 => "%psr"
113                 | n => ("%psr" ^ (Int.toString n))
114             ) r)             ) r)
115         end         end
116    
# Line 130  Line 122 
122             ) r)             ) r)
123         end         end
124    
125     and showPSR r = let     and showY r = let
126            val r = (if (r <= 65)            val r = (if (r <= 64)
127                  then (r - 65)                  then (r - 64)
128                  else r)                  else r)
129         in ((fn 0 => "%psr"         in ((fn _ => "%y"
130               | n => ("%psr" ^ (Int.toString n))             ) r)
131           end
132    
133       and showFP r = let
134              val r = (if (r <= 63)
135                    then (r - 32)
136                    else r)
137           in ((fn f => ("%f" ^ (Int.toString f))
138             ) r)             ) r)
139         end         end
140    
# Line 162  Line 161 
161             ) r)             ) r)
162         end         end
163    
164     and showFP r = let     and toString PSR = showPSR
           val r = (if (r <= 63)  
                 then (r - 32)  
                 else r)  
        in ((fn f => ("%f" ^ (Int.toString f))  
            ) r)  
        end  
   
    and toString Y = showY  
165       | toString CC = showCC       | toString CC = showCC
166       | toString PSR = showPSR       | toString Y = showY
167         | toString FP = showFP
168       | toString GP = showGP       | toString GP = showGP
169       | toString FSR = showFSR       | toString FSR = showFSR
      | toString FP = showFP  
170       | toString MEM = (fn r => ("m" ^ (Int.toString r))       | toString MEM = (fn r => ("m" ^ (Int.toString r))
171                        )                        )
172       | toString CTRL = (fn r => ("ctrl" ^ (Int.toString r))       | toString CTRL = (fn r => ("ctrl" ^ (Int.toString r))
# Line 184  Line 175 
175                            )                            )
176     val empty = ([], [], [])     val empty = ([], [], [])
177    
178     fun addCell CC = addGP     fun addCell GP = addGP
      | addCell PSR = addPSR  
      | addCell GP = addGP  
179       | addCell FP = addFP       | addCell FP = addFP
180         | addCell CC = addGP
181         | addCell PSR = addPSR
182       | addCell _ = (error "addCell")       | addCell _ = (error "addCell")
183     and getCell PSR = getCellPSR     and rmvCell GP = rmvGP
184       | getCell GP = getCellGP       | rmvCell FP = rmvFP
185         | rmvCell CC = rmvGP
186         | rmvCell PSR = rmvPSR
187         | rmvCell _ = (error "rmvCell")
188       and getCell GP = getCellGP
189       | getCell FP = getCellFP       | getCell FP = getCellFP
190         | getCell PSR = getCellPSR
191       | getCell _ = (error "getCell")       | getCell _ = (error "getCell")
192     and updateCell PSR = updateCellPSR     and updateCell GP = updateCellGP
      | updateCell GP = updateCellGP  
193       | updateCell FP = updateCellFP       | updateCell FP = updateCellFP
194         | updateCell PSR = updateCellPSR
195       | updateCell _ = (error "updateCell")       | updateCell _ = (error "updateCell")
196     and addGP (r, (setGP, setFP, setPSR)) = ((SL.enter (r, setGP)), setFP, setPSR)     and addGP (r, (setGP, setFP, setPSR)) = ((SL.enter (r, setGP)), setFP, setPSR)
197     and addFP (r, (setGP, setFP, setPSR)) = (setGP, (SL.enter (r, setFP)), setPSR)     and addFP (r, (setGP, setFP, setPSR)) = (setGP, (SL.enter (r, setFP)), setPSR)
198     and addPSR (r, (setGP, setFP, setPSR)) = (setGP, setFP, (SL.enter (r, setPSR)))     and addPSR (r, (setGP, setFP, setPSR)) = (setGP, setFP, (SL.enter (r, setPSR)))
199       and rmvGP (r, (setGP, setFP, setPSR)) = ((SL.rmv (r, setGP)), setFP, setPSR)
200       and rmvFP (r, (setGP, setFP, setPSR)) = (setGP, (SL.rmv (r, setFP)), setPSR)
201       and rmvPSR (r, (setGP, setFP, setPSR)) = (setGP, setFP, (SL.rmv (r, setPSR)))
202     and getCellGP (setGP, setFP, setPSR) = setGP     and getCellGP (setGP, setFP, setPSR) = setGP
203     and getCellFP (setGP, setFP, setPSR) = setFP     and getCellFP (setGP, setFP, setPSR) = setFP
204     and getCellPSR (setGP, setFP, setPSR) = setPSR     and getCellPSR (setGP, setFP, setPSR) = setPSR
# Line 209  Line 208 
208     and cellsetToString (setGP, setFP, setPSR) = (printTuple (cellsetnames, [((printSet showGP) setGP), ((printSet showFP) setFP), ((printSet showPSR) setPSR)]))     and cellsetToString (setGP, setFP, setPSR) = (printTuple (cellsetnames, [((printSet showGP) setGP), ((printSet showFP) setFP), ((printSet showPSR) setPSR)]))
209     and cellsetToString' regmap = (fn (setGP, setFP, setPSR) => (printTuple (cellsetnames, [((printSet showGP) ((map regmap) setGP)), ((printSet showFP) ((map regmap) setFP)), ((printSet showPSR) ((map regmap) setPSR))]))     and cellsetToString' regmap = (fn (setGP, setFP, setPSR) => (printTuple (cellsetnames, [((printSet showGP) ((map regmap) setGP)), ((printSet showFP) ((map regmap) setFP)), ((printSet showPSR) ((map regmap) setPSR))]))
210                                   )                                   )
211     and cellsetToRegs (setGP, setFP, setPSR) = (setGP @ (setFP @ setPSR))     and cellsetToCells (setGP, setFP, setPSR) = (setGP @ (setFP @ setPSR))
212     val addReg = addGP     val addReg = addGP
213     val addFreg = addFP     val addFreg = addFP
214       val rmvReg = rmvFP
215       val rmvFreg = rmvFP
216    
217     fun zeroReg GP = (SOME (0 + offsetGP))     fun zeroReg GP = (SOME (0 + offsetGP))
218       | zeroReg _ = NONE       | zeroReg _ = NONE

Legend:
Removed from v.428  
changed lines
  Added in v.429

root@smlnj-gforge.cs.uchicago.edu
ViewVC Help
Powered by ViewVC 1.0.0