Deleted Added
sdiff udiff text old ( 3954:d689b611d9dc ) new ( 4661:44458219add1 )
full compact
1// -*- mode:c++ -*-
2
3// Copyright (c) 2006 The Regents of The University of Michigan
4// All rights reserved.
5//
6// Redistribution and use in source and binary forms, with or without
7// modification, are permitted provided that the following conditions are
8// met: redistributions of source code must retain the above copyright

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

29// Authors: Korey Sewell
30
31////////////////////////////////////////////////////////////////////
32//
33// Integer operate instructions
34//
35output header {{
36#include <iostream>
37 /**
38 * Base class for integer operations.
39 */
40 class IntOp : public MipsStaticInst
41 {
42 protected:
43
44 /// Constructor

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

59 HiLoOp(const char *mnem, MachInst _machInst, OpClass __opClass) :
60 IntOp(mnem, _machInst, __opClass)
61 {
62 }
63
64 std::string generateDisassembly(Addr pc, const SymbolTable *symtab) const;
65 };
66
67 class HiLoMiscOp: public HiLoOp
68 {
69 protected:
70
71 /// Constructor
72 HiLoMiscOp(const char *mnem, MachInst _machInst, OpClass __opClass) :
73 HiLoOp(mnem, _machInst, __opClass)
74 {
75 }
76
77 std::string generateDisassembly(Addr pc, const SymbolTable *symtab) const;
78 };
79
80
81 class IntImmOp : public MipsStaticInst
82 {
83 protected:
84
85 int16_t imm;
86 int32_t sextImm;
87 uint32_t zextImm;
88

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

100
101 std::string generateDisassembly(Addr pc, const SymbolTable *symtab) const;
102
103
104 };
105
106}};
107
108// HiLo<Misc> instruction class execute method template.
109// Mainly to get instruction trace data to print out
110// correctly
111def template HiLoExecute {{
112 Fault %(class_name)s::execute(%(CPU_exec_context)s *xc, Trace::InstRecord *traceData) const
113 {
114 Fault fault = NoFault;
115
116 %(fp_enable_check)s;
117 %(op_decl)s;
118 %(op_rd)s;
119 %(code)s;
120
121 if(fault == NoFault)
122 {
123 %(op_wb)s;
124 //If there are 2 Destination Registers then
125 //concatenate the values for the traceData
126 if(traceData && _numDestRegs == 2) {
127 uint64_t hilo_final_val = (uint64_t)HI << 32 | LO;
128 traceData->setData(hilo_final_val);
129 }
130 }
131 return fault;
132 }
133}};
134
135//Outputs to decoder.cc
136output decoder {{
137 std::string IntOp::generateDisassembly(Addr pc, const SymbolTable *symtab) const
138 {
139 std::stringstream ss;
140
141 ccprintf(ss, "%-10s ", mnemonic);
142

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

176 if (_numSrcRegs > 1) {
177 ss << ", ";
178 printReg(ss, _srcRegIdx[1]);
179 }
180
181 return ss.str();
182 }
183
184 std::string HiLoMiscOp::generateDisassembly(Addr pc, const SymbolTable *symtab) const
185 {
186 std::stringstream ss;
187
188 ccprintf(ss, "%-10s ", mnemonic);
189
190 if (_numDestRegs > 0 && _destRegIdx[0] < 32) {
191 printReg(ss, _destRegIdx[0]);
192 } else if (_numSrcRegs > 0 && _srcRegIdx[0] < 32) {
193 printReg(ss, _srcRegIdx[0]);
194 }
195
196 return ss.str();
197 }
198
199 std::string IntImmOp::generateDisassembly(Addr pc, const SymbolTable *symtab) const
200 {
201 std::stringstream ss;
202
203 ccprintf(ss, "%-10s ", mnemonic);
204
205 if (_numDestRegs > 0) {
206 printReg(ss, _destRegIdx[0]);

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

234def format IntImmOp(code, *opt_flags) {{
235 iop = InstObjParams(name, Name, 'IntImmOp', code, opt_flags)
236 header_output = BasicDeclare.subst(iop)
237 decoder_output = BasicConstructor.subst(iop)
238 decode_block = ImmNopCheckDecode.subst(iop)
239 exec_output = BasicExecute.subst(iop)
240}};
241
242def format HiLoOp(code, *opt_flags) {{
243 code += 'HI = val<63:32>;\n'
244 code += 'LO = val<31:0>;\n'
245
246 iop = InstObjParams(name, Name, 'HiLoOp', code, opt_flags)
247 header_output = BasicDeclare.subst(iop)
248 decoder_output = BasicConstructor.subst(iop)
249 decode_block = BasicDecode.subst(iop)
250 exec_output = HiLoExecute.subst(iop)
251}};
252
253def format HiLoMiscOp(code, *opt_flags) {{
254 iop = InstObjParams(name, Name, 'HiLoMiscOp', code, opt_flags)
255 header_output = BasicDeclare.subst(iop)
256 decoder_output = BasicConstructor.subst(iop)
257 decode_block = BasicDecode.subst(iop)
258 exec_output = BasicExecute.subst(iop)
259}};
260
261
262
263
264