basic.isa (2632:1bb2f91485ea) basic.isa (2686:f0d591379ac3)
1// -*- mode:c++ -*-
2
3// Declarations for execute() methods.
4def template BasicExecDeclare {{
5 Fault execute(%(CPU_exec_context)s *, Trace::InstRecord *) const;
6}};
7
8// Basic instruction class declaration template.
9def template BasicDeclare {{
10 /**
11 * Static instruction class for "%(mnemonic)s".
12 */
13 class %(class_name)s : public %(base_class)s
14 {
1// -*- mode:c++ -*-
2
3// Declarations for execute() methods.
4def template BasicExecDeclare {{
5 Fault execute(%(CPU_exec_context)s *, Trace::InstRecord *) const;
6}};
7
8// Basic instruction class declaration template.
9def template BasicDeclare {{
10 /**
11 * Static instruction class for "%(mnemonic)s".
12 */
13 class %(class_name)s : public %(base_class)s
14 {
15 public:
15 public:
16 /// Constructor.
17 %(class_name)s(MachInst machInst);
18 %(BasicExecDeclare)s
16 /// Constructor.
17 %(class_name)s(MachInst machInst);
18 %(BasicExecDeclare)s
19 };
19 };
20}};
21
22// Basic instruction class constructor template.
23def template BasicConstructor {{
24 inline %(class_name)s::%(class_name)s(MachInst machInst) : %(base_class)s("%(mnemonic)s", machInst, %(op_class)s)
25 {
26 %(constructor)s;
27 }
28}};
29
20}};
21
22// Basic instruction class constructor template.
23def template BasicConstructor {{
24 inline %(class_name)s::%(class_name)s(MachInst machInst) : %(base_class)s("%(mnemonic)s", machInst, %(op_class)s)
25 {
26 %(constructor)s;
27 }
28}};
29
30
30// Basic instruction class execute method template.
31def template BasicExecute {{
32 Fault %(class_name)s::execute(%(CPU_exec_context)s *xc, Trace::InstRecord *traceData) const
33 {
34 Fault fault = NoFault;
35
36 %(fp_enable_check)s;
37 %(op_decl)s;
38 %(op_rd)s;
39 %(code)s;
40
41 if(fault == NoFault)
42 {
43 %(op_wb)s;
44 }
45 return fault;
46 }
47}};
48
49// Basic decode template.
50def template BasicDecode {{
51 return new %(class_name)s(machInst);
52}};
53
54// Basic decode template, passing mnemonic in as string arg to constructor.
55def template BasicDecodeWithMnemonic {{
56 return new %(class_name)s("%(mnemonic)s", machInst);
57}};
58
59// The most basic instruction format... used only for a few misc. insts
60def format BasicOp(code, *flags) {{
61 iop = InstObjParams(name, Name, 'MipsStaticInst', CodeBlock(code), flags)
62 header_output = BasicDeclare.subst(iop)
63 decoder_output = BasicConstructor.subst(iop)
64 decode_block = BasicDecode.subst(iop)
65 exec_output = BasicExecute.subst(iop)
66}};
31// Basic instruction class execute method template.
32def template BasicExecute {{
33 Fault %(class_name)s::execute(%(CPU_exec_context)s *xc, Trace::InstRecord *traceData) const
34 {
35 Fault fault = NoFault;
36
37 %(fp_enable_check)s;
38 %(op_decl)s;
39 %(op_rd)s;
40 %(code)s;
41
42 if(fault == NoFault)
43 {
44 %(op_wb)s;
45 }
46 return fault;
47 }
48}};
49
50// Basic decode template.
51def template BasicDecode {{
52 return new %(class_name)s(machInst);
53}};
54
55// Basic decode template, passing mnemonic in as string arg to constructor.
56def template BasicDecodeWithMnemonic {{
57 return new %(class_name)s("%(mnemonic)s", machInst);
58}};
59
60// The most basic instruction format... used only for a few misc. insts
61def format BasicOp(code, *flags) {{
62 iop = InstObjParams(name, Name, 'MipsStaticInst', CodeBlock(code), flags)
63 header_output = BasicDeclare.subst(iop)
64 decoder_output = BasicConstructor.subst(iop)
65 decode_block = BasicDecode.subst(iop)
66 exec_output = BasicExecute.subst(iop)
67}};