m5ops.isa revision 8607
111507SCurtis.Dunham@arm.com// 211507SCurtis.Dunham@arm.com// Copyright (c) 2010 ARM Limited 311960Sgabeblack@google.com// All rights reserved 411960Sgabeblack@google.com// 511960Sgabeblack@google.com// The license below extends only to copyright in the software and shall 611960Sgabeblack@google.com// not be construed as granting a license to any other intellectual 711960Sgabeblack@google.com// property including but not limited to intellectual property relating 811960Sgabeblack@google.com// to a hardware implementation of the functionality of the software 911960Sgabeblack@google.com// licensed hereunder. You may use the software subject to the license 1011960Sgabeblack@google.com// terms below provided that you ensure that this notice is replicated 1111960Sgabeblack@google.com// unmodified and in its entirety in all distributions of the software, 1211960Sgabeblack@google.com// modified or unmodified, in source code or in binary form. 1311960Sgabeblack@google.com// 1411960Sgabeblack@google.com// Redistribution and use in source and binary forms, with or without 1511960Sgabeblack@google.com// modification, are permitted provided that the following conditions are 1611960Sgabeblack@google.com// met: redistributions of source code must retain the above copyright 1711960Sgabeblack@google.com// notice, this list of conditions and the following disclaimer; 1811960Sgabeblack@google.com// redistributions in binary form must reproduce the above copyright 1911960Sgabeblack@google.com// notice, this list of conditions and the following disclaimer in the 2011960Sgabeblack@google.com// documentation and/or other materials provided with the distribution; 2111960Sgabeblack@google.com// neither the name of the copyright holders nor the names of its 2211960Sgabeblack@google.com// contributors may be used to endorse or promote products derived from 2311960Sgabeblack@google.com// this software without specific prior written permission. 2411960Sgabeblack@google.com// 2511960Sgabeblack@google.com// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 2611960Sgabeblack@google.com// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 2711960Sgabeblack@google.com// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 2811960Sgabeblack@google.com// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 2911960Sgabeblack@google.com// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 3011960Sgabeblack@google.com// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 3111960Sgabeblack@google.com// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 3211960Sgabeblack@google.com// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 3311960Sgabeblack@google.com// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 3411960Sgabeblack@google.com// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 3511960Sgabeblack@google.com// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 3611960Sgabeblack@google.com// 3711960Sgabeblack@google.com// Authors: Gene Wu 3811960Sgabeblack@google.com 3911960Sgabeblack@google.com 4011960Sgabeblack@google.comlet {{ 4111960Sgabeblack@google.com header_output = "" 4211960Sgabeblack@google.com decoder_output = ''' 4311960Sgabeblack@google.com uint64_t join32to64(uint32_t r1, uint32_t r0) 4411960Sgabeblack@google.com { 4511960Sgabeblack@google.com uint64_t r = r1; 4611960Sgabeblack@google.com r <<= 32; 4711960Sgabeblack@google.com r |= r0; 4811960Sgabeblack@google.com return r; 4911960Sgabeblack@google.com } 5011960Sgabeblack@google.com ''' 5111960Sgabeblack@google.com exec_output = ''' 5211960Sgabeblack@google.com uint64_t join32to64(uint32_t r1, uint32_t r0); 5311960Sgabeblack@google.com ''' 5411960Sgabeblack@google.com 5511960Sgabeblack@google.com 5611960Sgabeblack@google.com armCode = ''' 5711960Sgabeblack@google.com PseudoInst::arm(xc->tcBase()); 5811960Sgabeblack@google.com ''' 5911960Sgabeblack@google.com armIop = InstObjParams("arm", "Arm", "PredOp", 6011960Sgabeblack@google.com { "code": armCode, 6111960Sgabeblack@google.com "predicate_test": predicateTest }, 6211960Sgabeblack@google.com ["IsNonSpeculative"]) 6311960Sgabeblack@google.com header_output += BasicDeclare.subst(armIop) 6411960Sgabeblack@google.com decoder_output += BasicConstructor.subst(armIop) 6511960Sgabeblack@google.com exec_output += PredOpExecute.subst(armIop) 6611960Sgabeblack@google.com 6711960Sgabeblack@google.com quiesceCode = ''' 6811960Sgabeblack@google.com PseudoInst::quiesce(xc->tcBase()); 6911960Sgabeblack@google.com ''' 7011960Sgabeblack@google.com quiesceIop = InstObjParams("quiesce", "Quiesce", "PredOp", 7111960Sgabeblack@google.com { "code": quiesceCode, 7211960Sgabeblack@google.com "predicate_test": predicateTest }, 7311960Sgabeblack@google.com ["IsNonSpeculative", "IsQuiesce"]) 7411960Sgabeblack@google.com header_output += BasicDeclare.subst(quiesceIop) 7511960Sgabeblack@google.com decoder_output += BasicConstructor.subst(quiesceIop) 7611960Sgabeblack@google.com exec_output += QuiescePredOpExecute.subst(quiesceIop) 7711960Sgabeblack@google.com 7811960Sgabeblack@google.com quiesceNsCode = ''' 7911960Sgabeblack@google.com PseudoInst::quiesceNs(xc->tcBase(), join32to64(R1, R0)); 8011960Sgabeblack@google.com ''' 8111960Sgabeblack@google.com 8211960Sgabeblack@google.com quiesceNsIop = InstObjParams("quiesceNs", "QuiesceNs", "PredOp", 8311960Sgabeblack@google.com { "code": quiesceNsCode, 8411960Sgabeblack@google.com "predicate_test": predicateTest }, 8511960Sgabeblack@google.com ["IsNonSpeculative", "IsQuiesce"]) 8611960Sgabeblack@google.com header_output += BasicDeclare.subst(quiesceNsIop) 8711960Sgabeblack@google.com decoder_output += BasicConstructor.subst(quiesceNsIop) 8811960Sgabeblack@google.com exec_output += QuiescePredOpExecute.subst(quiesceNsIop) 8911960Sgabeblack@google.com 9011960Sgabeblack@google.com quiesceCyclesCode = ''' 9111960Sgabeblack@google.com PseudoInst::quiesceCycles(xc->tcBase(), join32to64(R1, R0)); 9211960Sgabeblack@google.com ''' 9311960Sgabeblack@google.com 9411960Sgabeblack@google.com quiesceCyclesIop = InstObjParams("quiesceCycles", "QuiesceCycles", "PredOp", 9511960Sgabeblack@google.com { "code": quiesceCyclesCode, 9611960Sgabeblack@google.com "predicate_test": predicateTest }, 9711960Sgabeblack@google.com ["IsNonSpeculative", "IsQuiesce", "IsUnverifiable"]) 9811960Sgabeblack@google.com header_output += BasicDeclare.subst(quiesceCyclesIop) 9911960Sgabeblack@google.com decoder_output += BasicConstructor.subst(quiesceCyclesIop) 10011960Sgabeblack@google.com exec_output += QuiescePredOpExecute.subst(quiesceCyclesIop) 10111960Sgabeblack@google.com 10211960Sgabeblack@google.com quiesceTimeCode = ''' 10311960Sgabeblack@google.com uint64_t qt_val = PseudoInst::quiesceTime(xc->tcBase()); 10411960Sgabeblack@google.com R0 = bits(qt_val, 31, 0); 10511960Sgabeblack@google.com R1 = bits(qt_val, 63, 32); 10611960Sgabeblack@google.com ''' 10711960Sgabeblack@google.com 10811960Sgabeblack@google.com quiesceTimeIop = InstObjParams("quiesceTime", "QuiesceTime", "PredOp", 10911960Sgabeblack@google.com { "code": quiesceTimeCode, 11011960Sgabeblack@google.com "predicate_test": predicateTest }, 11111960Sgabeblack@google.com ["IsNonSpeculative", "IsUnverifiable"]) 11211960Sgabeblack@google.com header_output += BasicDeclare.subst(quiesceTimeIop) 11311960Sgabeblack@google.com decoder_output += BasicConstructor.subst(quiesceTimeIop) 11411960Sgabeblack@google.com exec_output += PredOpExecute.subst(quiesceTimeIop) 11511960Sgabeblack@google.com 11611960Sgabeblack@google.com rpnsCode = ''' 11711960Sgabeblack@google.com uint64_t rpns_val = PseudoInst::rpns(xc->tcBase()); 11811960Sgabeblack@google.com R0 = bits(rpns_val, 31, 0); 11911960Sgabeblack@google.com R1 = bits(rpns_val, 63, 32); 12011960Sgabeblack@google.com ''' 12111960Sgabeblack@google.com 12211960Sgabeblack@google.com rpnsIop = InstObjParams("rpns", "Rpns", "PredOp", 12311960Sgabeblack@google.com { "code": rpnsCode, 12411960Sgabeblack@google.com "predicate_test": predicateTest }, 12511960Sgabeblack@google.com ["IsNonSpeculative", "IsUnverifiable"]) 12611960Sgabeblack@google.com header_output += BasicDeclare.subst(rpnsIop) 12711960Sgabeblack@google.com decoder_output += BasicConstructor.subst(rpnsIop) 12811960Sgabeblack@google.com exec_output += PredOpExecute.subst(rpnsIop) 12911960Sgabeblack@google.com 13011960Sgabeblack@google.com wakeCpuCode = ''' 13111960Sgabeblack@google.com PseudoInst::wakeCPU(xc->tcBase(), join32to64(R1,R0)); 13211960Sgabeblack@google.com ''' 13311960Sgabeblack@google.com 13411960Sgabeblack@google.com wakeCPUIop = InstObjParams("wakeCPU", "WakeCPU", "PredOp", 13511960Sgabeblack@google.com { "code": wakeCpuCode, 13611960Sgabeblack@google.com "predicate_test": predicateTest }, 13711960Sgabeblack@google.com ["IsNonSpeculative", "IsUnverifiable"]) 13811960Sgabeblack@google.com header_output += BasicDeclare.subst(wakeCPUIop) 13911960Sgabeblack@google.com decoder_output += BasicConstructor.subst(wakeCPUIop) 14011960Sgabeblack@google.com exec_output += PredOpExecute.subst(wakeCPUIop) 14111960Sgabeblack@google.com 14211960Sgabeblack@google.com deprecated_ivlbIop = InstObjParams("deprecated_ivlb", "Deprecated_ivlb", "PredOp", 14311960Sgabeblack@google.com { "code": '''warn_once("Obsolete M5 ivlb instruction encountered.\\n");''', 14411507SCurtis.Dunham@arm.com "predicate_test": predicateTest }) 14511507SCurtis.Dunham@arm.com header_output += BasicDeclare.subst(deprecated_ivlbIop) 146 decoder_output += BasicConstructor.subst(deprecated_ivlbIop) 147 exec_output += PredOpExecute.subst(deprecated_ivlbIop) 148 149 deprecated_ivleIop = InstObjParams("deprecated_ivle", "Deprecated_ivle", "PredOp", 150 { "code": '''warn_once("Obsolete M5 ivle instruction encountered.\\n");''', 151 "predicate_test": predicateTest }) 152 header_output += BasicDeclare.subst(deprecated_ivleIop) 153 decoder_output += BasicConstructor.subst(deprecated_ivleIop) 154 exec_output += PredOpExecute.subst(deprecated_ivleIop) 155 156 deprecated_exit_code = ''' 157 warn_once("Obsolete M5 exit instruction encountered.\\n"); 158 PseudoInst::m5exit(xc->tcBase(), 0); 159 ''' 160 161 deprecated_exitIop = InstObjParams("deprecated_exit", "Deprecated_exit", "PredOp", 162 { "code": deprecated_exit_code, 163 "predicate_test": predicateTest }, 164 ["No_OpClass", "IsNonSpeculative"]) 165 header_output += BasicDeclare.subst(deprecated_exitIop) 166 decoder_output += BasicConstructor.subst(deprecated_exitIop) 167 exec_output += PredOpExecute.subst(deprecated_exitIop) 168 169 m5exit_code = ''' 170 PseudoInst::m5exit(xc->tcBase(), join32to64(R1, R0)); 171 ''' 172 m5exitIop = InstObjParams("m5exit", "M5exit", "PredOp", 173 { "code": m5exit_code, 174 "predicate_test": predicateTest }, 175 ["No_OpClass", "IsNonSpeculative"]) 176 header_output += BasicDeclare.subst(m5exitIop) 177 decoder_output += BasicConstructor.subst(m5exitIop) 178 exec_output += PredOpExecute.subst(m5exitIop) 179 180 loadsymbolCode = ''' 181 PseudoInst::loadsymbol(xc->tcBase()); 182 ''' 183 184 loadsymbolIop = InstObjParams("loadsymbol", "Loadsymbol", "PredOp", 185 { "code": loadsymbolCode, 186 "predicate_test": predicateTest }, 187 ["No_OpClass", "IsNonSpeculative"]) 188 header_output += BasicDeclare.subst(loadsymbolIop) 189 decoder_output += BasicConstructor.subst(loadsymbolIop) 190 exec_output += PredOpExecute.subst(loadsymbolIop) 191 192 initparamCode = ''' 193#if FULL_SYSTEM 194 Rt = PseudoInst::initParam(xc->tcBase()); 195#else 196 PseudoInst::panicFsOnlyPseudoInst("initparam"); 197 Rt = 0; 198#endif 199 ''' 200 201 initparamIop = InstObjParams("initparam", "Initparam", "PredOp", 202 { "code": initparamCode, 203 "predicate_test": predicateTest }) 204 header_output += BasicDeclare.subst(initparamIop) 205 decoder_output += BasicConstructor.subst(initparamIop) 206 exec_output += PredOpExecute.subst(initparamIop) 207 208 resetstats_code = ''' 209 PseudoInst::resetstats(xc->tcBase(), join32to64(R1, R0), join32to64(R3, R2)); 210 ''' 211 212 resetstatsIop = InstObjParams("resetstats", "Resetstats", "PredOp", 213 { "code": resetstats_code, 214 "predicate_test": predicateTest }, 215 ["IsNonSpeculative"]) 216 header_output += BasicDeclare.subst(resetstatsIop) 217 decoder_output += BasicConstructor.subst(resetstatsIop) 218 exec_output += PredOpExecute.subst(resetstatsIop) 219 220 dumpstats_code = ''' 221 PseudoInst::dumpstats(xc->tcBase(), join32to64(R1, R0), join32to64(R3, R2)); 222 ''' 223 dumpstatsIop = InstObjParams("dumpstats", "Dumpstats", "PredOp", 224 { "code": dumpstats_code, 225 "predicate_test": predicateTest }, 226 ["IsNonSpeculative"]) 227 header_output += BasicDeclare.subst(dumpstatsIop) 228 decoder_output += BasicConstructor.subst(dumpstatsIop) 229 exec_output += PredOpExecute.subst(dumpstatsIop) 230 231 dumpresetstats_code = ''' 232 PseudoInst::dumpresetstats(xc->tcBase(), join32to64(R1, R0), join32to64(R3, R2)); 233 ''' 234 dumpresetstatsIop = InstObjParams("dumpresetstats", "Dumpresetstats", "PredOp", 235 { "code": dumpresetstats_code, 236 "predicate_test": predicateTest }, 237 ["IsNonSpeculative"]) 238 header_output += BasicDeclare.subst(dumpresetstatsIop) 239 decoder_output += BasicConstructor.subst(dumpresetstatsIop) 240 exec_output += PredOpExecute.subst(dumpresetstatsIop) 241 242 m5checkpoint_code = ''' 243 PseudoInst::m5checkpoint(xc->tcBase(), join32to64(R1, R0), join32to64(R3, R2)); 244 ''' 245 m5checkpointIop = InstObjParams("m5checkpoint", "M5checkpoint", "PredOp", 246 { "code": m5checkpoint_code, 247 "predicate_test": predicateTest }, 248 ["IsNonSpeculative"]) 249 header_output += BasicDeclare.subst(m5checkpointIop) 250 decoder_output += BasicConstructor.subst(m5checkpointIop) 251 exec_output += PredOpExecute.subst(m5checkpointIop) 252 253 m5readfileCode = ''' 254 int n = 4; 255 uint64_t offset = getArgument(xc->tcBase(), n, sizeof(uint64_t), false); 256 R0 = PseudoInst::readfile(xc->tcBase(), R0, join32to64(R3,R2), offset); 257 ''' 258 m5readfileIop = InstObjParams("m5readfile", "M5readfile", "PredOp", 259 { "code": m5readfileCode, 260 "predicate_test": predicateTest }, 261 ["IsNonSpeculative"]) 262 header_output += BasicDeclare.subst(m5readfileIop) 263 decoder_output += BasicConstructor.subst(m5readfileIop) 264 exec_output += PredOpExecute.subst(m5readfileIop) 265 266 m5breakIop = InstObjParams("m5break", "M5break", "PredOp", 267 { "code": "PseudoInst::debugbreak(xc->tcBase());", 268 "predicate_test": predicateTest }, 269 ["IsNonSpeculative"]) 270 header_output += BasicDeclare.subst(m5breakIop) 271 decoder_output += BasicConstructor.subst(m5breakIop) 272 exec_output += PredOpExecute.subst(m5breakIop) 273 274 m5switchcpuIop = InstObjParams("m5switchcpu", "M5switchcpu", "PredOp", 275 { "code": "PseudoInst::switchcpu(xc->tcBase());", 276 "predicate_test": predicateTest }, 277 ["IsNonSpeculative"]) 278 header_output += BasicDeclare.subst(m5switchcpuIop) 279 decoder_output += BasicConstructor.subst(m5switchcpuIop) 280 exec_output += PredOpExecute.subst(m5switchcpuIop) 281 282 m5addsymbolCode = ''' 283 PseudoInst::addsymbol(xc->tcBase(), join32to64(R1, R0), R2); 284 ''' 285 m5addsymbolIop = InstObjParams("m5addsymbol", "M5addsymbol", "PredOp", 286 { "code": m5addsymbolCode, 287 "predicate_test": predicateTest }, 288 ["IsNonSpeculative"]) 289 header_output += BasicDeclare.subst(m5addsymbolIop) 290 decoder_output += BasicConstructor.subst(m5addsymbolIop) 291 exec_output += PredOpExecute.subst(m5addsymbolIop) 292 293 m5panicCode = '''panic("M5 panic instruction called at pc=%#x.", 294 xc->pcState().pc());''' 295 m5panicIop = InstObjParams("m5panic", "M5panic", "PredOp", 296 { "code": m5panicCode, 297 "predicate_test": predicateTest }, 298 ["IsNonSpeculative"]) 299 header_output += BasicDeclare.subst(m5panicIop) 300 decoder_output += BasicConstructor.subst(m5panicIop) 301 exec_output += PredOpExecute.subst(m5panicIop) 302 303 m5workbeginCode = '''PseudoInst::workbegin( 304 xc->tcBase(), 305 join32to64(R1, R0), 306 join32to64(R3, R2) 307 );''' 308 m5workbeginIop = InstObjParams("m5workbegin", "M5workbegin", "PredOp", 309 { "code": m5workbeginCode, 310 "predicate_test": predicateTest }, 311 ["IsNonSpeculative"]) 312 header_output += BasicDeclare.subst(m5workbeginIop) 313 decoder_output += BasicConstructor.subst(m5workbeginIop) 314 exec_output += PredOpExecute.subst(m5workbeginIop) 315 316 m5workendCode = '''PseudoInst::workend( 317 xc->tcBase(), 318 join32to64(R1, R0), 319 join32to64(R3, R2) 320 );''' 321 m5workendIop = InstObjParams("m5workend", "M5workend", "PredOp", 322 { "code": m5workendCode, 323 "predicate_test": predicateTest }, 324 ["IsNonSpeculative"]) 325 header_output += BasicDeclare.subst(m5workendIop) 326 decoder_output += BasicConstructor.subst(m5workendIop) 327 exec_output += PredOpExecute.subst(m5workendIop) 328 329}}; 330