unimp.isa (2754:e3d023bc752c) unimp.isa (5222:bb733a878f85)
1// -*- mode:c++ -*-
2
1// -*- mode:c++ -*-
2
3// Copyright N) 2007 MIPS Technologies, Inc. All Rights Reserved
3
4
4// Copyright (c) 2006 The Regents of The University of Michigan
5// All rights reserved.
6//
7// Redistribution and use in source and binary forms, with or without
8// modification, are permitted provided that the following conditions are
9// met: redistributions of source code must retain the above copyright
10// notice, this list of conditions and the following disclaimer;
11// redistributions in binary form must reproduce the above copyright
12// notice, this list of conditions and the following disclaimer in the
13// documentation and/or other materials provided with the distribution;
14// neither the name of the copyright holders nor the names of its
15// contributors may be used to endorse or promote products derived from
16// this software without specific prior written permission.
17//
18// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
19// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
20// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
21// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
22// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
23// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
24// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
25// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
26// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
27// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
28// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29//
30// Authors: Korey Sewell
5// This software is part of the M5 simulator.
31
6
7// THIS IS A LEGAL AGREEMENT. BY DOWNLOADING, USING, COPYING, CREATING
8// DERIVATIVE WORKS, AND/OR DISTRIBUTING THIS SOFTWARE YOU ARE AGREEING
9// TO THESE TERMS AND CONDITIONS.
10
11// Permission is granted to use, copy, create derivative works and
12// distribute this software and such derivative works for any purpose,
13// so long as (1) the copyright notice above, this grant of permission,
14// and the disclaimer below appear in all copies and derivative works
15// made, (2) the copyright notice above is augmented as appropriate to
16// reflect the addition of any new copyrightable work in a derivative
17// work (e.g., Copyright N) <Publication Year> Copyright Owner), and (3)
18// the name of MIPS Technologies, Inc. ($(B!H(BMIPS$(B!I(B) is not used in any
19// advertising or publicity pertaining to the use or distribution of
20// this software without specific, written prior authorization.
21
22// THIS SOFTWARE IS PROVIDED $(B!H(BAS IS.$(B!I(B MIPS MAKES NO WARRANTIES AND
23// DISCLAIMS ALL WARRANTIES, WHETHER EXPRESS, STATUTORY, IMPLIED OR
24// OTHERWISE, INCLUDING BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
25// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, AND
26// NON-INFRINGEMENT OF THIRD PARTY RIGHTS, REGARDING THIS SOFTWARE.
27// IN NO EVENT SHALL MIPS BE LIABLE FOR ANY DAMAGES, INCLUDING DIRECT,
28// INDIRECT, INCIDENTAL, CONSEQUENTIAL, SPECIAL, OR PUNITIVE DAMAGES OF
29// ANY KIND OR NATURE, ARISING OUT OF OR IN CONNECTION WITH THIS AGREEMENT,
30// THIS SOFTWARE AND/OR THE USE OF THIS SOFTWARE, WHETHER SUCH LIABILITY
31// IS ASSERTED ON THE BASIS OF CONTRACT, TORT (INCLUDING NEGLIGENCE OR
32// STRICT LIABILITY), OR OTHERWISE, EVEN IF MIPS HAS BEEN WARNED OF THE
33// POSSIBILITY OF ANY SUCH LOSS OR DAMAGE IN ADVANCE.
34
35//Authors: Korey L. Sewell
36
37
32////////////////////////////////////////////////////////////////////
33//
34// Unimplemented instructions
35//
36
37output header {{
38 /**
39 * Static instruction class for unimplemented instructions that

--- 14 unchanged lines hidden (view full) ---

54 flags[IsNonSpeculative] = true;
55 }
56
57 %(BasicExecDeclare)s
58
59 std::string
60 generateDisassembly(Addr pc, const SymbolTable *symtab) const;
61 };
38////////////////////////////////////////////////////////////////////
39//
40// Unimplemented instructions
41//
42
43output header {{
44 /**
45 * Static instruction class for unimplemented instructions that

--- 14 unchanged lines hidden (view full) ---

60 flags[IsNonSpeculative] = true;
61 }
62
63 %(BasicExecDeclare)s
64
65 std::string
66 generateDisassembly(Addr pc, const SymbolTable *symtab) const;
67 };
68 class CP0Unimplemented : public MipsStaticInst
69 {
70 public:
71 /// Constructor
72 CP0Unimplemented(const char *_mnemonic, MachInst _machInst)
73 : MipsStaticInst(_mnemonic, _machInst, No_OpClass)
74 {
75 // don't call execute() (which panics) if we're on a
76 // speculative path
77 flags[IsNonSpeculative] = true;
78 }
62
79
80 %(BasicExecDeclare)s
81
82 std::string
83 generateDisassembly(Addr pc, const SymbolTable *symtab) const;
84 };
85 class CP1Unimplemented : public MipsStaticInst
86 {
87 public:
88 /// Constructor
89 CP1Unimplemented(const char *_mnemonic, MachInst _machInst)
90 : MipsStaticInst(_mnemonic, _machInst, No_OpClass)
91 {
92 // don't call execute() (which panics) if we're on a
93 // speculative path
94 flags[IsNonSpeculative] = true;
95 }
96
97 %(BasicExecDeclare)s
98
99 std::string
100 generateDisassembly(Addr pc, const SymbolTable *symtab) const;
101 };
102 class CP2Unimplemented : public MipsStaticInst
103 {
104 public:
105 /// Constructor
106 CP2Unimplemented(const char *_mnemonic, MachInst _machInst)
107 : MipsStaticInst(_mnemonic, _machInst, No_OpClass)
108 {
109 // don't call execute() (which panics) if we're on a
110 // speculative path
111 flags[IsNonSpeculative] = true;
112 }
113
114 %(BasicExecDeclare)s
115
116 std::string
117 generateDisassembly(Addr pc, const SymbolTable *symtab) const;
118 };
119
63 /**
64 * Base class for unimplemented instructions that cause a warning
65 * to be printed (but do not terminate simulation). This
66 * implementation is a little screwy in that it will print a
67 * warning for each instance of a particular unimplemented machine
68 * instruction, not just for each unimplemented opcode. Should
69 * probably make the 'warned' flag a static member of the derived
70 * class.

--- 25 unchanged lines hidden (view full) ---

96 std::string
97 FailUnimplemented::generateDisassembly(Addr pc,
98 const SymbolTable *symtab) const
99 {
100 return csprintf("%-10s (unimplemented)", mnemonic);
101 }
102
103 std::string
120 /**
121 * Base class for unimplemented instructions that cause a warning
122 * to be printed (but do not terminate simulation). This
123 * implementation is a little screwy in that it will print a
124 * warning for each instance of a particular unimplemented machine
125 * instruction, not just for each unimplemented opcode. Should
126 * probably make the 'warned' flag a static member of the derived
127 * class.

--- 25 unchanged lines hidden (view full) ---

153 std::string
154 FailUnimplemented::generateDisassembly(Addr pc,
155 const SymbolTable *symtab) const
156 {
157 return csprintf("%-10s (unimplemented)", mnemonic);
158 }
159
160 std::string
161 CP0Unimplemented::generateDisassembly(Addr pc,
162 const SymbolTable *symtab) const
163 {
164 return csprintf("%-10s (unimplemented)", mnemonic);
165 }
166
167 std::string
168 CP1Unimplemented::generateDisassembly(Addr pc,
169 const SymbolTable *symtab) const
170 {
171 return csprintf("%-10s (unimplemented)", mnemonic);
172 }
173 std::string
174 CP2Unimplemented::generateDisassembly(Addr pc,
175 const SymbolTable *symtab) const
176 {
177 return csprintf("%-10s (unimplemented)", mnemonic);
178 }
179
180 std::string
104 WarnUnimplemented::generateDisassembly(Addr pc,
105 const SymbolTable *symtab) const
106 {
107 return csprintf("%-10s (unimplemented)", mnemonic);
108 }
109}};
110
111output exec {{
112 Fault
113 FailUnimplemented::execute(%(CPU_exec_context)s *xc,
114 Trace::InstRecord *traceData) const
115 {
116 panic("attempt to execute unimplemented instruction '%s' "
117 "(inst 0x%08x, opcode 0x%x, binary:%s)", mnemonic, machInst, OPCODE,
118 inst2string(machInst));
119 return new UnimplementedOpcodeFault;
120 }
121
122 Fault
181 WarnUnimplemented::generateDisassembly(Addr pc,
182 const SymbolTable *symtab) const
183 {
184 return csprintf("%-10s (unimplemented)", mnemonic);
185 }
186}};
187
188output exec {{
189 Fault
190 FailUnimplemented::execute(%(CPU_exec_context)s *xc,
191 Trace::InstRecord *traceData) const
192 {
193 panic("attempt to execute unimplemented instruction '%s' "
194 "(inst 0x%08x, opcode 0x%x, binary:%s)", mnemonic, machInst, OPCODE,
195 inst2string(machInst));
196 return new UnimplementedOpcodeFault;
197 }
198
199 Fault
200 CP0Unimplemented::execute(%(CPU_exec_context)s *xc,
201 Trace::InstRecord *traceData) const
202 {
203#if FULL_SYSTEM
204 if (!isCoprocessorEnabled(xc, 0)) {
205 return new CoprocessorUnusableFault(0);
206 }
207 return new ReservedInstructionFault;
208#else
209 panic("attempt to execute unimplemented instruction '%s' "
210 "(inst 0x%08x, opcode 0x%x, binary:%s)", mnemonic, machInst, OPCODE,
211 inst2string(machInst));
212 return new UnimplementedOpcodeFault;
213#endif
214 }
215
216 Fault
217 CP1Unimplemented::execute(%(CPU_exec_context)s *xc,
218 Trace::InstRecord *traceData) const
219 {
220#if FULL_SYSTEM
221 if (!isCoprocessorEnabled(xc, 1)) {
222 return new CoprocessorUnusableFault(1);
223 }
224 return new ReservedInstructionFault;
225#else
226 panic("attempt to execute unimplemented instruction '%s' "
227 "(inst 0x%08x, opcode 0x%x, binary:%s)", mnemonic, machInst, OPCODE,
228 inst2string(machInst));
229 return new UnimplementedOpcodeFault;
230#endif
231 }
232 Fault
233 CP2Unimplemented::execute(%(CPU_exec_context)s *xc,
234 Trace::InstRecord *traceData) const
235 {
236#if FULL_SYSTEM
237 if (!isCoprocessorEnabled(xc, 2)) {
238 return new CoprocessorUnusableFault(2);
239 }
240 return new ReservedInstructionFault;
241#else
242 panic("attempt to execute unimplemented instruction '%s' "
243 "(inst 0x%08x, opcode 0x%x, binary:%s)", mnemonic, machInst, OPCODE,
244 inst2string(machInst));
245 return new UnimplementedOpcodeFault;
246#endif
247 }
248
249 Fault
123 WarnUnimplemented::execute(%(CPU_exec_context)s *xc,
124 Trace::InstRecord *traceData) const
125 {
126 if (!warned) {
127 warn("\tinstruction '%s' unimplemented\n", mnemonic);
128 warned = true;
129 }
130
131 return NoFault;
132 }
133}};
134
135
136def format FailUnimpl() {{
137 iop = InstObjParams(name, 'FailUnimplemented')
138 decode_block = BasicDecodeWithMnemonic.subst(iop)
250 WarnUnimplemented::execute(%(CPU_exec_context)s *xc,
251 Trace::InstRecord *traceData) const
252 {
253 if (!warned) {
254 warn("\tinstruction '%s' unimplemented\n", mnemonic);
255 warned = true;
256 }
257
258 return NoFault;
259 }
260}};
261
262
263def format FailUnimpl() {{
264 iop = InstObjParams(name, 'FailUnimplemented')
265 decode_block = BasicDecodeWithMnemonic.subst(iop)
139}};
140
266
267}};
268def format CP0Unimpl() {{
269 iop = InstObjParams(name, 'CP0Unimplemented')
270 decode_block = BasicDecodeWithMnemonic.subst(iop)
271}};
272def format CP1Unimpl() {{
273 iop = InstObjParams(name, 'CP1Unimplemented')
274 decode_block = BasicDecodeWithMnemonic.subst(iop)
275}};
276def format CP2Unimpl() {{
277 iop = InstObjParams(name, 'CP2Unimplemented')
278 decode_block = BasicDecodeWithMnemonic.subst(iop)
279}};
141def format WarnUnimpl() {{
142 iop = InstObjParams(name, 'WarnUnimplemented')
143 decode_block = BasicDecodeWithMnemonic.subst(iop)
144}};
145
280def format WarnUnimpl() {{
281 iop = InstObjParams(name, 'WarnUnimplemented')
282 decode_block = BasicDecodeWithMnemonic.subst(iop)
283}};
284