gem5  v19.0.0.0
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
isa.cc
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 #include "arch/alpha/isa.hh"
32 
33 #include <cassert>
34 
35 #include "base/logging.hh"
36 #include "cpu/thread_context.hh"
37 #include "params/AlphaISA.hh"
38 #include "sim/serialize.hh"
39 
40 namespace AlphaISA
41 {
42 
44 {
45  clear();
47 }
48 
49 const AlphaISAParams *
50 ISA::params() const
51 {
52  return dynamic_cast<const Params *>(_params);
53 }
54 
55 void
57 {
63 }
64 
65 void
67 {
73 }
74 
75 
76 RegVal
77 ISA::readMiscRegNoEffect(int misc_reg, ThreadID tid) const
78 {
79  switch (misc_reg) {
80  case MISCREG_FPCR:
81  return fpcr;
82  case MISCREG_UNIQ:
83  return uniq;
84  case MISCREG_LOCKFLAG:
85  return lock_flag;
86  case MISCREG_LOCKADDR:
87  return lock_addr;
88  case MISCREG_INTR:
89  return intr_flag;
90  default:
91  assert(misc_reg < NumInternalProcRegs);
92  return ipr[misc_reg];
93  }
94 }
95 
96 RegVal
97 ISA::readMiscReg(int misc_reg, ThreadContext *tc, ThreadID tid)
98 {
99  switch (misc_reg) {
100  case MISCREG_FPCR:
101  return fpcr;
102  case MISCREG_UNIQ:
103  return uniq;
104  case MISCREG_LOCKFLAG:
105  return lock_flag;
106  case MISCREG_LOCKADDR:
107  return lock_addr;
108  case MISCREG_INTR:
109  return intr_flag;
110  default:
111  return readIpr(misc_reg, tc);
112  }
113 }
114 
115 void
117 {
118  switch (misc_reg) {
119  case MISCREG_FPCR:
120  fpcr = val;
121  return;
122  case MISCREG_UNIQ:
123  uniq = val;
124  return;
125  case MISCREG_LOCKFLAG:
126  lock_flag = val;
127  return;
128  case MISCREG_LOCKADDR:
129  lock_addr = val;
130  return;
131  case MISCREG_INTR:
132  intr_flag = val;
133  return;
134  default:
135  assert(misc_reg < NumInternalProcRegs);
136  ipr[misc_reg] = val;
137  return;
138  }
139 }
140 
141 void
143 {
144  switch (misc_reg) {
145  case MISCREG_FPCR:
146  fpcr = val;
147  return;
148  case MISCREG_UNIQ:
149  uniq = val;
150  return;
151  case MISCREG_LOCKFLAG:
152  lock_flag = val;
153  return;
154  case MISCREG_LOCKADDR:
155  lock_addr = val;
156  return;
157  case MISCREG_INTR:
158  intr_flag = val;
159  return;
160  default:
161  setIpr(misc_reg, val, tc);
162  return;
163  }
164 }
165 
166 }
167 
169 AlphaISAParams::create()
170 {
171  return new AlphaISA::ISA(this);
172 }
void serialize(CheckpointOut &cp) const override
Serialize an object.
Definition: isa.cc:56
InternalProcReg readIpr(int idx, ThreadContext *tc)
Definition: ev5.cc:81
void initializeIprTable()
Definition: ipr.cc:129
InternalProcReg ipr[NumInternalProcRegs]
Definition: isa.hh:70
uint64_t RegVal
Definition: types.hh:168
Definition: cprintf.cc:42
int intr_flag
Definition: isa.hh:68
ThreadContext is the external interface to all thread state for anything outside of the CPU...
Bitfield< 63 > val
Definition: misc.hh:771
uint64_t fpcr
Definition: isa.hh:64
#define UNSERIALIZE_SCALAR(scalar)
Definition: serialize.hh:645
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
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
#define SERIALIZE_ARRAY(member, size)
Definition: serialize.hh:658
uint64_t uniq
Definition: isa.hh:65
void clear()
Definition: isa.hh:86
Bitfield< 15 > system
Definition: misc.hh:999
#define SERIALIZE_SCALAR(scalar)
Definition: serialize.hh:643
#define UNSERIALIZE_ARRAY(member, size)
Definition: serialize.hh:661
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
const SimObjectParams * _params
Cached copy of the object parameters.
Definition: sim_object.hh:110
ISA(Params *p)
Definition: isa.cc:43
bool lock_flag
Definition: isa.hh:66
RegVal readMiscRegNoEffect(int misc_reg, ThreadID tid=0) const
Definition: isa.cc:77
Definition: isa.hh:35
void unserialize(CheckpointIn &cp) override
Unserialize an object.
Definition: isa.cc:66
Bitfield< 0 > p
AlphaISAParams Params
Definition: isa.hh:58

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