branch.isa (2680:246e7104f744) branch.isa (3953:300d526414e6)
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

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

213def template JumpOrBranchDecode {{
214 return (RA == 31)
215 ? (StaticInst *)new %(class_name)s(machInst)
216 : (StaticInst *)new %(class_name)sAndLink(machInst);
217}};
218
219def format CondBranch(code) {{
220 code = 'bool cond;\n' + code + '\nif (cond) NPC = NPC + disp;\n';
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

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

213def template JumpOrBranchDecode {{
214 return (RA == 31)
215 ? (StaticInst *)new %(class_name)s(machInst)
216 : (StaticInst *)new %(class_name)sAndLink(machInst);
217}};
218
219def format CondBranch(code) {{
220 code = 'bool cond;\n' + code + '\nif (cond) NPC = NPC + disp;\n';
221 iop = InstObjParams(name, Name, 'Branch', CodeBlock(code),
221 iop = InstObjParams(name, Name, 'Branch', code,
222 ('IsDirectControl', 'IsCondControl'))
223 header_output = BasicDeclare.subst(iop)
224 decoder_output = BasicConstructor.subst(iop)
225 decode_block = BasicDecode.subst(iop)
226 exec_output = BasicExecute.subst(iop)
227}};
228
229let {{
230def UncondCtrlBase(name, Name, base_class, npc_expr, flags):
231 # Declare basic control transfer w/o link (i.e. link reg is R31)
232 nolink_code = 'NPC = %s;\n' % npc_expr
222 ('IsDirectControl', 'IsCondControl'))
223 header_output = BasicDeclare.subst(iop)
224 decoder_output = BasicConstructor.subst(iop)
225 decode_block = BasicDecode.subst(iop)
226 exec_output = BasicExecute.subst(iop)
227}};
228
229let {{
230def UncondCtrlBase(name, Name, base_class, npc_expr, flags):
231 # Declare basic control transfer w/o link (i.e. link reg is R31)
232 nolink_code = 'NPC = %s;\n' % npc_expr
233 nolink_iop = InstObjParams(name, Name, base_class,
234 CodeBlock(nolink_code), flags)
233 nolink_iop = InstObjParams(name, Name, base_class, nolink_code, flags)
235 header_output = BasicDeclare.subst(nolink_iop)
236 decoder_output = BasicConstructor.subst(nolink_iop)
237 exec_output = BasicExecute.subst(nolink_iop)
238
239 # Generate declaration of '*AndLink' version, append to decls
240 link_code = 'Ra = NPC & ~3;\n' + nolink_code
241 link_iop = InstObjParams(name, Name + 'AndLink', base_class,
234 header_output = BasicDeclare.subst(nolink_iop)
235 decoder_output = BasicConstructor.subst(nolink_iop)
236 exec_output = BasicExecute.subst(nolink_iop)
237
238 # Generate declaration of '*AndLink' version, append to decls
239 link_code = 'Ra = NPC & ~3;\n' + nolink_code
240 link_iop = InstObjParams(name, Name + 'AndLink', base_class,
242 CodeBlock(link_code), flags)
241 link_code, flags)
243 header_output += BasicDeclare.subst(link_iop)
244 decoder_output += BasicConstructor.subst(link_iop)
245 exec_output += BasicExecute.subst(link_iop)
246
247 # need to use link_iop for the decode template since it is expecting
248 # the shorter version of class_name (w/o "AndLink")
249
250 return (header_output, decoder_output,

--- 16 unchanged lines hidden ---
242 header_output += BasicDeclare.subst(link_iop)
243 decoder_output += BasicConstructor.subst(link_iop)
244 exec_output += BasicExecute.subst(link_iop)
245
246 # need to use link_iop for the decode template since it is expecting
247 # the shorter version of class_name (w/o "AndLink")
248
249 return (header_output, decoder_output,

--- 16 unchanged lines hidden ---