gem5  v19.0.0.0
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
isa.hh
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2009 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: Gabe Black
29  */
30 
31 #ifndef __ARCH_ALPHA_ISA_HH__
32 #define __ARCH_ALPHA_ISA_HH__
33 
34 #include <cstring>
35 #include <iostream>
36 #include <string>
37 
38 #include "arch/alpha/registers.hh"
39 #include "arch/alpha/types.hh"
40 #include "arch/generic/isa.hh"
41 #include "base/types.hh"
42 #include "cpu/reg_class.hh"
43 #include "sim/sim_object.hh"
44 #include "sim/system.hh"
45 
46 struct AlphaISAParams;
47 class BaseCPU;
48 class Checkpoint;
49 class EventManager;
50 class ThreadContext;
51 
52 namespace AlphaISA
53 {
54  class ISA : public BaseISA
55  {
56  public:
57  typedef uint64_t InternalProcReg;
58  typedef AlphaISAParams Params;
59 
60  protected:
61  // Parent system
63 
64  uint64_t fpcr; // floating point condition codes
65  uint64_t uniq; // process-unique register
66  bool lock_flag; // lock flag for LL/SC
67  Addr lock_addr; // lock address for LL/SC
68  int intr_flag;
69 
70  InternalProcReg ipr[NumInternalProcRegs]; // Internal processor regs
71 
72  protected:
73  InternalProcReg readIpr(int idx, ThreadContext *tc);
74  void setIpr(int idx, InternalProcReg val, ThreadContext *tc);
75 
76  public:
77 
78  RegVal readMiscRegNoEffect(int misc_reg, ThreadID tid = 0) const;
79  RegVal readMiscReg(int misc_reg, ThreadContext *tc, ThreadID tid = 0);
80 
81  void setMiscRegNoEffect(int misc_reg, RegVal val, ThreadID tid=0);
82  void setMiscReg(int misc_reg, RegVal val, ThreadContext *tc,
83  ThreadID tid=0);
84 
85  void
87  {
88  fpcr = 0;
89  uniq = 0;
90  lock_flag = 0;
91  lock_addr = 0;
92  intr_flag = 0;
93  memset(ipr, 0, sizeof(ipr));
94  }
95 
96  void serialize(CheckpointOut &cp) const override;
97  void unserialize(CheckpointIn &cp) override;
98 
99  RegId flattenRegId(const RegId& regId) const { return regId; }
100 
101  int
102  flattenIntIndex(int reg) const
103  {
104  return reg;
105  }
106 
107  int
109  {
110  return reg;
111  }
112 
113  int
114  flattenVecIndex(int reg) const
115  {
116  return reg;
117  }
118 
119  int
121  {
122  return reg;
123  }
124 
125  int
127  {
128  return reg;
129  }
130 
131  // dummy
132  int
133  flattenCCIndex(int reg) const
134  {
135  return reg;
136  }
137 
138  int
140  {
141  return reg;
142  }
143 
144  const Params *params() const;
145 
146  ISA(Params *p);
147 
148  void startup(ThreadContext *tc) {}
149 
151  using BaseISA::startup;
152  };
153 }
154 
155 #endif
int flattenVecPredIndex(int reg) const
Definition: isa.hh:126
void serialize(CheckpointOut &cp) const override
Serialize an object.
Definition: isa.cc:56
Bitfield< 5, 3 > reg
Definition: types.hh:89
int flattenCCIndex(int reg) const
Definition: isa.hh:133
InternalProcReg readIpr(int idx, ThreadContext *tc)
Definition: ev5.cc:81
InternalProcReg ipr[NumInternalProcRegs]
Definition: isa.hh:70
uint64_t RegVal
Definition: types.hh:168
Definition: system.hh:77
Definition: cprintf.cc:42
RegId flattenRegId(const RegId &regId) const
Definition: isa.hh:99
int intr_flag
Definition: isa.hh:68
ThreadContext is the external interface to all thread state for anything outside of the CPU...
int flattenMiscIndex(int reg) const
Definition: isa.hh:139
Bitfield< 63 > val
Definition: misc.hh:771
uint64_t fpcr
Definition: isa.hh:64
void setIpr(int idx, InternalProcReg val, ThreadContext *tc)
Definition: ev5.cc:190
Addr lock_addr
Definition: isa.hh:67
RegVal readMiscReg(int misc_reg, ThreadContext *tc, ThreadID tid=0)
Definition: isa.cc:97
uint64_t InternalProcReg
Definition: isa.hh:57
int flattenVecIndex(int reg) const
Definition: isa.hh:114
void setMiscReg(int misc_reg, RegVal val, ThreadContext *tc, ThreadID tid=0)
Definition: isa.cc:142
void setMiscRegNoEffect(int misc_reg, RegVal val, ThreadID tid=0)
Definition: isa.cc:116
Defines global host-dependent types: Counter, Tick, and (indirectly) {int,uint}{8,16,32,64}_t.
uint64_t Addr
Address type This will probably be moved somewhere else in the near future.
Definition: types.hh:142
uint64_t uniq
Definition: isa.hh:65
void clear()
Definition: isa.hh:86
int flattenFloatIndex(int reg) const
Definition: isa.hh:108
int16_t ThreadID
Thread index/ID type.
Definition: types.hh:227
const Params * params() const
Definition: isa.cc:50
std::ostream CheckpointOut
Definition: serialize.hh:68
void startup(ThreadContext *tc)
Definition: isa.hh:148
int flattenVecElemIndex(int reg) const
Definition: isa.hh:120
ISA(Params *p)
Definition: isa.cc:43
int flattenIntIndex(int reg) const
Definition: isa.hh:102
bool lock_flag
Definition: isa.hh:66
RegVal readMiscRegNoEffect(int misc_reg, ThreadID tid=0) const
Definition: isa.cc:77
Register ID: describe an architectural register with its class and index.
Definition: reg_class.hh:79
Definition: isa.hh:35
void unserialize(CheckpointIn &cp) override
Unserialize an object.
Definition: isa.cc:66
System * system
Definition: isa.hh:62
Bitfield< 0 > p
AlphaISAParams Params
Definition: isa.hh:58
virtual void startup()
startup() is the final initialization call before simulation.
Definition: sim_object.cc:99

Generated on Fri Feb 28 2020 16:26:56 for gem5 by doxygen 1.8.13