Deleted Added
sdiff udiff text old ( 7720:65d338a8dba4 ) new ( 7794:8a7ba5a1b35d )
full compact
1// -*- mode:c++ -*-
2
3// Copyright (c) 2003-2005 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

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

216 ? (StaticInst *)new %(class_name)s(machInst)
217 : (StaticInst *)new %(class_name)sAndLink(machInst);
218}};
219
220def format CondBranch(code) {{
221 code = '''
222 bool cond;
223 %(code)s;
224 if (cond)
225 NPC = NPC + disp;
226 else
227 NPC = NPC;
228 ''' % { "code" : code }
229 iop = InstObjParams(name, Name, 'Branch', code,
230 ('IsDirectControl', 'IsCondControl'))
231 header_output = BasicDeclare.subst(iop)
232 decoder_output = BasicConstructor.subst(iop)
233 decode_block = BasicDecode.subst(iop)
234 exec_output = BasicExecute.subst(iop)
235}};
236
237let {{
238def UncondCtrlBase(name, Name, base_class, npc_expr, flags):
239 # Declare basic control transfer w/o link (i.e. link reg is R31)
240 nolink_code = 'NPC = %s;\n' % npc_expr
241 nolink_iop = InstObjParams(name, Name, base_class,
242 nolink_code, flags)
243 header_output = BasicDeclare.subst(nolink_iop)
244 decoder_output = BasicConstructor.subst(nolink_iop)
245 exec_output = BasicExecute.subst(nolink_iop)
246
247 # Generate declaration of '*AndLink' version, append to decls
248 link_code = 'Ra = NPC & ~3;\n' + nolink_code
249 link_iop = InstObjParams(name, Name + 'AndLink', base_class,
250 link_code, flags)
251 header_output += BasicDeclare.subst(link_iop)
252 decoder_output += BasicConstructor.subst(link_iop)
253 exec_output += BasicExecute.subst(link_iop)
254
255 # need to use link_iop for the decode template since it is expecting
256 # the shorter version of class_name (w/o "AndLink")
257
258 return (header_output, decoder_output,
259 JumpOrBranchDecode.subst(nolink_iop), exec_output)
260}};
261
262def format UncondBranch(*flags) {{
263 flags += ('IsUncondControl', 'IsDirectControl')
264 (header_output, decoder_output, decode_block, exec_output) = \
265 UncondCtrlBase(name, Name, 'Branch', 'NPC + disp', flags)
266}};
267
268def format Jump(*flags) {{
269 flags += ('IsUncondControl', 'IsIndirectControl')
270 (header_output, decoder_output, decode_block, exec_output) = \
271 UncondCtrlBase(name, Name, 'Jump', '(Rb & ~3) | (NPC & 1)', flags)
272}};
273
274