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.
29 #ifndef __ARCH_MIPS_REGFILE_HH__
30 #define __ARCH_MIPS_REGFILE_HH__
32 #include "arch/mips/types.hh"
33 #include "arch/mips/constants.hh"
34 #include "arch/mips/regfile/int_regfile.hh"
35 #include "arch/mips/regfile/float_regfile.hh"
36 #include "arch/mips/regfile/misc_regfile.hh"
37 #include "sim/faults.hh"
46 IntRegFile intRegFile; // (signed) integer register file
47 FloatRegFile floatRegFile; // floating point register file
48 MiscRegFile miscRegFile; // control register file
54 bzero(&intRegFile, sizeof(intRegFile));
55 bzero(&floatRegFile, sizeof(floatRegFile));
56 bzero(&miscRegFile, sizeof(miscRegFile));
59 MiscReg readMiscReg(int miscReg)
61 return miscRegFile.readReg(miscReg);
64 MiscReg readMiscRegWithEffect(int miscReg,
65 Fault &fault, ExecContext *xc)
68 return miscRegFile.readRegWithEffect(miscReg, fault, xc);
71 Fault setMiscReg(int miscReg, const MiscReg &val)
73 return miscRegFile.setReg(miscReg, val);
76 Fault setMiscRegWithEffect(int miscReg, const MiscReg &val,
79 return miscRegFile.setRegWithEffect(miscReg, val, xc);
82 FloatReg readFloatReg(int floatReg)
84 return floatRegFile.readReg(floatReg,SingleWidth);
87 FloatReg readFloatReg(int floatReg, int width)
89 return floatRegFile.readReg(floatReg,width);
92 FloatRegBits readFloatRegBits(int floatReg)
94 return floatRegFile.readRegBits(floatReg,SingleWidth);
97 FloatRegBits readFloatRegBits(int floatReg, int width)
99 return floatRegFile.readRegBits(floatReg,width);
102 Fault setFloatReg(int floatReg, const FloatReg &val)
104 return floatRegFile.setReg(floatReg, val, SingleWidth);
107 Fault setFloatReg(int floatReg, const FloatReg &val, int width)
109 return floatRegFile.setReg(floatReg, val, width);
112 Fault setFloatRegBits(int floatReg, const FloatRegBits &val)
114 return floatRegFile.setRegBits(floatReg, val, SingleWidth);
117 Fault setFloatRegBits(int floatReg, const FloatRegBits &val, int width)
119 return floatRegFile.setRegBits(floatReg, val, width);
122 IntReg readIntReg(int intReg)
124 return intRegFile.readReg(intReg);
127 Fault setIntReg(int intReg, const IntReg &val)
129 return intRegFile.setReg(intReg, val);
133 Addr pc; // program counter
134 Addr npc; // next-cycle program counter
135 Addr nnpc; // next-next-cycle program counter
136 // used to implement branch delay slot
154 void setNextPC(Addr val)
164 void setNextNPC(Addr val)
171 IntReg palregs[NumIntRegs]; // PAL shadow registers
172 InternalProcReg ipr[NumInternalProcRegs]; // internal processor regs
173 int intrflag; // interrupt flag
174 bool pal_shadow; // using pal_shadow registers
175 inline int instAsid() { return MIPS34K::ITB_ASN_ASN(ipr[IPR_ITB_ASN]); }
176 inline int dataAsid() { return MIPS34K::DTB_ASN_ASN(ipr[IPR_DTB_ASN]); }
177 #endif // FULL_SYSTEM
179 void serialize(std::ostream &os);
180 void unserialize(Checkpoint *cp, const std::string §ion);
182 typedef int ContextParam;
183 typedef int ContextVal;
185 void changeContext(ContextParam param, ContextVal val)
190 void copyRegs(ExecContext *src, ExecContext *dest);
192 void copyMiscRegs(ExecContext *src, ExecContext *dest);
195 void copyIprs(ExecContext *src, ExecContext *dest);
197 } // namespace MipsISA