util.isa revision 2100
14776SN/A// -*- mode:c++ -*-
26365SN/A
34776SN/Alet {{
44776SN/Adef UncondCtrlBase(name, Name, base_class, npc_expr, flags):
54776SN/A    # Declare basic control transfer w/o link (i.e. link reg is R31)
64776SN/A    nolink_code = 'NPC = %s;\n' % npc_expr
74776SN/A    nolink_iop = InstObjParams(name, Name, base_class,
84776SN/A                               CodeBlock(nolink_code), flags)
94776SN/A    header_output = BasicDeclare.subst(nolink_iop)
104776SN/A    decoder_output = BasicConstructor.subst(nolink_iop)
114776SN/A    exec_output = BasicExecute.subst(nolink_iop)
124776SN/A
134776SN/A    # Generate declaration of '*AndLink' version, append to decls
144776SN/A    link_code = 'Ra = NPC & ~3;\n' + nolink_code
154776SN/A    link_iop = InstObjParams(name, Name + 'AndLink', base_class,
164776SN/A                             CodeBlock(link_code), flags)
174776SN/A    header_output += BasicDeclare.subst(link_iop)
184776SN/A    decoder_output += BasicConstructor.subst(link_iop)
194776SN/A    exec_output += BasicExecute.subst(link_iop)
204776SN/A
214776SN/A    # need to use link_iop for the decode template since it is expecting
224776SN/A    # the shorter version of class_name (w/o "AndLink")
234776SN/A
244776SN/A    return (header_output, decoder_output,
254776SN/A            JumpOrBranchDecode.subst(nolink_iop), exec_output)
264776SN/A}};
274776SN/A