util.isa revision 2100
1// -*- mode:c++ -*-
2
3let {{
4def UncondCtrlBase(name, Name, base_class, npc_expr, flags):
5    # Declare basic control transfer w/o link (i.e. link reg is R31)
6    nolink_code = 'NPC = %s;\n' % npc_expr
7    nolink_iop = InstObjParams(name, Name, base_class,
8                               CodeBlock(nolink_code), flags)
9    header_output = BasicDeclare.subst(nolink_iop)
10    decoder_output = BasicConstructor.subst(nolink_iop)
11    exec_output = BasicExecute.subst(nolink_iop)
12
13    # Generate declaration of '*AndLink' version, append to decls
14    link_code = 'Ra = NPC & ~3;\n' + nolink_code
15    link_iop = InstObjParams(name, Name + 'AndLink', base_class,
16                             CodeBlock(link_code), flags)
17    header_output += BasicDeclare.subst(link_iop)
18    decoder_output += BasicConstructor.subst(link_iop)
19    exec_output += BasicExecute.subst(link_iop)
20
21    # need to use link_iop for the decode template since it is expecting
22    # the shorter version of class_name (w/o "AndLink")
23
24    return (header_output, decoder_output,
25            JumpOrBranchDecode.subst(nolink_iop), exec_output)
26}};
27