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', 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 |
233 nolink_iop = InstObjParams(name, Name, base_class, nolink_code, flags) |
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, |
241 link_code, flags) |
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 --- |