2 * Copyright (c) 2003-2005 The Regents of The University of Michigan
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are
7 * met: redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer;
9 * redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution;
12 * neither the name of the copyright holders nor the names of its
13 * contributors may be used to endorse or promote products derived from
14 * this software without specific prior written permission.
16 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
17 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
18 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
19 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
20 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
21 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
22 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
23 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
24 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
26 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31 #ifndef __ARCH_ALPHA_REGFILE_HH__
32 #define __ARCH_ALPHA_REGFILE_HH__
34 #include "arch/alpha/isa_traits.hh"
35 #include "arch/alpha/intregfile.hh"
36 #include "arch/alpha/miscregfile.hh"
37 #include "arch/alpha/types.hh"
38 #include "sim/faults.hh"
42 //XXX These should be implemented by someone who knows the alpha stuff better
50 static inline std::string getIntRegName(RegIndex)
55 static inline std::string getFloatRegName(RegIndex)
60 static inline std::string getMiscRegName(RegIndex)
70 uint64_t q[NumFloatRegs]; // integer qword view
71 double d[NumFloatRegs]; // double-precision floating point view
74 void serialize(std::ostream &os);
76 void unserialize(Checkpoint *cp, const std::string §ion);
79 { bzero(d, sizeof(d)); }
85 Addr pc; // program counter
86 Addr npc; // next-cycle program counter
105 void setNextPC(Addr val)
115 void setNextNPC(Addr val)
121 IntRegFile intRegFile; // (signed) integer register file
122 FloatRegFile floatRegFile; // floating point register file
123 MiscRegFile miscRegFile; // control register file
128 int intrflag; // interrupt flag
129 inline int instAsid()
130 { return miscRegFile.getInstAsid(); }
131 inline int dataAsid()
132 { return miscRegFile.getDataAsid(); }
133 #endif // FULL_SYSTEM
138 floatRegFile.clear();
142 MiscReg readMiscReg(int miscReg)
144 return miscRegFile.readReg(miscReg);
147 MiscReg readMiscRegWithEffect(int miscReg, ThreadContext *tc)
149 return miscRegFile.readRegWithEffect(miscReg, tc);
152 void setMiscReg(int miscReg, const MiscReg &val)
154 miscRegFile.setReg(miscReg, val);
157 void setMiscRegWithEffect(int miscReg, const MiscReg &val,
160 miscRegFile.setRegWithEffect(miscReg, val, tc);
163 FloatReg readFloatReg(int floatReg)
165 return floatRegFile.d[floatReg];
168 FloatReg readFloatReg(int floatReg, int width)
170 return readFloatReg(floatReg);
173 FloatRegBits readFloatRegBits(int floatReg)
175 return floatRegFile.q[floatReg];
178 FloatRegBits readFloatRegBits(int floatReg, int width)
180 return readFloatRegBits(floatReg);
183 void setFloatReg(int floatReg, const FloatReg &val)
185 floatRegFile.d[floatReg] = val;
188 void setFloatReg(int floatReg, const FloatReg &val, int width)
190 setFloatReg(floatReg, val);
193 void setFloatRegBits(int floatReg, const FloatRegBits &val)
195 floatRegFile.q[floatReg] = val;
198 void setFloatRegBits(int floatReg, const FloatRegBits &val, int width)
200 setFloatRegBits(floatReg, val);
203 IntReg readIntReg(int intReg)
205 return intRegFile.readReg(intReg);
208 void setIntReg(int intReg, const IntReg &val)
210 intRegFile.setReg(intReg, val);
213 void serialize(std::ostream &os);
214 void unserialize(Checkpoint *cp, const std::string §ion);
216 void changeContext(RegContextParam param, RegContextVal val)
218 //This would be an alternative place to call/implement
219 //the swapPALShadow function
223 void copyRegs(ThreadContext *src, ThreadContext *dest);
225 void copyMiscRegs(ThreadContext *src, ThreadContext *dest);
226 } // namespace AlphaISA