3 // Alpha ISA description file.
21 #include "base/cprintf.hh"
22 #include "base/misc.hh"
23 #include "cpu/exec_context.hh"
24 #include "cpu/exetrace.hh"
25 #include "cpu/fast_cpu/fast_cpu.hh"
26 #include "cpu/full_cpu/dyn_inst.hh"
27 #include "cpu/simple_cpu/simple_cpu.hh"
28 #include "cpu/static_inst.hh"
29 #include "sim/annotation.hh"
30 #include "sim/sim_exit.hh"
33 #include "arch/alpha/ev5.hh"
34 #include "arch/alpha/pseudo_inst.hh"
39 // Universal (format-independent) fields
40 def bitfield OPCODE <31:26>;
41 def bitfield RA <25:21>;
42 def bitfield RB <20:16>;
45 def signed bitfield MEMDISP <15: 0>; // displacement
46 def bitfield MEMFUNC <15: 0>; // function code (same field, unsigned)
48 // Memory-format jumps
49 def bitfield JMPFUNC <15:14>; // function code (disp<15:14>)
50 def bitfield JMPHINT <13: 0>; // tgt Icache idx hint (disp<13:0>)
53 def signed bitfield BRDISP <20: 0>; // displacement
55 // Integer operate format(s>;
56 def bitfield INTIMM <20:13>; // integer immediate (literal)
57 def bitfield IMM <12:12>; // immediate flag
58 def bitfield INTFUNC <11: 5>; // function code
59 def bitfield RC < 4: 0>; // dest reg
61 // Floating-point operate format
62 def bitfield FA <25:21>;
63 def bitfield FB <20:16>;
64 def bitfield FP_FULLFUNC <15: 5>; // complete function code
65 def bitfield FP_TRAPMODE <15:13>; // trapping mode
66 def bitfield FP_ROUNDMODE <12:11>; // rounding mode
67 def bitfield FP_TYPEFUNC <10: 5>; // type+func: handiest for decoding
68 def bitfield FP_SRCTYPE <10: 9>; // source reg type
69 def bitfield FP_SHORTFUNC < 8: 5>; // short function code
70 def bitfield FP_SHORTFUNC_TOP2 <8:7>; // top 2 bits of short func code
71 def bitfield FC < 4: 0>; // dest reg
74 def bitfield PALFUNC <25: 0>; // function code
76 // EV5 PAL instructions:
78 def bitfield HW_LDST_PHYS <15>; // address is physical
79 def bitfield HW_LDST_ALT <14>; // use ALT_MODE IPR
80 def bitfield HW_LDST_WRTCK <13>; // HW_LD only: fault if no write acc
81 def bitfield HW_LDST_QUAD <12>; // size: 0=32b, 1=64b
82 def bitfield HW_LDST_VPTE <11>; // HW_LD only: is PTE fetch
83 def bitfield HW_LDST_LOCK <10>; // HW_LD only: is load locked
84 def bitfield HW_LDST_COND <10>; // HW_ST only: is store conditional
85 def signed bitfield HW_LDST_DISP <9:0>; // signed displacement
88 def bitfield HW_REI_TYP <15:14>; // type: stalling vs. non-stallingk
89 def bitfield HW_REI_MBZ <13: 0>; // must be zero
92 def bitfield HW_IPR_IDX <15:0>; // IPR index
95 def bitfield M5FUNC <7:0>;
100 'sb' : ('signed int', 8),
101 'ub' : ('unsigned int', 8),
102 'sw' : ('signed int', 16),
103 'uw' : ('unsigned int', 16),
104 'sl' : ('signed int', 32),
105 'ul' : ('unsigned int', 32),
106 'sq' : ('signed int', 64),
107 'uq' : ('unsigned int', 64),
108 'sf' : ('float', 32),
112 global operandTraitsMap
114 # Int regs default to unsigned, but code should not count on this.
115 # For clarity, descriptions that depend on unsigned behavior should
116 # explicitly specify '.uq'.
117 'Ra': IntRegOperandTraits('uq', 'RA', 'IsInteger', 1),
118 'Rb': IntRegOperandTraits('uq', 'RB', 'IsInteger', 2),
119 'Rc': IntRegOperandTraits('uq', 'RC', 'IsInteger', 3),
120 'Fa': FloatRegOperandTraits('df', 'FA', 'IsFloating', 1),
121 'Fb': FloatRegOperandTraits('df', 'FB', 'IsFloating', 2),
122 'Fc': FloatRegOperandTraits('df', 'FC', 'IsFloating', 3),
123 'Mem': MemOperandTraits('uq', None,
124 ('IsMemRef', 'IsLoad', 'IsStore'), 4),
125 'NPC': NPCOperandTraits('uq', None, ( None, None, 'IsControl' ), 4),
126 'Runiq': ControlRegOperandTraits('uq', 'Uniq', None, 1),
127 'FPCR': ControlRegOperandTraits('uq', 'Fpcr', None, 1),
128 # The next two are hacks for non-full-system call-pal emulation
129 'R0': IntRegOperandTraits('uq', '0', None, 1),
130 'R16': IntRegOperandTraits('uq', '16', None, 1),
133 defineDerivedOperandVars()
137 // just temporary, while comparing with old code for debugging
138 // #define SS_COMPATIBLE_DISASSEMBLY
140 /// Check "FP enabled" machine status bit. Called when executing any FP
141 /// instruction in full-system mode.
142 /// @retval Full-system mode: No_Fault if FP is enabled, Fen_Fault
143 /// if not. Non-full-system mode: always returns No_Fault.
146 inline Fault checkFpEnableFault(XC *xc)
148 Fault fault = No_Fault; // dummy... this ipr access should not fault
149 if (!ICSR_FPE(xc->readIpr(AlphaISA::IPR_ICSR, fault))) {
156 inline Fault checkFpEnableFault(XC *xc)
163 * Base class for all Alpha static instructions.
165 class AlphaStaticInst : public StaticInst<AlphaISA>
169 /// Make AlphaISA register dependence tags directly visible in
170 /// this class and derived classes. Maybe these should really
171 /// live here and not in the AlphaISA namespace.
172 enum DependenceTags {
173 FP_Base_DepTag = AlphaISA::FP_Base_DepTag,
174 Fpcr_DepTag = AlphaISA::Fpcr_DepTag,
175 Uniq_DepTag = AlphaISA::Uniq_DepTag,
176 IPR_Base_DepTag = AlphaISA::IPR_Base_DepTag
180 AlphaStaticInst(const char *mnem, MachInst _machInst,
182 : StaticInst<AlphaISA>(mnem, _machInst, __opClass)
186 /// Print a register name for disassembly given the unique
187 /// dependence tag number (FP or int).
188 void printReg(std::ostream &os, int reg)
190 if (reg < FP_Base_DepTag) {
191 ccprintf(os, "r%d", reg);
194 ccprintf(os, "f%d", reg - FP_Base_DepTag);
198 std::string generateDisassembly(Addr pc, const SymbolTable *symtab)
200 std::stringstream ss;
202 ccprintf(ss, "%-10s ", mnemonic);
204 // just print the first two source regs... if there's
205 // a third one, it's a read-modify-write dest (Rc),
207 if (_numSrcRegs > 0) {
208 printReg(ss, _srcRegIdx[0]);
210 if (_numSrcRegs > 1) {
212 printReg(ss, _srcRegIdx[1]);
215 // just print the first dest... if there's a second one,
216 // it's generally implicit
217 if (_numDestRegs > 0) {
220 printReg(ss, _destRegIdx[0]);
229 def template BasicDeclare {{
231 * Static instruction class for "%(mnemonic)s".
233 class %(class_name)s : public %(base_class)s
237 %(class_name)s(MachInst machInst)
238 : %(base_class)s("%(mnemonic)s", machInst, %(op_class)s)
243 %(exec_func_declarations)s
247 def template BasicExecute {{
248 Fault %(class_name)s::execute(%(cpu_model)s *xc,
249 Trace::InstRecord *traceData)
251 Fault fault = No_Fault;
258 if (fault == No_Fault) {
266 def template BasicDecode {{
267 return new %(class_name)s(machInst);
270 def template BasicDecodeWithMnemonic {{
271 return new %(class_name)s("%(mnemonic)s", machInst);
274 // The most basic instruction format... used only for a few misc. insts
275 def format BasicOperate(code, *flags) {{
276 iop = InstObjParams(name, Name, 'AlphaStaticInst', CodeBlock(code), flags)
277 return iop.subst('BasicDeclare', 'BasicDecode', 'BasicExecute')
282 ////////////////////////////////////////////////////////////////////
286 * Static instruction class for no-ops. This is a leaf class.
288 class Nop : public AlphaStaticInst
290 /// Disassembly of original instruction.
291 const std::string originalDisassembly;
295 Nop(const std::string _originalDisassembly, MachInst _machInst)
296 : AlphaStaticInst("nop", _machInst, No_OpClass),
297 originalDisassembly(_originalDisassembly)
304 std::string generateDisassembly(Addr pc, const SymbolTable *symtab)
306 #ifdef SS_COMPATIBLE_DISASSEMBLY
307 return originalDisassembly;
309 return csprintf("%-10s (%s)", "nop", originalDisassembly);
313 Fault execute(SimpleCPUExecContext *, Trace::InstRecord *)
316 Fault execute(FastCPUExecContext *, Trace::InstRecord *)
319 Fault execute(FullCPUExecContext *, Trace::InstRecord *)
323 /// Helper function for decoding nops. Substitute Nop object
324 /// for original inst passed in as arg (and delete latter).
327 makeNop(AlphaStaticInst *inst)
329 AlphaStaticInst *nop = new Nop(inst->disassemble(0), inst->machInst);
336 return ('', 'return new Nop("%s", machInst);\n' % name, 'return No_Fault;')
340 // integer & FP operate instructions use Rc as dest, so check for
341 // Rc == 31 to detect nops
342 def template OperateNopCheckDecode {{
344 AlphaStaticInst *i = new %(class_name)s(machInst);
352 // Like BasicOperate format, but generates NOP if RC/FC == 31
353 def format BasicOperateWithNopCheck(code, *opt_args) {{
354 iop = InstObjParams(name, Name, 'AlphaStaticInst', CodeBlock(code),
356 return iop.subst('BasicDeclare', 'OperateNopCheckDecode', 'BasicExecute')
360 ////////////////////////////////////////////////////////////////////
362 // Integer operate instructions
367 * Base class for integer immediate instructions.
369 class IntegerImm : public AlphaStaticInst
372 /// Immediate operand value (unsigned 8-bit int).
376 IntegerImm(const char *mnem, MachInst _machInst, OpClass __opClass)
377 : AlphaStaticInst(mnem, _machInst, __opClass), imm(INTIMM)
381 std::string generateDisassembly(Addr pc, const SymbolTable *symtab)
383 std::stringstream ss;
385 ccprintf(ss, "%-10s ", mnemonic);
387 // just print the first source reg... if there's
388 // a second one, it's a read-modify-write dest (Rc),
390 if (_numSrcRegs > 0) {
391 printReg(ss, _srcRegIdx[0]);
397 if (_numDestRegs > 0) {
399 printReg(ss, _destRegIdx[0]);
407 def template RegOrImmDecode {{
410 (IMM) ? (AlphaStaticInst *)new %(class_name)sImm(machInst)
411 : (AlphaStaticInst *)new %(class_name)s(machInst);
419 // Primary format for integer operate instructions:
420 // - Generates both reg-reg and reg-imm versions if Rb_or_imm is used.
421 // - Generates NOP if RC == 31.
422 def format IntegerOperate(code, *opt_flags) {{
423 # If the code block contains 'Rb_or_imm', we define two instructions,
424 # one using 'Rb' and one using 'imm', and have the decoder select
426 uses_imm = (code.find('Rb_or_imm') != -1)
429 # base code is reg version:
430 # rewrite by substituting 'Rb' for 'Rb_or_imm'
431 code = re.sub(r'Rb_or_imm', 'Rb', orig_code)
432 # generate immediate version by substituting 'imm'
433 # note that imm takes no extenstion, so we extend
434 # the regexp to replace any extension as well
435 imm_code = re.sub(r'Rb_or_imm(\.\w+)?', 'imm', orig_code)
437 # generate declaration for register version
438 cblk = CodeBlock(code)
439 iop = InstObjParams(name, Name, 'AlphaStaticInst', cblk, opt_flags)
440 (decls, exec_code) = iop.subst('BasicDeclare', 'BasicExecute')
443 # append declaration for imm version
444 imm_cblk = CodeBlock(imm_code)
445 imm_iop = InstObjParams(name, Name + 'Imm', 'IntegerImm', imm_cblk,
447 (imm_decls, imm_exec_code) = \
448 imm_iop.subst('BasicDeclare', 'BasicExecute')
450 exec_code += imm_exec_code
451 # decode checks IMM bit to pick correct version
452 decode = iop.subst('RegOrImmDecode')
454 # no imm version: just check for nop
455 decode = iop.subst('OperateNopCheckDecode')
457 return (decls, decode, exec_code)
461 ////////////////////////////////////////////////////////////////////
463 // Floating-point instructions
465 // Note that many FP-type instructions which do not support all the
466 // various rounding & trapping modes use the simpler format
467 // BasicOperateWithNopCheck.
472 * Base class for general floating-point instructions. Includes
473 * support for various Alpha rounding and trapping modes. Only FP
474 * instructions that require this support are derived from this
475 * class; the rest derive directly from AlphaStaticInst.
477 class AlphaFP : public AlphaStaticInst
480 /// Alpha FP rounding modes.
482 Chopped = 0, ///< round toward zero
483 Minus_Infinity = 1, ///< round toward minus infinity
484 Normal = 2, ///< round to nearest (default)
485 Dynamic = 3, ///< use FPCR setting (in instruction)
486 Plus_Infinity = 3 ///< round to plus inifinity (in FPCR)
489 /// Alpha FP trapping modes.
490 /// For instructions that produce integer results, the
491 /// "Underflow Enable" modes really mean "Overflow Enable", and
492 /// the assembly modifier is V rather than U.
494 /// default: nothing enabled
495 Imprecise = 0, ///< no modifier
496 /// underflow/overflow traps enabled, inexact disabled
497 Underflow_Imprecise = 1, ///< /U or /V
498 Underflow_Precise = 5, ///< /SU or /SV
499 /// underflow/overflow and inexact traps enabled
500 Underflow_Inexact_Precise = 7 ///< /SUI or /SVI
505 static const int alphaToC99RoundingMode[];
508 /// Map enum RoundingMode values to disassembly suffixes.
509 static const char *roundingModeSuffix[];
510 /// Map enum TrappingMode values to FP disassembly suffixes.
511 static const char *fpTrappingModeSuffix[];
512 /// Map enum TrappingMode values to integer disassembly suffixes.
513 static const char *intTrappingModeSuffix[];
515 /// This instruction's rounding mode.
516 RoundingMode roundingMode;
517 /// This instruction's trapping mode.
518 TrappingMode trappingMode;
521 AlphaFP(const char *mnem, MachInst _machInst, OpClass __opClass)
522 : AlphaStaticInst(mnem, _machInst, __opClass),
523 roundingMode((enum RoundingMode)FP_ROUNDMODE),
524 trappingMode((enum TrappingMode)FP_TRAPMODE)
526 if (trappingMode != Imprecise) {
527 warn("precise FP traps unimplemented\n");
533 getC99RoundingMode(uint64_t fpcr_val)
535 if (roundingMode == Dynamic) {
536 return alphaToC99RoundingMode[bits(fpcr_val, 59, 58)];
539 return alphaToC99RoundingMode[roundingMode];
544 // This differs from the AlphaStaticInst version only in
545 // printing suffixes for non-default rounding & trapping modes.
546 std::string generateDisassembly(Addr pc, const SymbolTable *symtab)
548 std::string mnem_str(mnemonic);
550 #ifndef SS_COMPATIBLE_DISASSEMBLY
551 std::string suffix("");
552 suffix += ((_destRegIdx[0] >= FP_Base_DepTag)
553 ? fpTrappingModeSuffix[trappingMode]
554 : intTrappingModeSuffix[trappingMode]);
555 suffix += roundingModeSuffix[roundingMode];
558 mnem_str = csprintf("%s/%s", mnemonic, suffix);
562 std::stringstream ss;
563 ccprintf(ss, "%-10s ", mnem_str.c_str());
565 // just print the first two source regs... if there's
566 // a third one, it's a read-modify-write dest (Rc),
568 if (_numSrcRegs > 0) {
569 printReg(ss, _srcRegIdx[0]);
571 if (_numSrcRegs > 1) {
573 printReg(ss, _srcRegIdx[1]);
576 // just print the first dest... if there's a second one,
577 // it's generally implicit
578 if (_numDestRegs > 0) {
581 printReg(ss, _destRegIdx[0]);
589 const int AlphaFP::alphaToC99RoundingMode[] = {
590 FE_TOWARDZERO, // Chopped
591 FE_DOWNWARD, // Minus_Infinity
592 FE_TONEAREST, // Normal
593 FE_UPWARD // Dynamic in inst, Plus_Infinity in FPCR
597 const char *AlphaFP::roundingModeSuffix[] = { "c", "m", "", "d" };
598 // mark invalid trapping modes, but don't fail on them, because
599 // you could decode anything on a misspeculated path
600 const char *AlphaFP::fpTrappingModeSuffix[] =
601 { "", "u", "INVTM2", "INVTM3", "INVTM4", "su", "INVTM6", "sui" };
602 const char *AlphaFP::intTrappingModeSuffix[] =
603 { "", "v", "INVTM2", "INVTM3", "INVTM4", "sv", "INVTM6", "svi" };
607 def template FloatingPointDecode {{
609 bool fast = (FP_TRAPMODE == AlphaFP::Imprecise
610 && FP_ROUNDMODE == AlphaFP::Normal);
612 fast ? (AlphaStaticInst *)new %(class_name)sFast(machInst) :
613 (AlphaStaticInst *)new %(class_name)sGeneral(machInst);
623 // General format for floating-point operate instructions:
624 // - Checks trapping and rounding mode flags. Trapping modes
625 // currently unimplemented (will fail).
626 // - Generates NOP if FC == 31.
627 def format FloatingPointOperate(code, *opt_args) {{
628 iop = InstObjParams(name, Name, 'AlphaFP', CodeBlock(code), opt_args)
629 decode = iop.subst('FloatingPointDecode')
631 fast_iop = InstObjParams(name, Name + 'Fast', 'AlphaFP',
632 CodeBlock(code), opt_args)
633 (fast_declare, fast_exec) = fast_iop.subst('BasicDeclare', 'BasicExecute')
635 gen_code_prefix = r'''
637 fesetround(getC99RoundingMode(xc->readFpcr()));
640 gen_code_suffix = r'''
642 fesetround(FE_TONEAREST);
646 gen_iop = InstObjParams(name, Name + 'General', 'AlphaFP',
647 CodeBlock(gen_code_prefix + code + gen_code_suffix), opt_args)
648 (gen_declare, gen_exec) = gen_iop.subst('BasicDeclare', 'BasicExecute')
650 return (fast_declare + gen_declare, decode, fast_exec + gen_exec)
654 ////////////////////////////////////////////////////////////////////
656 // Memory-format instructions: LoadAddress, Load, Store
661 * Base class for general Alpha memory-format instructions.
663 class Memory : public AlphaStaticInst
667 /// Displacement for EA calculation (signed).
669 /// Memory request flags. See mem_req_base.hh.
670 unsigned memAccessFlags;
673 Memory(const char *mnem, MachInst _machInst, OpClass __opClass)
674 : AlphaStaticInst(mnem, _machInst, __opClass),
675 disp(MEMDISP), memAccessFlags(0)
679 std::string generateDisassembly(Addr pc, const SymbolTable *symtab)
681 return csprintf("%-10s %c%d,%d(r%d)", mnemonic,
682 flags[IsFloating] ? 'f' : 'r', RA, MEMDISP, RB);
687 * Base class for a few miscellaneous memory-format insts
688 * that don't interpret the disp field: wh64, fetch, fetch_m, ecb.
689 * None of these instructions has a destination register either.
691 class MemoryNoDisp : public AlphaStaticInst
694 /// Memory request flags. See mem_req_base.hh.
695 unsigned memAccessFlags;
698 MemoryNoDisp(const char *mnem, MachInst _machInst, OpClass __opClass)
699 : AlphaStaticInst(mnem, _machInst, __opClass),
704 std::string generateDisassembly(Addr pc, const SymbolTable *symtab)
706 return csprintf("%-10s (r%d)", mnemonic, RB);
711 * Base class for "fake" effective-address computation
712 * instructions returnded by eaCompInst().
714 class EACompBase : public AlphaStaticInst
718 EACompBase(MachInst machInst)
719 : AlphaStaticInst("(eacomp)", machInst, IntALU)
723 Fault execute(SimpleCPUExecContext *, Trace::InstRecord *)
724 { panic("attempt to execute eacomp"); }
726 Fault execute(FastCPUExecContext *, Trace::InstRecord *)
727 { panic("attempt to execute eacomp"); }
729 Fault execute(FullCPUExecContext *, Trace::InstRecord *)
730 { panic("attempt to execute eacomp"); }
734 * Base class for "fake" memory-access instructions returnded by
737 class MemAccBase : public AlphaStaticInst
741 MemAccBase(MachInst machInst, OpClass __opClass)
742 : AlphaStaticInst("(memacc)", machInst, __opClass)
746 Fault execute(SimpleCPUExecContext *, Trace::InstRecord *)
747 { panic("attempt to execute memacc"); }
749 Fault execute(FastCPUExecContext *, Trace::InstRecord *)
750 { panic("attempt to execute memacc"); }
752 Fault execute(FullCPUExecContext *, Trace::InstRecord *)
753 { panic("attempt to execute memacc"); }
759 def format LoadAddress(code) {{
760 iop = InstObjParams(name, Name, 'Memory', CodeBlock(code))
761 return iop.subst('BasicDeclare', 'BasicDecode', 'BasicExecute')
765 def template LoadStoreDeclare {{
767 * Static instruction class for "%(mnemonic)s".
769 class %(class_name)s : public %(base_class)s
774 * "Fake" effective address computation class for "%(mnemonic)s".
776 class EAComp : public EACompBase
780 EAComp(MachInst machInst)
781 : EACompBase(machInst)
788 * "Fake" memory access instruction class for "%(mnemonic)s".
790 class MemAcc : public MemAccBase
794 MemAcc(MachInst machInst)
795 : MemAccBase(machInst, %(op_class)s)
797 %(memacc_constructor)s;
801 /// Pointer to EAComp object.
802 StaticInstPtr<AlphaISA> eaCompPtr;
803 /// Pointer to MemAcc object.
804 StaticInstPtr<AlphaISA> memAccPtr;
808 StaticInstPtr<AlphaISA> eaCompInst() { return eaCompPtr; }
809 StaticInstPtr<AlphaISA> memAccInst() { return memAccPtr; }
812 %(class_name)s(MachInst machInst)
813 : %(base_class)s("%(mnemonic)s", machInst, %(op_class)s),
814 eaCompPtr(new EAComp(machInst)), memAccPtr(new MemAcc(machInst))
819 %(exec_func_declarations)s
823 def template LoadStoreExecute {{
824 Fault %(class_name)s::execute(%(cpu_model)s *xc,
825 Trace::InstRecord *traceData)
828 Fault fault = No_Fault;
835 if (fault == No_Fault) {
840 if (fault == No_Fault) {
844 if (fault == No_Fault) {
848 if (fault == No_Fault) {
856 def template PrefetchDeclare {{
858 * Static instruction class for "%(mnemonic)s".
860 class %(class_name)s : public %(base_class)s
865 * "Fake" effective address computation class for "%(mnemonic)s".
867 class EAComp : public EACompBase
871 EAComp(MachInst machInst)
872 : EACompBase(machInst)
879 * "Fake" memory access instruction class for "%(mnemonic)s".
881 class MemAcc : public MemAccBase
885 MemAcc(MachInst machInst)
886 : MemAccBase(machInst, %(op_class)s)
888 %(memacc_constructor)s;
892 /// Pointer to EAComp object.
893 StaticInstPtr<AlphaISA> eaCompPtr;
894 /// Pointer to MemAcc object.
895 StaticInstPtr<AlphaISA> memAccPtr;
899 StaticInstPtr<AlphaISA> eaCompInst() { return eaCompPtr; }
900 StaticInstPtr<AlphaISA> memAccInst() { return memAccPtr; }
903 %(class_name)s(MachInst machInst)
904 : %(base_class)s("%(mnemonic)s", machInst, %(op_class)s),
905 eaCompPtr(new EAComp(machInst)), memAccPtr(new MemAcc(machInst))
910 %(exec_func_declarations)s
914 def template PrefetchExecute {{
915 Fault %(class_name)s::execute(%(cpu_model)s *xc,
916 Trace::InstRecord *traceData)
919 Fault fault = No_Fault;
926 if (fault == No_Fault) {
927 xc->prefetch(EA, memAccessFlags);
934 // load instructions use Ra as dest, so check for
935 // Ra == 31 to detect nops
936 def template LoadNopCheckDecode {{
938 AlphaStaticInst *i = new %(class_name)s(machInst);
947 // for some load instructions, Ra == 31 indicates a prefetch (not a nop)
948 def template LoadPrefetchCheckDecode {{
951 return new %(class_name)s(machInst);
954 return new %(class_name)sPrefetch(machInst);
962 def LoadStoreBase(name, Name, ea_code, memacc_code, postacc_code = '',
963 base_class = 'Memory', flags = [],
964 declare_template = 'LoadStoreDeclare',
965 decode_template = 'BasicDecode',
966 exec_template = 'LoadStoreExecute'):
967 # Segregate flags into instruction flags (handled by InstObjParams)
968 # and memory access flags (handled here).
970 # Would be nice to autogenerate this list, but oh well.
971 valid_mem_flags = ['LOCKED', 'EVICT_NEXT', 'PF_EXCLUSIVE']
975 if f in valid_mem_flags:
980 ea_cblk = CodeBlock(ea_code)
981 memacc_cblk = CodeBlock(memacc_code)
982 postacc_cblk = CodeBlock(postacc_code)
984 cblk = CodeBlock(ea_code + memacc_code + postacc_code)
985 iop = InstObjParams(name, Name, base_class, cblk, inst_flags)
987 iop.ea_constructor = ea_cblk.constructor
988 iop.ea_code = ea_cblk.code
989 iop.memacc_constructor = memacc_cblk.constructor
990 iop.memacc_code = memacc_cblk.code
991 iop.postacc_code = postacc_cblk.code
993 mem_flags = string.join(mem_flags, '|')
995 iop.constructor += '\n\tmemAccessFlags = ' + mem_flags + ';'
997 return iop.subst(declare_template, decode_template, exec_template)
1001 def format LoadOrNop(ea_code, memacc_code, *flags) {{
1002 return LoadStoreBase(name, Name, ea_code, memacc_code,
1004 decode_template = 'LoadNopCheckDecode')
1008 // Note that the flags passed in apply only to the prefetch version
1009 def format LoadOrPrefetch(ea_code, memacc_code, *pf_flags) {{
1010 # declare the load instruction object and generate the decode block
1011 (decls, decode, exec_code) = \
1012 LoadStoreBase(name, Name, ea_code, memacc_code,
1013 decode_template = 'LoadPrefetchCheckDecode')
1015 # Declare the prefetch instruction object.
1017 # convert flags from tuple to list to make them mutable
1018 pf_flags = list(pf_flags) + ['IsMemRef', 'IsLoad', 'IsDataPrefetch', 'RdPort']
1020 (pfdecls, pfdecode, pfexec) = \
1021 LoadStoreBase(name, Name + 'Prefetch', ea_code, '',
1023 declare_template = 'PrefetchDeclare',
1024 exec_template = 'PrefetchExecute')
1026 return (decls + pfdecls, decode, exec_code + pfexec)
1030 def format Store(ea_code, memacc_code, *flags) {{
1031 return LoadStoreBase(name, Name, ea_code, memacc_code,
1036 def format StoreCond(ea_code, memacc_code, postacc_code, *flags) {{
1037 return LoadStoreBase(name, Name, ea_code, memacc_code, postacc_code,
1042 // Use 'MemoryNoDisp' as base: for wh64, fetch, ecb
1043 def format MiscPrefetch(ea_code, memacc_code, *flags) {{
1044 return LoadStoreBase(name, Name, ea_code, memacc_code,
1045 flags = flags, base_class = 'MemoryNoDisp')
1049 ////////////////////////////////////////////////////////////////////
1055 * Base class for instructions whose disassembly is not purely a
1056 * function of the machine instruction (i.e., it depends on the
1057 * PC). This class overrides the disassemble() method to check
1058 * the PC and symbol table values before re-using a cached
1059 * disassembly string. This is necessary for branches and jumps,
1060 * where the disassembly string includes the target address (which
1061 * may depend on the PC and/or symbol table).
1063 class PCDependentDisassembly : public AlphaStaticInst
1066 /// Cached program counter from last disassembly
1068 /// Cached symbol table pointer from last disassembly
1069 const SymbolTable *cachedSymtab;
1072 PCDependentDisassembly(const char *mnem, MachInst _machInst,
1074 : AlphaStaticInst(mnem, _machInst, __opClass),
1075 cachedPC(0), cachedSymtab(0)
1079 const std::string &disassemble(Addr pc, const SymbolTable *symtab)
1081 if (!cachedDisassembly ||
1082 pc != cachedPC || symtab != cachedSymtab)
1084 if (cachedDisassembly)
1085 delete cachedDisassembly;
1088 new std::string(generateDisassembly(pc, symtab));
1090 cachedSymtab = symtab;
1093 return *cachedDisassembly;
1098 * Base class for branches (PC-relative control transfers),
1099 * conditional or unconditional.
1101 class Branch : public PCDependentDisassembly
1104 /// Displacement to target address (signed).
1108 Branch(const char *mnem, MachInst _machInst, OpClass __opClass)
1109 : PCDependentDisassembly(mnem, _machInst, __opClass),
1114 Addr branchTarget(Addr branchPC) const
1116 return branchPC + 4 + disp;
1119 std::string generateDisassembly(Addr pc, const SymbolTable *symtab)
1121 std::stringstream ss;
1123 ccprintf(ss, "%-10s ", mnemonic);
1125 // There's only one register arg (RA), but it could be
1126 // either a source (the condition for conditional
1127 // branches) or a destination (the link reg for
1128 // unconditional branches)
1129 if (_numSrcRegs > 0) {
1130 printReg(ss, _srcRegIdx[0]);
1133 else if (_numDestRegs > 0) {
1134 printReg(ss, _destRegIdx[0]);
1138 #ifdef SS_COMPATIBLE_DISASSEMBLY
1139 if (_numSrcRegs == 0 && _numDestRegs == 0) {
1145 Addr target = pc + 4 + disp;
1148 if (symtab && symtab->findSymbol(target, str))
1151 ccprintf(ss, "0x%x", target);
1158 * Base class for jumps (register-indirect control transfers). In
1159 * the Alpha ISA, these are always unconditional.
1161 class Jump : public PCDependentDisassembly
1165 /// Displacement to target address (signed).
1170 Jump(const char *mnem, MachInst _machInst, OpClass __opClass)
1171 : PCDependentDisassembly(mnem, _machInst, __opClass),
1176 Addr branchTarget(ExecContext *xc) const
1178 Addr NPC = xc->readPC() + 4;
1179 uint64_t Rb = xc->readIntReg(_srcRegIdx[0]);
1180 return (Rb & ~3) | (NPC & 1);
1183 std::string generateDisassembly(Addr pc, const SymbolTable *symtab)
1185 std::stringstream ss;
1187 ccprintf(ss, "%-10s ", mnemonic);
1189 #ifdef SS_COMPATIBLE_DISASSEMBLY
1190 if (_numDestRegs == 0) {
1196 if (_numDestRegs > 0) {
1197 printReg(ss, _destRegIdx[0]);
1201 ccprintf(ss, "(r%d)", RB);
1208 def template JumpOrBranchDecode {{
1210 ? (StaticInst<AlphaISA> *)new %(class_name)s(machInst)
1211 : (StaticInst<AlphaISA> *)new %(class_name)sAndLink(machInst);
1214 def format CondBranch(code) {{
1215 code = 'bool cond;\n' + code + '\nif (cond) NPC = NPC + disp;\n';
1216 iop = InstObjParams(name, Name, 'Branch', CodeBlock(code),
1217 ('IsDirectControl', 'IsCondControl'))
1218 return iop.subst('BasicDeclare', 'BasicDecode', 'BasicExecute')
1222 global UncondCtrlBase
1223 def UncondCtrlBase(name, Name, base_class, npc_expr, flags):
1224 # Declare basic control transfer w/o link (i.e. link reg is R31)
1225 nolink_code = 'NPC = %s;\n' % npc_expr
1226 nolink_iop = InstObjParams(name, Name, base_class,
1227 CodeBlock(nolink_code), flags)
1228 (decls, exec_code) = nolink_iop.subst('BasicDeclare', 'BasicExecute')
1230 # Generate declaration of '*AndLink' version, append to decls
1231 link_code = 'Ra = NPC & ~3;\n' + nolink_code
1232 link_iop = InstObjParams(name, Name + 'AndLink', base_class,
1233 CodeBlock(link_code), flags)
1234 (link_decls, link_exec_code) = \
1235 link_iop.subst('BasicDeclare', 'BasicExecute')
1237 exec_code += link_exec_code
1239 # need to use link_iop for the decode template since it is expecting
1240 # the shorter version of class_name (w/o "AndLink")
1241 return (decls, nolink_iop.subst('JumpOrBranchDecode'), exec_code)
1244 def format UncondBranch(*flags) {{
1245 flags += ('IsUncondControl', 'IsDirectControl')
1246 return UncondCtrlBase(name, Name, 'Branch', 'NPC + disp', flags)
1249 def format Jump(*flags) {{
1250 flags += ('IsUncondControl', 'IsIndirectControl')
1251 return UncondCtrlBase(name, Name, 'Jump', '(Rb & ~3) | (NPC & 1)', flags)
1257 * Base class for emulated call_pal calls (used only in
1258 * non-full-system mode).
1260 class EmulatedCallPal : public AlphaStaticInst
1265 EmulatedCallPal(const char *mnem, MachInst _machInst,
1267 : AlphaStaticInst(mnem, _machInst, __opClass)
1271 std::string generateDisassembly(Addr pc, const SymbolTable *symtab)
1273 #ifdef SS_COMPATIBLE_DISASSEMBLY
1274 return csprintf("%s %s", "call_pal", mnemonic);
1276 return csprintf("%-10s %s", "call_pal", mnemonic);
1282 def format EmulatedCallPal(code) {{
1283 iop = InstObjParams(name, Name, 'EmulatedCallPal', CodeBlock(code))
1284 return iop.subst('BasicDeclare', 'BasicDecode', 'BasicExecute')
1289 * Base class for full-system-mode call_pal instructions.
1290 * Probably could turn this into a leaf class and get rid of the
1293 class CallPalBase : public AlphaStaticInst
1296 int palFunc; ///< Function code part of instruction
1297 int palOffset; ///< Target PC, offset from IPR_PAL_BASE
1298 bool palValid; ///< is the function code valid?
1299 bool palPriv; ///< is this call privileged?
1302 CallPalBase(const char *mnem, MachInst _machInst,
1304 : AlphaStaticInst(mnem, _machInst, __opClass),
1307 // From the 21164 HRM (paraphrased):
1308 // Bit 7 of the function code (mask 0x80) indicates
1309 // whether the call is privileged (bit 7 == 0) or
1310 // unprivileged (bit 7 == 1). The privileged call table
1311 // starts at 0x2000, the unprivielged call table starts at
1312 // 0x3000. Bits 5-0 (mask 0x3f) are used to calculate the
1314 const int palPrivMask = 0x80;
1315 const int palOffsetMask = 0x3f;
1317 // Pal call is invalid unless all other bits are 0
1318 palValid = ((machInst & ~(palPrivMask | palOffsetMask)) == 0);
1319 palPriv = ((machInst & palPrivMask) == 0);
1320 int shortPalFunc = (machInst & palOffsetMask);
1321 // Add 1 to base to set pal-mode bit
1322 palOffset = (palPriv ? 0x2001 : 0x3001) + (shortPalFunc << 6);
1325 std::string generateDisassembly(Addr pc, const SymbolTable *symtab)
1327 return csprintf("%-10s %#x", "call_pal", palFunc);
1333 def format CallPal(code) {{
1334 iop = InstObjParams(name, Name, 'CallPalBase', CodeBlock(code))
1335 return iop.subst('BasicDeclare', 'BasicDecode', 'BasicExecute')
1343 * Base class for hw_ld and hw_st.
1345 class HwLoadStore : public AlphaStaticInst
1349 /// Displacement for EA calculation (signed).
1351 /// Memory request flags. See mem_req_base.hh.
1352 unsigned memAccessFlags;
1355 HwLoadStore(const char *mnem, MachInst _machInst, OpClass __opClass)
1356 : AlphaStaticInst(mnem, _machInst, __opClass), disp(HW_LDST_DISP)
1359 if (HW_LDST_PHYS) memAccessFlags |= PHYSICAL;
1360 if (HW_LDST_ALT) memAccessFlags |= ALTMODE;
1361 if (HW_LDST_VPTE) memAccessFlags |= VPTE;
1362 if (HW_LDST_LOCK) memAccessFlags |= LOCKED;
1365 std::string generateDisassembly(Addr pc, const SymbolTable *symtab)
1367 #ifdef SS_COMPATIBLE_DISASSEMBLY
1368 return csprintf("%-10s r%d,%d(r%d)", mnemonic, RA, disp, RB);
1370 // HW_LDST_LOCK and HW_LDST_COND are the same bit.
1371 const char *lock_str =
1372 (HW_LDST_LOCK) ? (flags[IsLoad] ? ",LOCK" : ",COND") : "";
1374 return csprintf("%-10s r%d,%d(r%d)%s%s%s%s%s",
1375 mnemonic, RA, disp, RB,
1376 HW_LDST_PHYS ? ",PHYS" : "",
1377 HW_LDST_ALT ? ",ALT" : "",
1378 HW_LDST_QUAD ? ",QUAD" : "",
1379 HW_LDST_VPTE ? ",VPTE" : "",
1387 def format HwLoadStore(ea_code, memacc_code, class_ext, *flags) {{
1388 return LoadStoreBase(name, Name + class_ext, ea_code, memacc_code,
1390 base_class = 'HwLoadStore')
1394 def format HwStoreCond(ea_code, memacc_code, postacc_code, class_ext, *flags) {{
1395 return LoadStoreBase(name, Name + class_ext,
1396 ea_code, memacc_code, postacc_code,
1398 base_class = 'HwLoadStore')
1404 * Base class for hw_mfpr and hw_mtpr.
1406 class HwMoveIPR : public AlphaStaticInst
1409 /// Index of internal processor register.
1413 HwMoveIPR(const char *mnem, MachInst _machInst, OpClass __opClass)
1414 : AlphaStaticInst(mnem, _machInst, __opClass),
1415 ipr_index(HW_IPR_IDX)
1419 std::string generateDisassembly(Addr pc, const SymbolTable *symtab)
1421 if (_numSrcRegs > 0) {
1423 return csprintf("%-10s r%d,IPR(%#x)",
1424 mnemonic, RA, ipr_index);
1428 return csprintf("%-10s IPR(%#x),r%d",
1429 mnemonic, ipr_index, RA);
1435 def format HwMoveIPR(code) {{
1436 iop = InstObjParams(name, Name, 'HwMoveIPR', CodeBlock(code))
1437 return iop.subst('BasicDeclare', 'BasicDecode', 'BasicExecute')
1442 * Static instruction class for unimplemented instructions that
1443 * cause simulator termination. Note that these are recognized
1444 * (legal) instructions that the simulator does not support; the
1445 * 'Unknown' class is used for unrecognized/illegal instructions.
1446 * This is a leaf class.
1448 class FailUnimplemented : public AlphaStaticInst
1452 FailUnimplemented(const char *_mnemonic, MachInst _machInst)
1453 : AlphaStaticInst(_mnemonic, _machInst, No_OpClass)
1457 Fault execute(SimpleCPUExecContext *xc,
1458 Trace::InstRecord *traceData)
1460 panic("attempt to execute unimplemented instruction '%s' "
1461 "(inst 0x%08x, opcode 0x%x)", mnemonic, machInst, OPCODE);
1462 return Unimplemented_Opcode_Fault;
1465 Fault execute(FastCPUExecContext *xc,
1466 Trace::InstRecord *traceData)
1468 panic("attempt to execute unimplemented instruction '%s' "
1469 "(inst 0x%08x, opcode 0x%x)", mnemonic, machInst, OPCODE);
1470 return Unimplemented_Opcode_Fault;
1473 Fault execute(FullCPUExecContext *xc,
1474 Trace::InstRecord *traceData)
1476 // don't panic if this is a misspeculated instruction
1477 if (!xc->misspeculating())
1478 panic("attempt to execute unimplemented instruction '%s' "
1479 "(inst 0x%08x, opcode 0x%x)",
1480 mnemonic, machInst, OPCODE);
1481 return Unimplemented_Opcode_Fault;
1484 std::string generateDisassembly(Addr pc, const SymbolTable *symtab)
1486 return csprintf("%-10s (unimplemented)", mnemonic);
1491 * Base class for unimplemented instructions that cause a warning
1492 * to be printed (but do not terminate simulation). This
1493 * implementation is a little screwy in that it will print a
1494 * warning for each instance of a particular unimplemented machine
1495 * instruction, not just for each unimplemented opcode. Should
1496 * probably make the 'warned' flag a static member of the derived
1499 class WarnUnimplemented : public AlphaStaticInst
1502 /// Have we warned on this instruction yet?
1507 WarnUnimplemented(const char *_mnemonic, MachInst _machInst)
1508 : AlphaStaticInst(_mnemonic, _machInst, No_OpClass), warned(false)
1512 Fault execute(SimpleCPUExecContext *xc,
1513 Trace::InstRecord *traceData)
1516 warn("instruction '%s' unimplemented\n", mnemonic);
1523 Fault execute(FastCPUExecContext *xc,
1524 Trace::InstRecord *traceData)
1527 warn("instruction '%s' unimplemented\n", mnemonic);
1534 Fault execute(FullCPUExecContext *xc,
1535 Trace::InstRecord *traceData)
1537 if (!xc->misspeculating() && !warned) {
1538 warn("instruction '%s' unimplemented\n", mnemonic);
1545 std::string generateDisassembly(Addr pc, const SymbolTable *symtab)
1547 #ifdef SS_COMPATIBLE_DISASSEMBLY
1548 return csprintf("%-10s", mnemonic);
1550 return csprintf("%-10s (unimplemented)", mnemonic);
1556 def template WarnUnimplDeclare {{
1558 * Static instruction class for "%(mnemonic)s".
1560 class %(class_name)s : public %(base_class)s
1564 %(class_name)s(MachInst machInst)
1565 : %(base_class)s("%(mnemonic)s", machInst)
1572 def format FailUnimpl() {{
1573 iop = InstObjParams(name, 'FailUnimplemented')
1574 return ('', iop.subst('BasicDecodeWithMnemonic'), '')
1577 def format WarnUnimpl() {{
1578 iop = InstObjParams(name, Name, 'WarnUnimplemented')
1579 return iop.subst('WarnUnimplDeclare', 'BasicDecode') + ['']
1584 * Static instruction class for unknown (illegal) instructions.
1585 * These cause simulator termination if they are executed in a
1586 * non-speculative mode. This is a leaf class.
1588 class Unknown : public AlphaStaticInst
1592 Unknown(MachInst _machInst)
1593 : AlphaStaticInst("unknown", _machInst, No_OpClass)
1597 Fault execute(SimpleCPUExecContext *xc,
1598 Trace::InstRecord *traceData)
1600 panic("attempt to execute unknown instruction "
1601 "(inst 0x%08x, opcode 0x%x)", machInst, OPCODE);
1602 return Unimplemented_Opcode_Fault;
1605 Fault execute(FastCPUExecContext *xc,
1606 Trace::InstRecord *traceData)
1608 panic("attempt to execute unknown instruction "
1609 "(inst 0x%08x, opcode 0x%x)", machInst, OPCODE);
1610 return Unimplemented_Opcode_Fault;
1613 Fault execute(FullCPUExecContext *xc,
1614 Trace::InstRecord *traceData)
1616 // don't panic if this is a misspeculated instruction
1617 if (!xc->misspeculating())
1618 panic("attempt to execute unknown instruction "
1619 "(inst 0x%08x, opcode 0x%x)", machInst, OPCODE);
1620 return Unimplemented_Opcode_Fault;
1623 std::string generateDisassembly(Addr pc, const SymbolTable *symtab)
1625 return csprintf("%-10s (inst 0x%x, opcode 0x%x)",
1626 "unknown", machInst, OPCODE);
1631 def format Unknown() {{
1632 return ('', 'return new Unknown(machInst);\n', '')
1637 /// Return opa + opb, summing carry into third arg.
1639 addc(uint64_t opa, uint64_t opb, int &carry)
1641 uint64_t res = opa + opb;
1642 if (res < opa || res < opb)
1647 /// Multiply two 64-bit values (opa * opb), returning the 128-bit
1648 /// product in res_hi and res_lo.
1650 mul128(uint64_t opa, uint64_t opb, uint64_t &res_hi, uint64_t &res_lo)
1652 // do a 64x64 --> 128 multiply using four 32x32 --> 64 multiplies
1653 uint64_t opa_hi = opa<63:32>;
1654 uint64_t opa_lo = opa<31:0>;
1655 uint64_t opb_hi = opb<63:32>;
1656 uint64_t opb_lo = opb<31:0>;
1658 res_lo = opa_lo * opb_lo;
1660 // The middle partial products logically belong in bit
1661 // positions 95 to 32. Thus the lower 32 bits of each product
1662 // sum into the upper 32 bits of the low result, while the
1663 // upper 32 sum into the low 32 bits of the upper result.
1664 uint64_t partial1 = opa_hi * opb_lo;
1665 uint64_t partial2 = opa_lo * opb_hi;
1667 uint64_t partial1_lo = partial1<31:0> << 32;
1668 uint64_t partial1_hi = partial1<63:32>;
1669 uint64_t partial2_lo = partial2<31:0> << 32;
1670 uint64_t partial2_hi = partial2<63:32>;
1672 // Add partial1_lo and partial2_lo to res_lo, keeping track
1673 // of any carries out
1675 res_lo = addc(partial1_lo, res_lo, carry_out);
1676 res_lo = addc(partial2_lo, res_lo, carry_out);
1678 // Now calculate the high 64 bits...
1679 res_hi = (opa_hi * opb_hi) + partial1_hi + partial2_hi + carry_out;
1682 /// Map 8-bit S-floating exponent to 11-bit T-floating exponent.
1683 /// See Table 2-2 of Alpha AHB.
1687 int hibit = old_exp<7:>;
1688 int lobits = old_exp<6:0>;
1691 return (lobits == 0x7f) ? 0x7ff : (0x400 | lobits);
1694 return (lobits == 0) ? 0 : (0x380 | lobits);
1698 /// Convert a 32-bit S-floating value to the equivalent 64-bit
1699 /// representation to be stored in an FP reg.
1701 s_to_t(uint32_t s_val)
1703 uint64_t tmp = s_val;
1704 return (tmp<31:> << 63 // sign bit
1705 | (uint64_t)map_s(tmp<30:23>) << 52 // exponent
1706 | tmp<22:0> << 29); // fraction
1709 /// Convert a 64-bit T-floating value to the equivalent 32-bit
1710 /// S-floating representation to be stored in memory.
1712 t_to_s(uint64_t t_val)
1714 return (t_val<63:62> << 30 // sign bit & hi exp bit
1715 | t_val<58:29>); // rest of exp & fraction
1719 decode OPCODE default Unknown::unknown() {
1721 format LoadAddress {
1722 0x08: lda({{ Ra = Rb + disp; }});
1723 0x09: ldah({{ Ra = Rb + (disp << 16); }});
1727 0x0a: ldbu({{ EA = Rb + disp; }}, {{ Ra.uq = Mem.ub; }});
1728 0x0c: ldwu({{ EA = Rb + disp; }}, {{ Ra.uq = Mem.uw; }});
1729 0x0b: ldq_u({{ EA = (Rb + disp) & ~7; }}, {{ Ra = Mem.uq; }});
1730 0x23: ldt({{ EA = Rb + disp; }}, {{ Fa = Mem.df; }});
1731 0x2a: ldl_l({{ EA = Rb + disp; }}, {{ Ra.sl = Mem.sl; }}, LOCKED);
1732 0x2b: ldq_l({{ EA = Rb + disp; }}, {{ Ra.uq = Mem.uq; }}, LOCKED);
1733 0x20: copy_load({{EA = Ra;}},
1734 {{ fault = xc->copySrcTranslate(EA);}},
1735 IsMemRef, IsLoad, IsCopy);
1738 format LoadOrPrefetch {
1739 0x28: ldl({{ EA = Rb + disp; }}, {{ Ra.sl = Mem.sl; }});
1740 0x29: ldq({{ EA = Rb + disp; }}, {{ Ra.uq = Mem.uq; }}, EVICT_NEXT);
1741 // IsFloating flag on lds gets the prefetch to disassemble
1742 // using f31 instead of r31... funcitonally it's unnecessary
1743 0x22: lds({{ EA = Rb + disp; }}, {{ Fa.uq = s_to_t(Mem.ul); }},
1744 PF_EXCLUSIVE, IsFloating);
1748 0x0e: stb({{ EA = Rb + disp; }}, {{ Mem.ub = Ra<7:0>; }});
1749 0x0d: stw({{ EA = Rb + disp; }}, {{ Mem.uw = Ra<15:0>; }});
1750 0x2c: stl({{ EA = Rb + disp; }}, {{ Mem.ul = Ra<31:0>; }});
1751 0x2d: stq({{ EA = Rb + disp; }}, {{ Mem.uq = Ra.uq; }});
1752 0x0f: stq_u({{ EA = (Rb + disp) & ~7; }}, {{ Mem.uq = Ra.uq; }});
1753 0x26: sts({{ EA = Rb + disp; }}, {{ Mem.ul = t_to_s(Fa.uq); }});
1754 0x27: stt({{ EA = Rb + disp; }}, {{ Mem.df = Fa; }});
1755 0x24: copy_store({{EA = Rb;}},
1756 {{ fault = xc->copy(EA);}},
1757 IsMemRef, IsStore, IsCopy);
1761 0x2e: stl_c({{ EA = Rb + disp; }}, {{ Mem.ul = Ra<31:0>; }},
1763 uint64_t tmp = Mem_write_result;
1765 Ra = (tmp == 0 || tmp == 1) ? tmp : Ra;
1767 0x2f: stq_c({{ EA = Rb + disp; }}, {{ Mem.uq = Ra; }},
1769 uint64_t tmp = Mem_write_result;
1770 // If the write operation returns 0 or 1, then
1771 // this was a conventional store conditional,
1772 // and the value indicates the success/failure
1773 // of the operation. If another value is
1774 // returned, then this was a Turbolaser
1775 // mailbox access, and we don't update the
1776 // result register at all.
1777 Ra = (tmp == 0 || tmp == 1) ? tmp : Ra;
1781 format IntegerOperate {
1783 0x10: decode INTFUNC { // integer arithmetic operations
1785 0x00: addl({{ Rc.sl = Ra.sl + Rb_or_imm.sl; }});
1787 uint32_t tmp = Ra.sl + Rb_or_imm.sl;
1788 // signed overflow occurs when operands have same sign
1789 // and sign of result does not match.
1790 if (Ra.sl<31:> == Rb_or_imm.sl<31:> && tmp<31:> != Ra.sl<31:>)
1791 fault = Integer_Overflow_Fault;
1794 0x02: s4addl({{ Rc.sl = (Ra.sl << 2) + Rb_or_imm.sl; }});
1795 0x12: s8addl({{ Rc.sl = (Ra.sl << 3) + Rb_or_imm.sl; }});
1797 0x20: addq({{ Rc = Ra + Rb_or_imm; }});
1799 uint64_t tmp = Ra + Rb_or_imm;
1800 // signed overflow occurs when operands have same sign
1801 // and sign of result does not match.
1802 if (Ra<63:> == Rb_or_imm<63:> && tmp<63:> != Ra<63:>)
1803 fault = Integer_Overflow_Fault;
1806 0x22: s4addq({{ Rc = (Ra << 2) + Rb_or_imm; }});
1807 0x32: s8addq({{ Rc = (Ra << 3) + Rb_or_imm; }});
1809 0x09: subl({{ Rc.sl = Ra.sl - Rb_or_imm.sl; }});
1811 uint32_t tmp = Ra.sl - Rb_or_imm.sl;
1812 // signed overflow detection is same as for add,
1813 // except we need to look at the *complemented*
1814 // sign bit of the subtrahend (Rb), i.e., if the initial
1815 // signs are the *same* then no overflow can occur
1816 if (Ra.sl<31:> != Rb_or_imm.sl<31:> && tmp<31:> != Ra.sl<31:>)
1817 fault = Integer_Overflow_Fault;
1820 0x0b: s4subl({{ Rc.sl = (Ra.sl << 2) - Rb_or_imm.sl; }});
1821 0x1b: s8subl({{ Rc.sl = (Ra.sl << 3) - Rb_or_imm.sl; }});
1823 0x29: subq({{ Rc = Ra - Rb_or_imm; }});
1825 uint64_t tmp = Ra - Rb_or_imm;
1826 // signed overflow detection is same as for add,
1827 // except we need to look at the *complemented*
1828 // sign bit of the subtrahend (Rb), i.e., if the initial
1829 // signs are the *same* then no overflow can occur
1830 if (Ra<63:> != Rb_or_imm<63:> && tmp<63:> != Ra<63:>)
1831 fault = Integer_Overflow_Fault;
1834 0x2b: s4subq({{ Rc = (Ra << 2) - Rb_or_imm; }});
1835 0x3b: s8subq({{ Rc = (Ra << 3) - Rb_or_imm; }});
1837 0x2d: cmpeq({{ Rc = (Ra == Rb_or_imm); }});
1838 0x6d: cmple({{ Rc = (Ra.sq <= Rb_or_imm.sq); }});
1839 0x4d: cmplt({{ Rc = (Ra.sq < Rb_or_imm.sq); }});
1840 0x3d: cmpule({{ Rc = (Ra.uq <= Rb_or_imm.uq); }});
1841 0x1d: cmpult({{ Rc = (Ra.uq < Rb_or_imm.uq); }});
1847 for (int i = 0; i < 8; ++i) {
1848 tmp |= (Ra.uq<hi:lo> >= Rb_or_imm.uq<hi:lo>) << i;
1856 0x11: decode INTFUNC { // integer logical operations
1858 0x00: and({{ Rc = Ra & Rb_or_imm; }});
1859 0x08: bic({{ Rc = Ra & ~Rb_or_imm; }});
1860 0x20: bis({{ Rc = Ra | Rb_or_imm; }});
1861 0x28: ornot({{ Rc = Ra | ~Rb_or_imm; }});
1862 0x40: xor({{ Rc = Ra ^ Rb_or_imm; }});
1863 0x48: eqv({{ Rc = Ra ^ ~Rb_or_imm; }});
1865 // conditional moves
1866 0x14: cmovlbs({{ Rc = ((Ra & 1) == 1) ? Rb_or_imm : Rc; }});
1867 0x16: cmovlbc({{ Rc = ((Ra & 1) == 0) ? Rb_or_imm : Rc; }});
1868 0x24: cmoveq({{ Rc = (Ra == 0) ? Rb_or_imm : Rc; }});
1869 0x26: cmovne({{ Rc = (Ra != 0) ? Rb_or_imm : Rc; }});
1870 0x44: cmovlt({{ Rc = (Ra.sq < 0) ? Rb_or_imm : Rc; }});
1871 0x46: cmovge({{ Rc = (Ra.sq >= 0) ? Rb_or_imm : Rc; }});
1872 0x64: cmovle({{ Rc = (Ra.sq <= 0) ? Rb_or_imm : Rc; }});
1873 0x66: cmovgt({{ Rc = (Ra.sq > 0) ? Rb_or_imm : Rc; }});
1875 // For AMASK, RA must be R31.
1877 31: amask({{ Rc = Rb_or_imm & ~ULL(0x17); }});
1880 // For IMPLVER, RA must be R31 and the B operand
1881 // must be the immediate value 1.
1885 // return EV5 for FULL_SYSTEM and EV6 otherwise
1898 // The mysterious 11.25...
1899 0x25: WarnUnimpl::eleven25();
1903 0x12: decode INTFUNC {
1904 0x39: sll({{ Rc = Ra << Rb_or_imm<5:0>; }});
1905 0x34: srl({{ Rc = Ra.uq >> Rb_or_imm<5:0>; }});
1906 0x3c: sra({{ Rc = Ra.sq >> Rb_or_imm<5:0>; }});
1908 0x02: mskbl({{ Rc = Ra & ~(mask( 8) << (Rb_or_imm<2:0> * 8)); }});
1909 0x12: mskwl({{ Rc = Ra & ~(mask(16) << (Rb_or_imm<2:0> * 8)); }});
1910 0x22: mskll({{ Rc = Ra & ~(mask(32) << (Rb_or_imm<2:0> * 8)); }});
1911 0x32: mskql({{ Rc = Ra & ~(mask(64) << (Rb_or_imm<2:0> * 8)); }});
1914 int bv = Rb_or_imm<2:0>;
1915 Rc = bv ? (Ra & ~(mask(16) >> (64 - 8 * bv))) : Ra;
1918 int bv = Rb_or_imm<2:0>;
1919 Rc = bv ? (Ra & ~(mask(32) >> (64 - 8 * bv))) : Ra;
1922 int bv = Rb_or_imm<2:0>;
1923 Rc = bv ? (Ra & ~(mask(64) >> (64 - 8 * bv))) : Ra;
1926 0x06: extbl({{ Rc = (Ra.uq >> (Rb_or_imm<2:0> * 8))< 7:0>; }});
1927 0x16: extwl({{ Rc = (Ra.uq >> (Rb_or_imm<2:0> * 8))<15:0>; }});
1928 0x26: extll({{ Rc = (Ra.uq >> (Rb_or_imm<2:0> * 8))<31:0>; }});
1929 0x36: extql({{ Rc = (Ra.uq >> (Rb_or_imm<2:0> * 8)); }});
1932 Rc = (Ra << (64 - (Rb_or_imm<2:0> * 8))<5:0>)<15:0>; }});
1934 Rc = (Ra << (64 - (Rb_or_imm<2:0> * 8))<5:0>)<31:0>; }});
1936 Rc = (Ra << (64 - (Rb_or_imm<2:0> * 8))<5:0>); }});
1938 0x0b: insbl({{ Rc = Ra< 7:0> << (Rb_or_imm<2:0> * 8); }});
1939 0x1b: inswl({{ Rc = Ra<15:0> << (Rb_or_imm<2:0> * 8); }});
1940 0x2b: insll({{ Rc = Ra<31:0> << (Rb_or_imm<2:0> * 8); }});
1941 0x3b: insql({{ Rc = Ra << (Rb_or_imm<2:0> * 8); }});
1944 int bv = Rb_or_imm<2:0>;
1945 Rc = bv ? (Ra.uq<15:0> >> (64 - 8 * bv)) : 0;
1948 int bv = Rb_or_imm<2:0>;
1949 Rc = bv ? (Ra.uq<31:0> >> (64 - 8 * bv)) : 0;
1952 int bv = Rb_or_imm<2:0>;
1953 Rc = bv ? (Ra.uq >> (64 - 8 * bv)) : 0;
1957 uint64_t zapmask = 0;
1958 for (int i = 0; i < 8; ++i) {
1960 zapmask |= (mask(8) << (i * 8));
1965 uint64_t zapmask = 0;
1966 for (int i = 0; i < 8; ++i) {
1968 zapmask |= (mask(8) << (i * 8));
1974 0x13: decode INTFUNC { // integer multiplies
1975 0x00: mull({{ Rc.sl = Ra.sl * Rb_or_imm.sl; }}, IntMULT);
1976 0x20: mulq({{ Rc = Ra * Rb_or_imm; }}, IntMULT);
1979 mul128(Ra, Rb_or_imm, hi, lo);
1983 // 32-bit multiply with trap on overflow
1984 int64_t Rax = Ra.sl; // sign extended version of Ra.sl
1985 int64_t Rbx = Rb_or_imm.sl;
1986 int64_t tmp = Rax * Rbx;
1987 // To avoid overflow, all the upper 32 bits must match
1988 // the sign bit of the lower 32. We code this as
1989 // checking the upper 33 bits for all 0s or all 1s.
1990 uint64_t sign_bits = tmp<63:31>;
1991 if (sign_bits != 0 && sign_bits != mask(33))
1992 fault = Integer_Overflow_Fault;
1996 // 64-bit multiply with trap on overflow
1998 mul128(Ra, Rb_or_imm, hi, lo);
1999 // all the upper 64 bits must match the sign bit of
2001 if (!((hi == 0 && lo<63:> == 0) ||
2002 (hi == mask(64) && lo<63:> == 1)))
2003 fault = Integer_Overflow_Fault;
2008 0x1c: decode INTFUNC {
2009 0x00: decode RA { 31: sextb({{ Rc.sb = Rb_or_imm< 7:0>; }}); }
2010 0x01: decode RA { 31: sextw({{ Rc.sw = Rb_or_imm<15:0>; }}); }
2031 format BasicOperateWithNopCheck {
2033 31: ftoit({{ Rc = Fa.uq; }}, FloatCVT);
2036 31: ftois({{ Rc.sl = t_to_s(Fa.uq); }},
2043 // Conditional branches.
2045 0x39: beq({{ cond = (Ra == 0); }});
2046 0x3d: bne({{ cond = (Ra != 0); }});
2047 0x3e: bge({{ cond = (Ra.sq >= 0); }});
2048 0x3f: bgt({{ cond = (Ra.sq > 0); }});
2049 0x3b: ble({{ cond = (Ra.sq <= 0); }});
2050 0x3a: blt({{ cond = (Ra.sq < 0); }});
2051 0x38: blbc({{ cond = ((Ra & 1) == 0); }});
2052 0x3c: blbs({{ cond = ((Ra & 1) == 1); }});
2054 0x31: fbeq({{ cond = (Fa == 0); }});
2055 0x35: fbne({{ cond = (Fa != 0); }});
2056 0x36: fbge({{ cond = (Fa >= 0); }});
2057 0x37: fbgt({{ cond = (Fa > 0); }});
2058 0x33: fble({{ cond = (Fa <= 0); }});
2059 0x32: fblt({{ cond = (Fa < 0); }});
2062 // unconditional branches
2063 format UncondBranch {
2068 // indirect branches
2069 0x1a: decode JMPFUNC {
2074 3: jsr_coroutine(IsCall, IsReturn);
2078 // IEEE floating point
2079 0x14: decode FP_SHORTFUNC {
2080 // Integer to FP register moves must have RB == 31
2082 31: decode FP_FULLFUNC {
2083 format BasicOperateWithNopCheck {
2084 0x004: itofs({{ Fc.uq = s_to_t(Ra.ul); }}, FloatCVT);
2085 0x024: itoft({{ Fc.uq = Ra.uq; }}, FloatCVT);
2086 0x014: FailUnimpl::itoff(); // VAX-format conversion
2091 // Square root instructions must have FA == 31
2093 31: decode FP_TYPEFUNC {
2094 format FloatingPointOperate {
2095 #ifdef SS_COMPATIBLE_FP
2098 fault = Arithmetic_Fault;
2104 fault = Arithmetic_Fault;
2105 Fc.sf = sqrt(Fb.sf);
2110 fault = Arithmetic_Fault;
2117 // VAX-format sqrtf and sqrtg are not implemented
2118 0xa: FailUnimpl::sqrtfg();
2121 // IEEE floating point
2122 0x16: decode FP_SHORTFUNC_TOP2 {
2123 // The top two bits of the short function code break this space
2124 // into four groups: binary ops, compares, reserved, and conversions.
2125 // See Table 4-12 of AHB.
2126 // Most of these instructions may have various trapping and
2127 // rounding mode flags set; these are decoded in the
2128 // FloatingPointDecode template used by the
2129 // FloatingPointOperate format.
2131 // add/sub/mul/div: just decode on the short function code
2133 0: decode FP_TYPEFUNC {
2134 format FloatingPointOperate {
2135 #ifdef SS_COMPATIBLE_FP
2136 0x00: adds({{ Fc = Fa + Fb; }});
2137 0x01: subs({{ Fc = Fa - Fb; }});
2138 0x02: muls({{ Fc = Fa * Fb; }}, FloatMULT);
2139 0x03: divs({{ Fc = Fa / Fb; }}, FloatDIV);
2141 0x00: adds({{ Fc.sf = Fa.sf + Fb.sf; }});
2142 0x01: subs({{ Fc.sf = Fa.sf - Fb.sf; }});
2143 0x02: muls({{ Fc.sf = Fa.sf * Fb.sf; }}, FloatMULT);
2144 0x03: divs({{ Fc.sf = Fa.sf / Fb.sf; }}, FloatDIV);
2147 0x20: addt({{ Fc = Fa + Fb; }});
2148 0x21: subt({{ Fc = Fa - Fb; }});
2149 0x22: mult({{ Fc = Fa * Fb; }}, FloatMULT);
2150 0x23: divt({{ Fc = Fa / Fb; }}, FloatDIV);
2154 // Floating-point compare instructions must have the default
2155 // rounding mode, and may use the default trapping mode or
2156 // /SU. Both trapping modes are treated the same by M5; the
2157 // only difference on the real hardware (as far a I can tell)
2158 // is that without /SU you'd get an imprecise trap if you
2159 // tried to compare a NaN with something else (instead of an
2160 // "unordered" result).
2161 1: decode FP_FULLFUNC {
2162 format BasicOperateWithNopCheck {
2163 0x0a5, 0x5a5: cmpteq({{ Fc = (Fa == Fb) ? 2.0 : 0.0; }},
2165 0x0a7, 0x5a7: cmptle({{ Fc = (Fa <= Fb) ? 2.0 : 0.0; }},
2167 0x0a6, 0x5a6: cmptlt({{ Fc = (Fa < Fb) ? 2.0 : 0.0; }},
2169 0x0a4, 0x5a4: cmptun({{ // unordered
2170 Fc = (!(Fa < Fb) && !(Fa == Fb) && !(Fa > Fb)) ? 2.0 : 0.0;
2175 // The FP-to-integer and integer-to-FP conversion insts
2176 // require that FA be 31.
2178 31: decode FP_TYPEFUNC {
2179 format FloatingPointOperate {
2180 0x2f: cvttq({{ Fc.sq = (int64_t)rint(Fb); }});
2182 // The cvtts opcode is overloaded to be cvtst if the trap
2183 // mode is 2 or 6 (which are not valid otherwise)
2184 0x2c: decode FP_FULLFUNC {
2185 format BasicOperateWithNopCheck {
2186 // trap on denorm version "cvtst/s" is
2187 // simulated same as cvtst
2188 0x2ac, 0x6ac: cvtst({{ Fc = Fb.sf; }});
2190 default: cvtts({{ Fc.sf = Fb; }});
2193 // The trapping mode for integer-to-FP conversions
2194 // must be /SUI or nothing; /U and /SU are not
2195 // allowed. The full set of rounding modes are
2196 // supported though.
2197 0x3c: decode FP_TRAPMODE {
2198 0,7: cvtqs({{ Fc.sf = Fb.sq; }});
2200 0x3e: decode FP_TRAPMODE {
2201 0,7: cvtqt({{ Fc = Fb.sq; }});
2209 0x17: decode FP_FULLFUNC {
2210 format BasicOperateWithNopCheck {
2212 Fc.sl = (Fb.uq<63:62> << 30) | Fb.uq<58:29>;
2215 Fc.uq = (Fb.uq<31:30> << 62) | (Fb.uq<29:0> << 29);
2218 // We treat the precise & imprecise trapping versions of
2219 // cvtql identically.
2220 0x130, 0x530: cvtqlv({{
2221 // To avoid overflow, all the upper 32 bits must match
2222 // the sign bit of the lower 32. We code this as
2223 // checking the upper 33 bits for all 0s or all 1s.
2224 uint64_t sign_bits = Fb.uq<63:31>;
2225 if (sign_bits != 0 && sign_bits != mask(33))
2226 fault = Integer_Overflow_Fault;
2227 Fc.uq = (Fb.uq<31:30> << 62) | (Fb.uq<29:0> << 29);
2230 0x020: cpys({{ // copy sign
2231 Fc.uq = (Fa.uq<63:> << 63) | Fb.uq<62:0>;
2233 0x021: cpysn({{ // copy sign negated
2234 Fc.uq = (~Fa.uq<63:> << 63) | Fb.uq<62:0>;
2236 0x022: cpyse({{ // copy sign and exponent
2237 Fc.uq = (Fa.uq<63:52> << 52) | Fb.uq<51:0>;
2240 0x02a: fcmoveq({{ Fc = (Fa == 0) ? Fb : Fc; }});
2241 0x02b: fcmovne({{ Fc = (Fa != 0) ? Fb : Fc; }});
2242 0x02c: fcmovlt({{ Fc = (Fa < 0) ? Fb : Fc; }});
2243 0x02d: fcmovge({{ Fc = (Fa >= 0) ? Fb : Fc; }});
2244 0x02e: fcmovle({{ Fc = (Fa <= 0) ? Fb : Fc; }});
2245 0x02f: fcmovgt({{ Fc = (Fa > 0) ? Fb : Fc; }});
2247 0x024: mt_fpcr({{ FPCR = Fa.uq; }});
2248 0x025: mf_fpcr({{ Fa.uq = FPCR; }});
2252 // miscellaneous mem-format ops
2253 0x18: decode MEMFUNC {
2260 format MiscPrefetch {
2261 0xf800: wh64({{ EA = Rb; }},
2262 {{ xc->writeHint(EA, 64); }},
2263 IsMemRef, IsStore, WrPort);
2266 format BasicOperate {
2269 Ra = xc->readIpr(AlphaISA::IPR_CC, fault);
2275 // All of the barrier instructions below do nothing in
2276 // their execute() methods (hence the empty code blocks).
2277 // All of their functionality is hard-coded in the
2278 // pipeline based on the flags IsSerializing,
2279 // IsMemBarrier, and IsWriteBarrier. In the current
2280 // detailed CPU model, the execute() function only gets
2281 // called at fetch, so there's no way to generate pipeline
2282 // behavior at any other stage. Once we go to an
2283 // exec-in-exec CPU model we should be able to get rid of
2284 // these flags and implement this behavior via the
2285 // execute() methods.
2287 // trapb is just a barrier on integer traps, where excb is
2288 // a barrier on integer and FP traps. "EXCB is thus a
2289 // superset of TRAPB." (Alpha ARM, Sec 4.11.4) We treat
2290 // them the same though.
2291 0x0000: trapb({{ }}, IsSerializing, No_OpClass);
2292 0x0400: excb({{ }}, IsSerializing, No_OpClass);
2293 0x4000: mb({{ }}, IsMemBarrier, RdPort);
2294 0x4400: wmb({{ }}, IsWriteBarrier, WrPort);
2298 format BasicOperate {
2300 Ra = xc->readIntrFlag();
2301 if (!xc->misspeculating()) {
2306 Ra = xc->readIntrFlag();
2307 if (!xc->misspeculating()) {
2321 0x00: CallPal::call_pal({{
2324 && xc->readIpr(AlphaISA::IPR_ICM, fault) != AlphaISA::mode_kernel)) {
2325 // invalid pal function code, or attempt to do privileged
2326 // PAL call in non-kernel mode
2327 fault = Unimplemented_Opcode_Fault;
2332 if (!xc->misspeculating()) {
2333 // check to see if simulator wants to do something special
2334 // on this PAL call (including maybe suppress it)
2335 dopal = xc->simPalCheck(palFunc);
2337 Annotate::Callpal(xc->xcBase(), palFunc);
2340 AlphaISA::swap_palshadow(&xc->xcBase()->regs, true);
2341 xc->setIpr(AlphaISA::IPR_EXC_ADDR, NPC);
2345 // if we're misspeculating, it's still safe (if
2346 // unrealistic) to set NPC, as the control-flow change
2347 // won't get committed.
2349 NPC = xc->readIpr(AlphaISA::IPR_PAL_BASE, fault) + palOffset;
2354 0x00: decode PALFUNC {
2355 format EmulatedCallPal {
2357 if (!xc->misspeculating())
2358 SimExit(curTick, "halt instruction encountered");
2361 if (!xc->misspeculating())
2364 // Read uniq reg into ABI return value register (r0)
2365 0x9e: rduniq({{ R0 = Runiq; }});
2366 // Write uniq reg with value from ABI arg register (r16)
2367 0x9f: wruniq({{ Runiq = R16; }});
2373 format HwLoadStore {
2374 0x1b: decode HW_LDST_QUAD {
2375 0: hw_ld({{ EA = (Rb + disp) & ~3; }}, {{ Ra = Mem.ul; }}, L);
2376 1: hw_ld({{ EA = (Rb + disp) & ~7; }}, {{ Ra = Mem.uq; }}, Q);
2379 0x1f: decode HW_LDST_COND {
2380 0: decode HW_LDST_QUAD {
2381 0: hw_st({{ EA = (Rb + disp) & ~3; }},
2382 {{ Mem.ul = Ra<31:0>; }}, L);
2383 1: hw_st({{ EA = (Rb + disp) & ~7; }},
2384 {{ Mem.uq = Ra.uq; }}, Q);
2387 1: FailUnimpl::hw_st_cond();
2391 format BasicOperate {
2392 0x1e: hw_rei({{ xc->hwrei(); }});
2394 // M5 special opcodes use the reserved 0x01 opcode space
2395 0x01: decode M5FUNC {
2397 if (!xc->misspeculating()) {
2398 Annotate::ARM(xc->xcBase());
2399 xc->xcBase()->kernelStats.arm();
2403 if (!xc->misspeculating())
2404 AlphaPseudo::quiesce(xc->xcBase());
2407 if (!xc->misspeculating()) {
2408 Annotate::BeginInterval(xc->xcBase());
2409 xc->xcBase()->kernelStats.ivlb();
2413 if (!xc->misspeculating())
2414 Annotate::EndInterval(xc->xcBase());
2417 if (!xc->misspeculating())
2418 AlphaPseudo::m5exit_old(xc->xcBase());
2421 if (!xc->misspeculating())
2422 AlphaPseudo::m5exit(xc->xcBase());
2424 0x30: initparam({{ Ra = xc->xcBase()->cpu->system->init_param; }});
2426 if (!xc->misspeculating())
2427 AlphaPseudo::resetstats(xc->xcBase());
2430 if (!xc->misspeculating())
2431 AlphaPseudo::dumpstats(xc->xcBase());
2433 0x42: dumpresetstats({{
2434 if (!xc->misspeculating())
2435 AlphaPseudo::dumpresetstats(xc->xcBase());
2437 0x43: m5checkpoint({{
2438 if (!xc->misspeculating())
2439 AlphaPseudo::m5checkpoint(xc->xcBase());
2446 // this instruction is only valid in PAL mode
2447 if (!xc->inPalMode()) {
2448 fault = Unimplemented_Opcode_Fault;
2451 Ra = xc->readIpr(ipr_index, fault);
2455 // this instruction is only valid in PAL mode
2456 if (!xc->inPalMode()) {
2457 fault = Unimplemented_Opcode_Fault;
2460 xc->setIpr(ipr_index, Ra);
2461 if (traceData) { traceData->setData(Ra); }