util.isa (3439:b35c5f0ff57b) util.isa (3441:24b9d6cbad0d)
1// Copyright (c) 2006 The Regents of The University of Michigan
2// All rights reserved.
3//
4// Redistribution and use in source and binary forms, with or without
5// modification, are permitted provided that the following conditions are
6// met: redistributions of source code must retain the above copyright
7// notice, this list of conditions and the following disclaimer;
8// redistributions in binary form must reproduce the above copyright

--- 19 unchanged lines hidden (view full) ---

28// Gabe Black
29// Steve Reinhardt
30
31////////////////////////////////////////////////////////////////////
32//
33// Mem utility templates and functions
34//
35
1// Copyright (c) 2006 The Regents of The University of Michigan
2// All rights reserved.
3//
4// Redistribution and use in source and binary forms, with or without
5// modification, are permitted provided that the following conditions are
6// met: redistributions of source code must retain the above copyright
7// notice, this list of conditions and the following disclaimer;
8// redistributions in binary form must reproduce the above copyright

--- 19 unchanged lines hidden (view full) ---

28// Gabe Black
29// Steve Reinhardt
30
31////////////////////////////////////////////////////////////////////
32//
33// Mem utility templates and functions
34//
35
36output header {{
37 /**
38 * Base class for memory operations.
39 */
40 class Mem : public SparcStaticInst
41 {
42 protected:
43
44 // Constructor
45 Mem(const char *mnem, ExtMachInst _machInst, OpClass __opClass) :
46 SparcStaticInst(mnem, _machInst, __opClass)
47 {
48 }
49
50 std::string generateDisassembly(Addr pc,
51 const SymbolTable *symtab) const;
52 };
53
54 /**
55 * Class for memory operations which use an immediate offset.
56 */
57 class MemImm : public Mem
58 {
59 protected:
60
61 // Constructor
62 MemImm(const char *mnem, ExtMachInst _machInst, OpClass __opClass) :
63 Mem(mnem, _machInst, __opClass), imm(sext<13>(SIMM13))
64 {}
65
66 std::string generateDisassembly(Addr pc,
67 const SymbolTable *symtab) const;
68
69 const int32_t imm;
70 };
71}};
72
73output decoder {{
74 std::string Mem::generateDisassembly(Addr pc,
75 const SymbolTable *symtab) const
76 {
77 std::stringstream response;
78 bool load = flags[IsLoad];
79 bool save = flags[IsStore];
80
81 printMnemonic(response, mnemonic);
82 if(save)
83 {
84 printReg(response, _srcRegIdx[0]);
85 ccprintf(response, ", ");
86 }
87 ccprintf(response, "[ ");
88 printReg(response, _srcRegIdx[!save ? 0 : 1]);
89 ccprintf(response, " + ");
90 printReg(response, _srcRegIdx[!save ? 1 : 2]);
91 ccprintf(response, " ]");
92 if(load)
93 {
94 ccprintf(response, ", ");
95 printReg(response, _destRegIdx[0]);
96 }
97
98 return response.str();
99 }
100
101 std::string MemImm::generateDisassembly(Addr pc,
102 const SymbolTable *symtab) const
103 {
104 std::stringstream response;
105 bool load = flags[IsLoad];
106 bool save = flags[IsStore];
107
108 printMnemonic(response, mnemonic);
109 if(save)
110 {
111 printReg(response, _srcRegIdx[0]);
112 ccprintf(response, ", ");
113 }
114 ccprintf(response, "[ ");
115 printReg(response, _srcRegIdx[!save ? 0 : 1]);
116 if(imm >= 0)
117 ccprintf(response, " + 0x%x ]", imm);
118 else
119 ccprintf(response, " + -0x%x ]", -imm);
120 if(load)
121 {
122 ccprintf(response, ", ");
123 printReg(response, _destRegIdx[0]);
124 }
125
126 return response.str();
127 }
128}};
129
36//This template provides the execute functions for a load
37def template LoadExecute {{
38 Fault %(class_name)s::execute(%(CPU_exec_context)s *xc,
39 Trace::InstRecord *traceData) const
40 {
41 Fault fault = NoFault;
42 Addr EA;
43 %(op_decl)s;

--- 193 unchanged lines hidden ---
130//This template provides the execute functions for a load
131def template LoadExecute {{
132 Fault %(class_name)s::execute(%(CPU_exec_context)s *xc,
133 Trace::InstRecord *traceData) const
134 {
135 Fault fault = NoFault;
136 Addr EA;
137 %(op_decl)s;

--- 193 unchanged lines hidden ---