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.
28 * Authors: Korey Sewell
31 #ifndef __ARCH_MIPS_REGFILE_HH__
32 #define __ARCH_MIPS_REGFILE_HH__
34 #include "arch/mips/types.hh"
35 #include "arch/mips/constants.hh"
36 #include "arch/mips/regfile/int_regfile.hh"
37 #include "arch/mips/regfile/float_regfile.hh"
38 #include "arch/mips/regfile/misc_regfile.hh"
39 #include "sim/faults.hh"
48 IntRegFile intRegFile; // (signed) integer register file
49 FloatRegFile floatRegFile; // floating point register file
50 MiscRegFile miscRegFile; // control register file
56 bzero(&intRegFile, sizeof(intRegFile));
57 bzero(&floatRegFile, sizeof(floatRegFile));
58 bzero(&miscRegFile, sizeof(miscRegFile));
61 MiscReg readMiscReg(int miscReg)
63 return miscRegFile.readReg(miscReg);
66 MiscReg readMiscRegWithEffect(int miscReg,
67 Fault &fault, ThreadContext *tc)
70 return miscRegFile.readRegWithEffect(miscReg, fault, tc);
73 Fault setMiscReg(int miscReg, const MiscReg &val)
75 return miscRegFile.setReg(miscReg, val);
78 Fault setMiscRegWithEffect(int miscReg, const MiscReg &val,
81 return miscRegFile.setRegWithEffect(miscReg, val, tc);
84 FloatReg readFloatReg(int floatReg)
86 return floatRegFile.readReg(floatReg,SingleWidth);
89 FloatReg readFloatReg(int floatReg, int width)
91 return floatRegFile.readReg(floatReg,width);
94 FloatRegBits readFloatRegBits(int floatReg)
96 return floatRegFile.readRegBits(floatReg,SingleWidth);
99 FloatRegBits readFloatRegBits(int floatReg, int width)
101 return floatRegFile.readRegBits(floatReg,width);
104 Fault setFloatReg(int floatReg, const FloatReg &val)
106 return floatRegFile.setReg(floatReg, val, SingleWidth);
109 Fault setFloatReg(int floatReg, const FloatReg &val, int width)
111 return floatRegFile.setReg(floatReg, val, width);
114 Fault setFloatRegBits(int floatReg, const FloatRegBits &val)
116 return floatRegFile.setRegBits(floatReg, val, SingleWidth);
119 Fault setFloatRegBits(int floatReg, const FloatRegBits &val, int width)
121 return floatRegFile.setRegBits(floatReg, val, width);
124 IntReg readIntReg(int intReg)
126 return intRegFile.readReg(intReg);
129 Fault setIntReg(int intReg, const IntReg &val)
131 return intRegFile.setReg(intReg, val);
135 Addr pc; // program counter
136 Addr npc; // next-cycle program counter
137 Addr nnpc; // next-next-cycle program counter
138 // used to implement branch delay slot
156 void setNextPC(Addr val)
166 void setNextNPC(Addr val)
173 IntReg palregs[NumIntRegs]; // PAL shadow registers
174 InternalProcReg ipr[NumInternalProcRegs]; // internal processor regs
175 int intrflag; // interrupt flag
176 bool pal_shadow; // using pal_shadow registers
177 inline int instAsid() { return MIPS34K::ITB_ASN_ASN(ipr[IPR_ITB_ASN]); }
178 inline int dataAsid() { return MIPS34K::DTB_ASN_ASN(ipr[IPR_DTB_ASN]); }
179 #endif // FULL_SYSTEM
181 void serialize(std::ostream &os);
182 void unserialize(Checkpoint *cp, const std::string §ion);
184 typedef int ContextParam;
185 typedef int ContextVal;
187 void changeContext(ContextParam param, ContextVal val)
192 void copyRegs(ThreadContext *src, ThreadContext *dest);
194 void copyMiscRegs(ThreadContext *src, ThreadContext *dest);
197 void copyIprs(ThreadContext *src, ThreadContext *dest);
199 } // namespace MipsISA