swap.isa (4412:e6e98db4f373) swap.isa (4648:173a212f5091)
1// Copyright (c) 2007 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

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

34 {
35 Fault fault = NoFault;
36 //This is to support the conditional store in cas instructions.
37 //It should be optomized out in all the others
38 bool storeCond = true;
39 Addr EA;
40 %(fp_enable_check)s;
41 %(op_decl)s;
1// Copyright (c) 2007 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

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

34 {
35 Fault fault = NoFault;
36 //This is to support the conditional store in cas instructions.
37 //It should be optomized out in all the others
38 bool storeCond = true;
39 Addr EA;
40 %(fp_enable_check)s;
41 %(op_decl)s;
42 uint64_t mem_data = 0;
42 uint64_t mem_data;
43
44 %(op_rd)s;
45 %(ea_code)s;
46 DPRINTF(Sparc, "%s: The address is 0x%x\n", mnemonic, EA);
47 %(fault_check)s;
48 if(fault == NoFault)
49 {
50 %(code)s;
51 }
52 if(storeCond && fault == NoFault)
53 {
43
44 %(op_rd)s;
45 %(ea_code)s;
46 DPRINTF(Sparc, "%s: The address is 0x%x\n", mnemonic, EA);
47 %(fault_check)s;
48 if(fault == NoFault)
49 {
50 %(code)s;
51 }
52 if(storeCond && fault == NoFault)
53 {
54 %(EA_trunc)s
54 fault = xc->write((uint%(mem_acc_size)s_t)Mem,
55 EA, %(asi_val)s, &mem_data);
56 }
57 if(fault == NoFault)
58 {
59 //Handle the swapping
60 %(postacc_code)s;
61 }

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

86 %(fault_check)s;
87
88 if(fault == NoFault)
89 {
90 %(code)s;
91 }
92 if(fault == NoFault)
93 {
55 fault = xc->write((uint%(mem_acc_size)s_t)Mem,
56 EA, %(asi_val)s, &mem_data);
57 }
58 if(fault == NoFault)
59 {
60 //Handle the swapping
61 %(postacc_code)s;
62 }

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

87 %(fault_check)s;
88
89 if(fault == NoFault)
90 {
91 %(code)s;
92 }
93 if(fault == NoFault)
94 {
95 %(EA_trunc)s
94 fault = xc->write((uint%(mem_acc_size)s_t)Mem,
95 EA, %(asi_val)s, &mem_data);
96 }
97 return fault;
98 }
99}};
100
101

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

152}};
153
154
155let {{
156 def doCasFormat(code, execute, faultCode, name, Name, asi, opt_flags, postacc_code = ''):
157 addrCalcReg = 'EA = Rs1;'
158 iop = InstObjParams(name, Name, 'Mem',
159 {"code": code, "postacc_code" : postacc_code,
96 fault = xc->write((uint%(mem_acc_size)s_t)Mem,
97 EA, %(asi_val)s, &mem_data);
98 }
99 return fault;
100 }
101}};
102
103

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

154}};
155
156
157let {{
158 def doCasFormat(code, execute, faultCode, name, Name, asi, opt_flags, postacc_code = ''):
159 addrCalcReg = 'EA = Rs1;'
160 iop = InstObjParams(name, Name, 'Mem',
161 {"code": code, "postacc_code" : postacc_code,
160 "fault_check": faultCode, "ea_code": addrCalcReg}, opt_flags)
162 "fault_check": faultCode, "ea_code": addrCalcReg,
163 "EA_trunc" : TruncateEA}, opt_flags)
161 header_output = MemDeclare.subst(iop)
162 decoder_output = BasicConstructor.subst(iop)
163 decode_block = BasicDecode.subst(iop)
164 microParams = {"code": code, "postacc_code" : postacc_code,
164 header_output = MemDeclare.subst(iop)
165 decoder_output = BasicConstructor.subst(iop)
166 decode_block = BasicDecode.subst(iop)
167 microParams = {"code": code, "postacc_code" : postacc_code,
165 "ea_code" : addrCalcReg, "fault_check" : faultCode}
168 "ea_code" : addrCalcReg, "fault_check" : faultCode,
169 "EA_trunc" : TruncateEA}
166 exec_output = doSplitExecute(execute, name, Name, asi,
167 ["IsStoreConditional"], microParams);
168 return (header_output, decoder_output, exec_output, decode_block)
169}};
170
171
172def format CasAlt(code, postacc_code, asi, mem_flags, *opt_flags) {{
173 mem_flags = makeList(mem_flags)
174 mem_flags.append(asi)
175 flags = string.join(mem_flags, '|')
176 (header_output,
177 decoder_output,
178 exec_output,
179 decode_block) = doCasFormat(code, SwapFuncs, AlternateASIPrivFaultCheck,
180 name, Name, flags, ["IsStoreConditional"], postacc_code)
181}};
182
183
170 exec_output = doSplitExecute(execute, name, Name, asi,
171 ["IsStoreConditional"], microParams);
172 return (header_output, decoder_output, exec_output, decode_block)
173}};
174
175
176def format CasAlt(code, postacc_code, asi, mem_flags, *opt_flags) {{
177 mem_flags = makeList(mem_flags)
178 mem_flags.append(asi)
179 flags = string.join(mem_flags, '|')
180 (header_output,
181 decoder_output,
182 exec_output,
183 decode_block) = doCasFormat(code, SwapFuncs, AlternateASIPrivFaultCheck,
184 name, Name, flags, ["IsStoreConditional"], postacc_code)
185}};
186
187