bdce6bccf01e57234e95ea1006b6ef17e49d43af
[gem5.git] / src / arch / mips / regfile / int_regfile.hh
1 /*
2 * Copyright (c) 2006 The Regents of The University of Michigan
3 * All rights reserved.
4 *
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.
15 *
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.
27 *
28 * Authors: Korey Sewell
29 */
30
31 #ifndef __ARCH_MIPS_REGFILE_INT_REGFILE_HH__
32 #define __ARCH_MIPS_REGFILE_INT_REGFILE_HH__
33
34 #include "arch/mips/types.hh"
35 #include "arch/mips/isa_traits.hh"
36 #include "base/misc.hh"
37 #include "base/trace.hh"
38 #include "sim/faults.hh"
39
40 class Checkpoint;
41
42 namespace MipsISA
43 {
44 static inline std::string getIntRegName(RegIndex)
45 {
46 return "";
47 }
48
49 enum MiscIntRegNums {
50 LO = NumIntArchRegs*NumShadowRegSets,
51 HI,
52 DSPACX0,
53 DSPLo1,
54 DSPHi1,
55 DSPACX1,
56 DSPLo2,
57 DSPHi2,
58 DSPACX2,
59 DSPLo3,
60 DSPHi3,
61 DSPACX3,
62 DSPControl,
63 DSPLo0 = LO,
64 DSPHi0 = HI
65 };
66
67 class IntRegFile
68 {
69 protected:
70 IntReg regs[NumIntRegs];
71 int currShadowSet;
72 public:
73 void clear();
74 void setShadowSet(int css);
75 IntReg readReg(int intReg);
76 Fault setReg(int intReg, const IntReg &val);
77
78 void serialize(std::ostream &os);
79 void unserialize(Checkpoint *cp, const std::string &section);
80
81 };
82
83 } // namespace MipsISA
84
85 #endif