Deleted Added
sdiff udiff text old ( 3951:727778d649ae ) 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

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

31////////////////////////////////////////////////////////////////////
32//
33// Control transfer instructions
34//
35
36output header {{
37
38#include <iostream>
39
40 /**
41 * Base class for instructions whose disassembly is not purely a
42 * function of the machine instruction (i.e., it depends on the
43 * PC). This class overrides the disassemble() method to check
44 * the PC and symbol table values before re-using a cached
45 * disassembly string. This is necessary for branches and jumps,
46 * where the disassembly string includes the target address (which

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

211 ss << ", ";
212 printReg(ss, _srcRegIdx[1]);
213 }
214
215 return ss.str();
216 }
217}};
218
219def format Branch(code,*opt_flags) {{
220 not_taken_code = ' NNPC = NNPC;\n'
221 not_taken_code += '} \n'
222
223 #Build Instruction Flags
224 #Use Link & Likely Flags to Add Link/Condition Code
225 inst_flags = ('IsDirectControl', )
226 for x in opt_flags:
227 if x == 'Link':
228 code += 'R31 = NNPC;\n'
229 elif x == 'Likely':
230 not_taken_code = ' NPC = NNPC;\n'
231 not_taken_code += ' NNPC = NNPC + 4;\n'
232 not_taken_code += '} \n'
233 inst_flags = ('IsCondDelaySlot', )
234 else:
235 inst_flags += (x, )
236
237 #Take into account uncond. branch instruction
238 if 'cond == 1' in code:
239 inst_flags += ('IsUnCondControl', )
240 else:
241 inst_flags += ('IsCondControl', )
242
243 #Condition code
244 code = 'bool cond;\n' + code
245 code += 'if (cond) {\n'
246 code += ' NNPC = NPC + disp;\n'
247 code += '} else {\n'
248 code += not_taken_code
249
250 iop = InstObjParams(name, Name, 'Branch', code, inst_flags)
251 header_output = BasicDeclare.subst(iop)
252 decoder_output = BasicConstructor.subst(iop)
253 decode_block = BasicDecode.subst(iop)
254 exec_output = BasicExecute.subst(iop)
255}};
256
257def format Jump(code, *opt_flags) {{
258 #Build Instruction Flags
259 #Use Link Flag to Add Link Code
260 inst_flags = ('IsIndirectControl', 'IsUncondControl')
261 for x in opt_flags:
262 if x == 'Link':
263 code = 'R31 = NNPC;\n' + code
264 elif x == 'ClearHazards':

--- 14 unchanged lines hidden ---