noop.isa (2632:1bb2f91485ea) noop.isa (2686:f0d591379ac3)
1// -*- mode:c++ -*-
2
3////////////////////////////////////////////////////////////////////
4//
5// Nop
6//
7
8output header {{
9 /**
10 * Static instruction class for no-ops. This is a leaf class.
11 */
12 class Nop : public MipsStaticInst
13 {
14 /// Disassembly of original instruction.
15 const std::string originalDisassembly;
16
17 public:
18 /// Constructor
19 Nop(const std::string _originalDisassembly, MachInst _machInst)
20 : MipsStaticInst("nop", _machInst, No_OpClass),
21 originalDisassembly(_originalDisassembly)
22 {
23 flags[IsNop] = true;
24 }
25
26 ~Nop() { }
27
28 std::string
29 generateDisassembly(Addr pc, const SymbolTable *symtab) const;
30
31 %(BasicExecDeclare)s
32 };
33}};
34
35output decoder {{
36 std::string Nop::generateDisassembly(Addr pc,
37 const SymbolTable *symtab) const
38 {
1// -*- mode:c++ -*-
2
3////////////////////////////////////////////////////////////////////
4//
5// Nop
6//
7
8output header {{
9 /**
10 * Static instruction class for no-ops. This is a leaf class.
11 */
12 class Nop : public MipsStaticInst
13 {
14 /// Disassembly of original instruction.
15 const std::string originalDisassembly;
16
17 public:
18 /// Constructor
19 Nop(const std::string _originalDisassembly, MachInst _machInst)
20 : MipsStaticInst("nop", _machInst, No_OpClass),
21 originalDisassembly(_originalDisassembly)
22 {
23 flags[IsNop] = true;
24 }
25
26 ~Nop() { }
27
28 std::string
29 generateDisassembly(Addr pc, const SymbolTable *symtab) const;
30
31 %(BasicExecDeclare)s
32 };
33}};
34
35output decoder {{
36 std::string Nop::generateDisassembly(Addr pc,
37 const SymbolTable *symtab) const
38 {
39#ifdef SS_COMPATIBLE_DISASSEMBLY
40 return originalDisassembly;
41#else
42 return csprintf("%-10s (%s)", "nop", originalDisassembly);
43#endif
39 return csprintf("%-10s %s", "nop", originalDisassembly);
44 }
45
46 /// Helper function for decoding nops. Substitute Nop object
47 /// for original inst passed in as arg (and delete latter).
48 inline
49 MipsStaticInst *
50 makeNop(MipsStaticInst *inst)
51 {
52 MipsStaticInst *nop = new Nop(inst->disassemble(0), inst->machInst);
53 delete inst;
54 return nop;
55 }
56}};
57
58output exec {{
59 Fault
60 Nop::execute(%(CPU_exec_context)s *, Trace::InstRecord *) const
61 {
62 return NoFault;
63 }
64}};
65
66// integer & FP operate instructions use RT as dest, so check for
67// RT == 0 to detect nops
68def template OperateNopCheckDecode {{
69 {
70 MipsStaticInst *i = new %(class_name)s(machInst);
71
72 //if (RD == 0) {
73 // i = makeNop(i);
74 //}
75
76 return i;
77 }
78}};
79
80
81// Like BasicOperate format, but generates NOP if RC/FC == 31
82def format BasicOperateWithNopCheck(code, *opt_args) {{
83 iop = InstObjParams(name, Name, 'MipsStaticInst', CodeBlock(code),
84 opt_args)
85 header_output = BasicDeclare.subst(iop)
86 decoder_output = BasicConstructor.subst(iop)
87 decode_block = OperateNopCheckDecode.subst(iop)
88 exec_output = BasicExecute.subst(iop)
89}};
90
91def format Nop() {{
40 }
41
42 /// Helper function for decoding nops. Substitute Nop object
43 /// for original inst passed in as arg (and delete latter).
44 inline
45 MipsStaticInst *
46 makeNop(MipsStaticInst *inst)
47 {
48 MipsStaticInst *nop = new Nop(inst->disassemble(0), inst->machInst);
49 delete inst;
50 return nop;
51 }
52}};
53
54output exec {{
55 Fault
56 Nop::execute(%(CPU_exec_context)s *, Trace::InstRecord *) const
57 {
58 return NoFault;
59 }
60}};
61
62// integer & FP operate instructions use RT as dest, so check for
63// RT == 0 to detect nops
64def template OperateNopCheckDecode {{
65 {
66 MipsStaticInst *i = new %(class_name)s(machInst);
67
68 //if (RD == 0) {
69 // i = makeNop(i);
70 //}
71
72 return i;
73 }
74}};
75
76
77// Like BasicOperate format, but generates NOP if RC/FC == 31
78def format BasicOperateWithNopCheck(code, *opt_args) {{
79 iop = InstObjParams(name, Name, 'MipsStaticInst', CodeBlock(code),
80 opt_args)
81 header_output = BasicDeclare.subst(iop)
82 decoder_output = BasicConstructor.subst(iop)
83 decode_block = OperateNopCheckDecode.subst(iop)
84 exec_output = BasicExecute.subst(iop)
85}};
86
87def format Nop() {{
92 decode_block = 'return new Nop(\"sll r0,r0,0\",machInst);\n'
88 decode_block = 'return new Nop(\"\",machInst);\n'
93}};
94
89}};
90