3 // Copyright (c) 2007 MIPS Technologies, Inc.
4 // All rights reserved.
6 // Redistribution and use in source and binary forms, with or without
7 // modification, are permitted provided that the following conditions are
8 // met: redistributions of source code must retain the above copyright
9 // notice, this list of conditions and the following disclaimer;
10 // redistributions in binary form must reproduce the above copyright
11 // notice, this list of conditions and the following disclaimer in the
12 // documentation and/or other materials provided with the distribution;
13 // neither the name of the copyright holders nor the names of its
14 // contributors may be used to endorse or promote products derived from
15 // this software without specific prior written permission.
17 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
18 // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
19 // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
20 // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
21 // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
22 // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
23 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
24 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
25 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
26 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
27 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29 ////////////////////////////////////////////////////////////////////
31 // The actual MIPS32 ISA decoder
32 // -----------------------------
33 // The following instructions are specified in the MIPS32 ISA
34 // Specification. Decoding closely follows the style specified
35 // in the MIPS32 ISA specification document starting with Table
36 // A-2 (document available @ http://www.mips.com)
38 decode OPCODE_HI default Unknown::unknown() {
40 0x0: decode OPCODE_LO {
41 0x0: decode FUNCTION_HI {
42 0x0: decode FUNCTION_LO {
46 Rd = (getCondCode(FCSR, CC) == 0) ? Rd : Rs;
49 Rd = (getCondCode(FCSR, CC) == 1) ? Rd : Rs;
55 //Table A-3 Note: "Specific encodings of the rd, rs, and
56 //rt fields are used to distinguish SLL, SSNOP, and EHB
60 0x0: decode SA default Nop::nop() {
64 default: sll({{ Rd = Rt << SA; }});
70 0: srl({{ Rd = Rt >> SA; }});
72 //Hardcoded assuming 32-bit ISA,
73 //probably need parameter here
75 Rd = (Rt << (32 - SA)) | (Rt >> SA);
82 uint32_t temp = Rt >> SA;
83 if ( (Rt & 0x80000000) > 0 ) {
84 uint32_t mask = 0x80000000;
85 for(int i=0; i < SA; i++) {
94 0x4: sllv({{ Rd = Rt << Rs<4:0>; }});
97 0: srlv({{ Rd = Rt >> Rs<4:0>; }});
99 //Hardcoded assuming 32-bit ISA,
100 //probably need parameter here
102 Rd = (Rt << (32 - Rs<4:0>)) | (Rt >> Rs<4:0>);
107 int shift_amt = Rs<4:0>;
109 uint32_t temp = Rt >> shift_amt;
111 if ((Rt & 0x80000000) > 0) {
112 uint32_t mask = 0x80000000;
113 for (int i = 0; i < shift_amt; i++) {
123 0x1: decode FUNCTION_LO {
124 //Table A-3 Note: "Specific encodings of the hint field are
125 //used to distinguish JR from JR.HB and JALR from JALR.HB"
129 Config1Reg config1 = Config1;
130 if (config1.ca == 0) {
133 panic("MIPS16e not supported\n");
135 }}, IsReturn, ClearHazards);
137 Config1Reg config1 = Config1;
138 if (config1.ca == 0) {
141 panic("MIPS16e not supported\n");
150 }}, IsCall, ClearHazards);
159 0x2: movz({{ Rd = (Rt == 0) ? Rs : Rd; }});
160 0x3: movn({{ Rd = (Rt != 0) ? Rs : Rd; }});
161 0x4: decode FullSystemInt {
163 fault = std::make_shared<SESyscallFault>();
166 fault = std::make_shared<SystemCallFault>();
169 0x7: sync({{ ; }}, IsMemBarrier);
170 0x5: break({{fault = std::make_shared<BreakpointFault>();}});
175 0x2: decode FUNCTION_LO {
176 0x0: HiLoRsSelOp::mfhi({{ Rd = HI_RS_SEL; }},
177 IntMultOp, IsIprAccess);
178 0x1: HiLoRdSelOp::mthi({{ HI_RD_SEL = Rs; }});
179 0x2: HiLoRsSelOp::mflo({{ Rd = LO_RS_SEL; }},
180 IntMultOp, IsIprAccess);
181 0x3: HiLoRdSelOp::mtlo({{ LO_RD_SEL = Rs; }});
184 0x3: decode FUNCTION_LO {
185 format HiLoRdSelValOp {
186 0x0: mult({{ val = Rs_sd * Rt_sd; }}, IntMultOp);
187 0x1: multu({{ val = Rs_ud * Rt_ud; }}, IntMultOp);
208 0x0: decode FUNCTION_LO {
212 Rd = result = Rs + Rt;
214 findOverflow(32, result, Rs, Rt)) {
215 fault = std::make_shared<IntegerOverflowFault>();
218 0x1: addu({{ Rd = Rs_sw + Rt_sw;}});
221 Rd = result = Rs - Rt;
223 findOverflow(32, result, Rs, ~Rt)) {
224 fault = std::make_shared<IntegerOverflowFault>();
227 0x3: subu({{ Rd = Rs_sw - Rt_sw; }});
228 0x4: and({{ Rd = Rs & Rt; }});
229 0x5: or({{ Rd = Rs | Rt; }});
230 0x6: xor({{ Rd = Rs ^ Rt; }});
231 0x7: nor({{ Rd = ~(Rs | Rt); }});
237 0x0: decode FUNCTION_LO {
239 0x2: slt({{ Rd = (Rs_sw < Rt_sw) ? 1 : 0 }});
240 0x3: sltu({{ Rd = (Rs < Rt) ? 1 : 0 }});
245 0x6: decode FUNCTION_LO {
247 0x0: tge({{ cond = (Rs_sw >= Rt_sw); }});
248 0x1: tgeu({{ cond = (Rs >= Rt); }});
249 0x2: tlt({{ cond = (Rs_sw < Rt_sw); }});
250 0x3: tltu({{ cond = (Rs < Rt); }});
251 0x4: teq({{ cond = (Rs_sw == Rt_sw); }});
252 0x6: tne({{ cond = (Rs_sw != Rt_sw); }});
257 0x1: decode REGIMM_HI {
258 0x0: decode REGIMM_LO {
260 0x0: bltz({{ cond = (Rs_sw < 0); }});
261 0x1: bgez({{ cond = (Rs_sw >= 0); }});
262 0x2: bltzl({{ cond = (Rs_sw < 0); }}, Likely);
263 0x3: bgezl({{ cond = (Rs_sw >= 0); }}, Likely);
267 0x1: decode REGIMM_LO {
269 0x0: tgei( {{ cond = (Rs_sw >= (int16_t)INTIMM); }});
271 cond = (Rs >= (uint32_t)(int32_t)(int16_t)INTIMM);
273 0x2: tlti( {{ cond = (Rs_sw < (int16_t)INTIMM); }});
275 cond = (Rs < (uint32_t)(int32_t)(int16_t)INTIMM);
277 0x4: teqi( {{ cond = (Rs_sw == (int16_t)INTIMM); }});
278 0x6: tnei( {{ cond = (Rs_sw != (int16_t)INTIMM); }});
282 0x2: decode REGIMM_LO {
284 0x0: bltzal({{ cond = (Rs_sw < 0); }}, Link);
286 0x0: bal ({{ cond = 1; }}, IsCall, Link);
287 default: bgezal({{ cond = (Rs_sw >= 0); }}, Link);
289 0x2: bltzall({{ cond = (Rs_sw < 0); }}, Link, Likely);
290 0x3: bgezall({{ cond = (Rs_sw >= 0); }}, Link, Likely);
294 0x3: decode REGIMM_LO {
295 // from Table 5-4 MIPS32 REGIMM Encoding of rt Field
297 0x4: DspBranch::bposge32({{ cond = (dspctl<5:0> >= 32); }});
305 0x2: j({{ NNPC = (NPC & 0xF0000000) | (JMPTARG << 2); }});
306 0x3: jal({{ NNPC = (NPC & 0xF0000000) | (JMPTARG << 2); }},
312 0x0: b({{ cond = 1; }});
313 default: beq({{ cond = (Rs_sw == Rt_sw); }});
315 0x5: bne({{ cond = (Rs_sw != Rt_sw); }});
316 0x6: blez({{ cond = (Rs_sw <= 0); }});
317 0x7: bgtz({{ cond = (Rs_sw > 0); }});
321 0x1: decode OPCODE_LO {
325 Rt = result = Rs + imm;
327 findOverflow(32, result, Rs, imm)) {
328 fault = std::make_shared<IntegerOverflowFault>();
331 0x1: addiu({{ Rt = Rs_sw + imm; }});
332 0x2: slti({{ Rt = (Rs_sw < imm) ? 1 : 0 }});
333 0x3: sltiu({{ Rt = (Rs < (uint32_t)sextImm) ? 1 : 0;}});
334 0x4: andi({{ Rt = Rs_sw & zextImm; }});
335 0x5: ori({{ Rt = Rs_sw | zextImm; }});
336 0x6: xori({{ Rt = Rs_sw ^ zextImm; }});
339 0x0: lui({{ Rt = imm << 16; }});
344 0x2: decode OPCODE_LO {
345 //Table A-11 MIPS32 COP0 Encoding of rs Field
350 Config3Reg config3 = Config3;
351 PageGrainReg pageGrain = PageGrain;
353 /* Hack for PageMask */
356 if (config3.sp == 0 || pageGrain.esp == 0)
362 CauseReg cause = Cause;
363 IntCtlReg intCtl = IntCtl;
368 int offset = 10; // corresponding to cause.ip0
369 offset += intCtl.ipti - 2;
370 replaceBits(cause, offset, offset, 0);
382 // Decode MIPS MT MFTR instruction into sub-instructions
385 data = readRegOtherThread(xc, RegId(MiscRegClass,
390 data = readRegOtherThread(xc,
391 RegId(IntRegClass, RT));
395 data = readRegOtherThread(xc,
396 RegId(IntRegClass, INTREG_DSP_LO0));
399 data = readRegOtherThread(xc,
400 RegId(IntRegClass, INTREG_DSP_HI0));
403 data = readRegOtherThread(xc,
404 RegId(IntRegClass, INTREG_DSP_ACX0));
407 data = readRegOtherThread(xc,
408 RegId(IntRegClass, INTREG_DSP_LO1));
411 data = readRegOtherThread(xc,
412 RegId(IntRegClass, INTREG_DSP_HI1));
415 data = readRegOtherThread(xc,
416 RegId(IntRegClass, INTREG_DSP_ACX1));
419 data = readRegOtherThread(xc,
420 RegId(IntRegClass, INTREG_DSP_LO2));
423 data = readRegOtherThread(xc,
424 RegId(IntRegClass, INTREG_DSP_HI2));
427 data = readRegOtherThread(xc,
428 RegId(IntRegClass, INTREG_DSP_ACX2));
431 data = readRegOtherThread(xc,
432 RegId(IntRegClass, INTREG_DSP_LO3));
435 data = readRegOtherThread(xc,
436 RegId(IntRegClass, INTREG_DSP_HI3));
439 data = readRegOtherThread(xc,
440 RegId(IntRegClass, INTREG_DSP_ACX3));
443 data = readRegOtherThread(xc,
444 RegId(IntRegClass, INTREG_DSP_CONTROL));
446 default: CP0Unimpl::unknown();
450 data = readRegOtherThread(xc,
451 RegId(FloatRegClass, RT));
454 data = readRegOtherThread(xc,
455 RegId(FloatRegClass, RT));
459 uint32_t fcsr_val = readRegOtherThread(xc,
460 RegId(FloatRegClass, FLOATREG_FCSR));
463 data = readRegOtherThread(xc,
464 RegId(MiscRegClass, FLOATREG_FIR));
467 data = (fcsr_val & 0xFE000000 >> 24) |
468 (fcsr_val & 0x00800000 >> 23);
471 data = fcsr_val & 0x0003F07C;
474 data = (fcsr_val & 0x00000F80) |
475 (fcsr_val & 0x01000000 >> 21) |
476 (fcsr_val & 0x00000003);
482 fatal("FP Control Value (%d) Not Valid");
485 default: CP0Unimpl::unknown();
491 // Decode MIPS MT MTTR instruction into sub-instructions
493 0x0: mttc0({{ setRegOtherThread(xc,
494 RegId(MiscRegClass, (RD << 3 | SEL)), Rt);
497 0x0: mttgpr({{ setRegOtherThread(xc,
498 RegId(IntRegClass, RD), Rt);
501 0x0: mttlo_dsp0({{ setRegOtherThread(xc,
502 RegId(IntRegClass, INTREG_DSP_LO0), Rt);
504 0x1: mtthi_dsp0({{ setRegOtherThread(xc,
505 RegId(IntRegClass, INTREG_DSP_HI0), Rt);
507 0x2: mttacx_dsp0({{ setRegOtherThread(xc,
508 RegId(IntRegClass, INTREG_DSP_ACX0), Rt);
510 0x4: mttlo_dsp1({{ setRegOtherThread(xc,
511 RegId(IntRegClass, INTREG_DSP_LO1), Rt);
513 0x5: mtthi_dsp1({{ setRegOtherThread(xc,
514 RegId(IntRegClass, INTREG_DSP_HI1), Rt);
516 0x6: mttacx_dsp1({{ setRegOtherThread(xc,
517 RegId(IntRegClass, INTREG_DSP_ACX1), Rt);
519 0x8: mttlo_dsp2({{ setRegOtherThread(xc,
520 RegId(IntRegClass, INTREG_DSP_LO2), Rt);
522 0x9: mtthi_dsp2({{ setRegOtherThread(xc,
523 RegId(IntRegClass, INTREG_DSP_HI2), Rt);
525 0x10: mttacx_dsp2({{ setRegOtherThread(xc,
526 RegId(IntRegClass, INTREG_DSP_ACX2), Rt);
528 0x12: mttlo_dsp3({{ setRegOtherThread(xc,
529 RegId(IntRegClass, INTREG_DSP_LO3), Rt);
531 0x13: mtthi_dsp3({{ setRegOtherThread(xc,
532 RegId(IntRegClass, INTREG_DSP_HI3), Rt);
534 0x14: mttacx_dsp3({{ setRegOtherThread(xc,
535 RegId(IntRegClass, INTREG_DSP_ACX3), Rt);
537 0x16: mttdsp({{ setRegOtherThread(xc,
538 RegId(IntRegClass, INTREG_DSP_CONTROL), Rt);
540 default: CP0Unimpl::unknown();
544 uint64_t data = readRegOtherThread(xc,
545 RegId(FloatRegClass, RD));
546 data = insertBits(data, MT_H ? 63 : 31,
548 setRegOtherThread(xc, RegId(FloatRegClass, RD),
555 data = (Rt<7:1> << 25) | // move 31-25
556 (FCSR & 0x01000000) | // bit 24
557 (FCSR & 0x004FFFFF); // bit 22-0
560 data = (FCSR & 0xFFFC0000) | // move 31-18
561 Rt<17:12> << 12 | // bit 17-12
563 (FCSR & 0x00000F80) << 7 |
564 Rt<6:2> << 2 | // bit 6-2
565 (FCSR & 0x00000002); // bit 1...0
568 data = (FCSR & 0xFE000000) | // move 31-25
569 Rt<2:2> << 24 | // bit 24
571 (FCSR & 0x00FFF000) << 23 |
572 Rt<11:7> << 7 | // bit 24
580 panic("FP Control Value (%d) "
581 "Not Available. Ignoring "
582 "Access to Floating Control "
583 "S""tatus Register", FS);
585 setRegOtherThread(xc,
586 RegId(FloatRegClass, FLOATREG_FCSR), data);
588 default: CP0Unimpl::unknown();
598 MVPControlReg mvpControl = MVPControl;
599 VPEConf0Reg vpeConf0 = VPEConf0;
601 if (vpeConf0.mvp == 1)
603 MVPControl = mvpControl;
606 MVPControlReg mvpControl = MVPControl;
607 VPEConf0Reg vpeConf0 = VPEConf0;
609 if (vpeConf0.mvp == 1)
611 MVPControl = mvpControl;
613 default:CP0Unimpl::unknown();
615 default:CP0Unimpl::unknown();
617 default:CP0Unimpl::unknown();
623 VPEControlReg vpeControl = VPEControl;
626 VPEControl = vpeControl;
629 VPEControlReg vpeControl = VPEControl;
632 VPEControl = vpeControl;
634 default:CP0Unimpl::unknown();
636 default:CP0Unimpl::unknown();
638 default:CP0Unimpl::unknown();
643 0x0: CP0Control::di({{
644 StatusReg status = Status;
645 ConfigReg config = Config;
646 // Rev 2.0 or beyond?
647 if (config.ar >= 1) {
651 // Enable this else branch once we
652 // actually set values for Config on init
653 fault = std::make_shared<ReservedInstructionFault>();
657 0x1: CP0Control::ei({{
658 StatusReg status = Status;
659 ConfigReg config = Config;
660 if (config.ar >= 1) {
664 fault = std::make_shared<ReservedInstructionFault>();
667 default:CP0Unimpl::unknown();
670 default: CP0Unimpl::unknown();
674 ConfigReg config = Config;
675 if (config.ar >= 1) {
676 // Rev 2 of the architecture
677 panic("Shadow Sets Not Fully Implemented.\n");
679 fault = std::make_shared<ReservedInstructionFault>();
683 ConfigReg config = Config;
684 if (config.ar >= 1) {
685 // Rev 2 of the architecture
686 panic("Shadow Sets Not Fully Implemented.\n");
688 fault = std::make_shared<ReservedInstructionFault>();
694 //Table A-12 MIPS32 COP0 Encoding of Function Field When rs=CO
695 0x1: decode FUNCTION {
698 StatusReg status = Status;
699 ConfigReg config = Config;
700 SRSCtlReg srsCtl = SRSCtl;
701 DPRINTF(MipsPRA,"Restoring PC - %x\n",EPC);
702 if (status.erl == 1) {
705 // Need to adjust NNPC, otherwise things break
706 NNPC = ErrorEPC + sizeof(MachInst);
709 // Need to adjust NNPC, otherwise things break
710 NNPC = EPC + sizeof(MachInst);
715 srsCtl.css = srsCtl.pss;
716 //xc->setShadowSet(srsCtl.pss);
722 }}, IsReturn, IsSerializing);
725 DebugReg debug = Debug;
735 }}, IsReturn, IsSerializing);
739 MipsISA::PTE *PTEntry =
740 dynamic_cast<MipsISA::TLB *>(
741 xc->tcBase()->getITBPtr())->
742 getEntry(Index & 0x7FFFFFFF);
743 if (PTEntry == NULL) {
744 fatal("Invalid PTE Entry received on "
745 "a TLBR instruction\n");
748 // If 1KB pages are not enabled, a read of PageMask
749 // must return 0b00 in bits 12, 11
750 PageMask = (PTEntry->Mask << 11);
752 EntryHi = ((PTEntry->VPN << 11) | (PTEntry->asid));
753 /* Setup Entry Lo0 */
754 EntryLo0 = ((PTEntry->PFN0 << 6) |
759 /* Setup Entry Lo1 */
760 EntryLo1 = ((PTEntry->PFN1 << 6) |
765 }}); // Need to hook up to TLB
769 MipsISA::PTE newEntry;
771 newEntry.Mask = (Addr)(PageMask >> 11);
772 newEntry.VPN = (Addr)(EntryHi >> 11);
773 /* PageGrain _ ESP Config3 _ SP */
774 if (bits(PageGrain, 28) == 0 || bits(Config3, 4) ==0) {
775 // If 1KB pages are *NOT* enabled, lowest bits of
776 // the mask are 0b11 for TLB writes
777 newEntry.Mask |= 0x3;
778 // Reset bits 0 and 1 if 1KB pages are not enabled
779 newEntry.VPN &= 0xFFFFFFFC;
781 newEntry.asid = (uint8_t)(EntryHi & 0xFF);
783 newEntry.PFN0 = (Addr)(EntryLo0 >> 6);
784 newEntry.PFN1 = (Addr)(EntryLo1 >> 6);
785 newEntry.D0 = (bool)((EntryLo0 >> 2) & 1);
786 newEntry.D1 = (bool)((EntryLo1 >> 2) & 1);
787 newEntry.V1 = (bool)((EntryLo1 >> 1) & 1);
788 newEntry.V0 = (bool)((EntryLo0 >> 1) & 1);
789 newEntry.G = (bool)((EntryLo0 & EntryLo1) & 1);
790 newEntry.C0 = (uint8_t)((EntryLo0 >> 3) & 0x7);
791 newEntry.C1 = (uint8_t)((EntryLo1 >> 3) & 0x7);
792 /* Now, compute the AddrShiftAmount and OffsetMask -
794 /* Addr Shift Amount for 1KB or larger pages */
795 if ((newEntry.Mask & 0xFFFF) == 3) {
796 newEntry.AddrShiftAmount = 12;
797 } else if ((newEntry.Mask & 0xFFFF) == 0x0000) {
798 newEntry.AddrShiftAmount = 10;
799 } else if ((newEntry.Mask & 0xFFFC) == 0x000C) {
800 newEntry.AddrShiftAmount = 14;
801 } else if ((newEntry.Mask & 0xFFF0) == 0x0030) {
802 newEntry.AddrShiftAmount = 16;
803 } else if ((newEntry.Mask & 0xFFC0) == 0x00C0) {
804 newEntry.AddrShiftAmount = 18;
805 } else if ((newEntry.Mask & 0xFF00) == 0x0300) {
806 newEntry.AddrShiftAmount = 20;
807 } else if ((newEntry.Mask & 0xFC00) == 0x0C00) {
808 newEntry.AddrShiftAmount = 22;
809 } else if ((newEntry.Mask & 0xF000) == 0x3000) {
810 newEntry.AddrShiftAmount = 24;
811 } else if ((newEntry.Mask & 0xC000) == 0xC000) {
812 newEntry.AddrShiftAmount = 26;
813 } else if ((newEntry.Mask & 0x30000) == 0x30000) {
814 newEntry.AddrShiftAmount = 28;
816 fatal("Invalid Mask Pattern Detected!\n");
818 newEntry.OffsetMask =
819 (1 << newEntry.AddrShiftAmount) - 1;
821 auto ptr = dynamic_cast<MipsISA::TLB *>(
822 xc->tcBase()->getITBPtr());
823 Config3Reg config3 = Config3;
824 PageGrainReg pageGrain = PageGrain;
826 if (bits(config3, config3.sp) == 1 &&
827 bits(pageGrain, pageGrain.esp) == 1) {
830 ptr->insertAt(newEntry, Index & 0x7FFFFFFF, SP);
834 MipsISA::PTE newEntry;
836 newEntry.Mask = (Addr)(PageMask >> 11);
837 newEntry.VPN = (Addr)(EntryHi >> 11);
838 /* PageGrain _ ESP Config3 _ SP */
839 if (bits(PageGrain, 28) == 0 ||
840 bits(Config3, 4) == 0) {
841 // If 1KB pages are *NOT* enabled, lowest bits of
842 // the mask are 0b11 for TLB writes
843 newEntry.Mask |= 0x3;
844 // Reset bits 0 and 1 if 1KB pages are not enabled
845 newEntry.VPN &= 0xFFFFFFFC;
847 newEntry.asid = (uint8_t)(EntryHi & 0xFF);
849 newEntry.PFN0 = (Addr)(EntryLo0 >> 6);
850 newEntry.PFN1 = (Addr)(EntryLo1 >> 6);
851 newEntry.D0 = (bool)((EntryLo0 >> 2) & 1);
852 newEntry.D1 = (bool)((EntryLo1 >> 2) & 1);
853 newEntry.V1 = (bool)((EntryLo1 >> 1) & 1);
854 newEntry.V0 = (bool)((EntryLo0 >> 1) & 1);
855 newEntry.G = (bool)((EntryLo0 & EntryLo1) & 1);
856 newEntry.C0 = (uint8_t)((EntryLo0 >> 3) & 0x7);
857 newEntry.C1 = (uint8_t)((EntryLo1 >> 3) & 0x7);
858 /* Now, compute the AddrShiftAmount and OffsetMask -
860 /* Addr Shift Amount for 1KB or larger pages */
861 if ((newEntry.Mask & 0xFFFF) == 3){
862 newEntry.AddrShiftAmount = 12;
863 } else if ((newEntry.Mask & 0xFFFF) == 0x0000) {
864 newEntry.AddrShiftAmount = 10;
865 } else if ((newEntry.Mask & 0xFFFC) == 0x000C) {
866 newEntry.AddrShiftAmount = 14;
867 } else if ((newEntry.Mask & 0xFFF0) == 0x0030) {
868 newEntry.AddrShiftAmount = 16;
869 } else if ((newEntry.Mask & 0xFFC0) == 0x00C0) {
870 newEntry.AddrShiftAmount = 18;
871 } else if ((newEntry.Mask & 0xFF00) == 0x0300) {
872 newEntry.AddrShiftAmount = 20;
873 } else if ((newEntry.Mask & 0xFC00) == 0x0C00) {
874 newEntry.AddrShiftAmount = 22;
875 } else if ((newEntry.Mask & 0xF000) == 0x3000) {
876 newEntry.AddrShiftAmount = 24;
877 } else if ((newEntry.Mask & 0xC000) == 0xC000) {
878 newEntry.AddrShiftAmount = 26;
879 } else if ((newEntry.Mask & 0x30000) == 0x30000) {
880 newEntry.AddrShiftAmount = 28;
882 fatal("Invalid Mask Pattern Detected!\n");
884 newEntry.OffsetMask =
885 (1 << newEntry.AddrShiftAmount) - 1;
887 auto ptr = dynamic_cast<MipsISA::TLB *>(
888 xc->tcBase()->getITBPtr());
889 Config3Reg config3 = Config3;
890 PageGrainReg pageGrain = PageGrain;
892 if (bits(config3, config3.sp) == 1 &&
893 bits(pageGrain, pageGrain.esp) == 1) {
896 ptr->insertAt(newEntry, Random, SP);
900 Config3Reg config3 = Config3;
901 PageGrainReg pageGrain = PageGrain;
902 EntryHiReg entryHi = EntryHi;
905 if (pageGrain.esp == 1 && config3.sp ==1) {
908 // Mask off lower 2 bits
909 vpn = ((EntryHi >> 11) & 0xFFFFFFFC);
911 tlbIndex = dynamic_cast<MipsISA::TLB *>(
912 xc->tcBase()->getITBPtr())->
913 probeEntry(vpn, entryHi.asid);
914 // Check TLB for entry matching EntryHi
915 if (tlbIndex != -1) {
918 // else, set Index = 1 << 31
926 default: CP0Unimpl::unknown();
930 //Table A-13 MIPS32 COP1 Encoding of rs Field
935 0x0: mfc1 ({{ Rt = Fs_uw; }});
943 Rt = (FCSR & 0xFE000000) >> 24 |
944 (FCSR & 0x00800000) >> 23;
947 Rt = (FCSR & 0x0003F07C);
950 Rt = (FCSR & 0x00000F80) |
951 (FCSR & 0x01000000) >> 21 |
958 warn("FP Control Value (%d) Not Valid");
962 0x3: mfhc1({{ Rt = Fs_ud<63:32>; }});
964 0x4: mtc1({{ Fs_uw = Rt; }});
969 FCSR = (Rt<7:1> << 25) | // move 31-25
970 (FCSR & 0x01000000) | // bit 24
971 (FCSR & 0x004FFFFF); // bit 22-0
974 FCSR = (FCSR & 0xFFFC0000) | // move 31-18
975 Rt<17:12> << 12 | // bit 17-12
976 (FCSR & 0x00000F80) << 7 | // bit 11-7
977 Rt<6:2> << 2 | // bit 6-2
978 (FCSR & 0x00000002); // bit 1-0
981 FCSR = (FCSR & 0xFE000000) | // move 31-25
982 Rt<2:2> << 24 | // bit 24
983 (FCSR & 0x00FFF000) << 23 | // bit 23-12
984 Rt<11:7> << 7 | // bit 24
993 panic("FP Control Value (%d) "
994 "Not Available. Ignoring Access "
995 "to Floating Control Status "
1001 uint64_t fs_hi = Rt;
1002 uint64_t fs_lo = Fs_ud & 0x0FFFFFFFF;
1003 Fs_ud = (fs_hi << 32) | fs_lo;
1018 cond = getCondCode(FCSR, BRANCH_CC) == 0;
1021 cond = getCondCode(FCSR, BRANCH_CC) == 1;
1026 cond = getCondCode(FCSR, BRANCH_CC) == 0;
1029 cond = getCondCode(FCSR, BRANCH_CC) == 1;
1044 //Table A-14 MIPS32 COP1 Encoding of Function Field When
1045 //rs=S (( single-precision floating point))
1046 0x0: decode FUNCTION_HI {
1047 0x0: decode FUNCTION_LO {
1049 0x0: add_s({{ Fd_sf = Fs_sf + Ft_sf; }});
1050 0x1: sub_s({{ Fd_sf = Fs_sf - Ft_sf; }});
1051 0x2: mul_s({{ Fd_sf = Fs_sf * Ft_sf; }});
1052 0x3: div_s({{ Fd_sf = Fs_sf / Ft_sf; }});
1053 0x4: sqrt_s({{ Fd_sf = sqrt(Fs_sf); }});
1054 0x5: abs_s({{ Fd_sf = fabs(Fs_sf); }});
1055 0x7: neg_s({{ Fd_sf = -Fs_sf; }});
1057 0x6: BasicOp::mov_s({{ Fd_sf = Fs_sf; }});
1059 0x1: decode FUNCTION_LO {
1060 format FloatConvertOp {
1061 0x0: round_l_s({{ val = Fs_sf; }},
1063 0x1: trunc_l_s({{ val = Fs_sf; }},
1065 0x2: ceil_l_s({{ val = Fs_sf;}},
1067 0x3: floor_l_s({{ val = Fs_sf; }},
1069 0x4: round_w_s({{ val = Fs_sf; }},
1071 0x5: trunc_w_s({{ val = Fs_sf; }},
1073 0x6: ceil_w_s({{ val = Fs_sf; }},
1075 0x7: floor_w_s({{ val = Fs_sf; }},
1080 0x2: decode FUNCTION_LO {
1084 Fd = (getCondCode(FCSR,CC) == 0) ?
1088 Fd = (getCondCode(FCSR,CC) == 1) ?
1095 0x2: movz_s({{ Fd = (Rt == 0) ? Fs : Fd; }});
1096 0x3: movn_s({{ Fd = (Rt != 0) ? Fs : Fd; }});
1100 0x5: recip_s({{ Fd = 1 / Fs; }});
1101 0x6: rsqrt_s({{ Fd = 1 / sqrt(Fs); }});
1107 0x3: CP1Unimpl::unknown();
1109 0x4: decode FUNCTION_LO {
1110 format FloatConvertOp {
1111 0x1: cvt_d_s({{ val = Fs_sf; }}, ToDouble);
1112 0x4: cvt_w_s({{ val = Fs_sf; }}, ToWord);
1113 0x5: cvt_l_s({{ val = Fs_sf; }}, ToLong);
1116 0x6: FloatOp::cvt_ps_s({{
1117 Fd_ud = (uint64_t)Fs_uw << 32 |
1124 0x5: CP1Unimpl::unknown();
1126 0x6: decode FUNCTION_LO {
1127 format FloatCompareOp {
1128 0x0: c_f_s({{ cond = 0; }},
1129 SinglePrecision, UnorderedFalse);
1130 0x1: c_un_s({{ cond = 0; }},
1131 SinglePrecision, UnorderedTrue);
1132 0x2: c_eq_s({{ cond = (Fs_sf == Ft_sf); }},
1134 0x3: c_ueq_s({{ cond = (Fs_sf == Ft_sf); }},
1136 0x4: c_olt_s({{ cond = (Fs_sf < Ft_sf); }},
1138 0x5: c_ult_s({{ cond = (Fs_sf < Ft_sf); }},
1140 0x6: c_ole_s({{ cond = (Fs_sf <= Ft_sf); }},
1142 0x7: c_ule_s({{ cond = (Fs_sf <= Ft_sf); }},
1147 0x7: decode FUNCTION_LO {
1148 format FloatCompareOp {
1149 0x0: c_sf_s({{ cond = 0; }}, SinglePrecision,
1150 UnorderedFalse, QnanException);
1151 0x1: c_ngle_s({{ cond = 0; }}, SinglePrecision,
1152 UnorderedTrue, QnanException);
1153 0x2: c_seq_s({{ cond = (Fs_sf == Ft_sf); }},
1154 UnorderedFalse, QnanException);
1155 0x3: c_ngl_s({{ cond = (Fs_sf == Ft_sf); }},
1156 UnorderedTrue, QnanException);
1157 0x4: c_lt_s({{ cond = (Fs_sf < Ft_sf); }},
1158 UnorderedFalse, QnanException);
1159 0x5: c_nge_s({{ cond = (Fs_sf < Ft_sf); }},
1160 UnorderedTrue, QnanException);
1161 0x6: c_le_s({{ cond = (Fs_sf <= Ft_sf); }},
1162 UnorderedFalse, QnanException);
1163 0x7: c_ngt_s({{ cond = (Fs_sf <= Ft_sf); }},
1164 UnorderedTrue, QnanException);
1169 //Table A-15 MIPS32 COP1 Encoding of Function Field When
1171 0x1: decode FUNCTION_HI {
1172 0x0: decode FUNCTION_LO {
1174 0x0: add_d({{ Fd_df = Fs_df + Ft_df; }});
1175 0x1: sub_d({{ Fd_df = Fs_df - Ft_df; }});
1176 0x2: mul_d({{ Fd_df = Fs_df * Ft_df; }});
1177 0x3: div_d({{ Fd_df = Fs_df / Ft_df; }});
1178 0x4: sqrt_d({{ Fd_df = sqrt(Fs_df); }});
1179 0x5: abs_d({{ Fd_df = fabs(Fs_df); }});
1180 0x7: neg_d({{ Fd_df = -1 * Fs_df; }});
1182 0x6: BasicOp::mov_d({{ Fd_df = Fs_df; }});
1185 0x1: decode FUNCTION_LO {
1186 format FloatConvertOp {
1187 0x0: round_l_d({{ val = Fs_df; }},
1189 0x1: trunc_l_d({{ val = Fs_df; }},
1191 0x2: ceil_l_d({{ val = Fs_df; }},
1193 0x3: floor_l_d({{ val = Fs_df; }},
1195 0x4: round_w_d({{ val = Fs_df; }},
1197 0x5: trunc_w_d({{ val = Fs_df; }},
1199 0x6: ceil_w_d({{ val = Fs_df; }},
1201 0x7: floor_w_d({{ val = Fs_df; }},
1206 0x2: decode FUNCTION_LO {
1210 Fd_df = (getCondCode(FCSR,CC) == 0) ?
1214 Fd_df = (getCondCode(FCSR,CC) == 1) ?
1222 Fd_df = (Rt == 0) ? Fs_df : Fd_df;
1225 Fd_df = (Rt != 0) ? Fs_df : Fd_df;
1230 0x5: recip_d({{ Fd_df = 1 / Fs_df; }});
1231 0x6: rsqrt_d({{ Fd_df = 1 / sqrt(Fs_df); }});
1238 0x4: decode FUNCTION_LO {
1239 format FloatConvertOp {
1240 0x0: cvt_s_d({{ val = Fs_df; }}, ToSingle);
1241 0x4: cvt_w_d({{ val = Fs_df; }}, ToWord);
1242 0x5: cvt_l_d({{ val = Fs_df; }}, ToLong);
1244 default: CP1Unimpl::unknown();
1247 0x6: decode FUNCTION_LO {
1248 format FloatCompareOp {
1249 0x0: c_f_d({{ cond = 0; }},
1250 DoublePrecision, UnorderedFalse);
1251 0x1: c_un_d({{ cond = 0; }},
1252 DoublePrecision, UnorderedTrue);
1253 0x2: c_eq_d({{ cond = (Fs_df == Ft_df); }},
1255 0x3: c_ueq_d({{ cond = (Fs_df == Ft_df); }},
1257 0x4: c_olt_d({{ cond = (Fs_df < Ft_df); }},
1259 0x5: c_ult_d({{ cond = (Fs_df < Ft_df); }},
1261 0x6: c_ole_d({{ cond = (Fs_df <= Ft_df); }},
1263 0x7: c_ule_d({{ cond = (Fs_df <= Ft_df); }},
1268 0x7: decode FUNCTION_LO {
1269 format FloatCompareOp {
1270 0x0: c_sf_d({{ cond = 0; }}, DoublePrecision,
1271 UnorderedFalse, QnanException);
1272 0x1: c_ngle_d({{ cond = 0; }}, DoublePrecision,
1273 UnorderedTrue, QnanException);
1274 0x2: c_seq_d({{ cond = (Fs_df == Ft_df); }},
1275 UnorderedFalse, QnanException);
1276 0x3: c_ngl_d({{ cond = (Fs_df == Ft_df); }},
1277 UnorderedTrue, QnanException);
1278 0x4: c_lt_d({{ cond = (Fs_df < Ft_df); }},
1279 UnorderedFalse, QnanException);
1280 0x5: c_nge_d({{ cond = (Fs_df < Ft_df); }},
1281 UnorderedTrue, QnanException);
1282 0x6: c_le_d({{ cond = (Fs_df <= Ft_df); }},
1283 UnorderedFalse, QnanException);
1284 0x7: c_ngt_d({{ cond = (Fs_df <= Ft_df); }},
1285 UnorderedTrue, QnanException);
1288 default: CP1Unimpl::unknown();
1290 0x2: CP1Unimpl::unknown();
1291 0x3: CP1Unimpl::unknown();
1292 0x7: CP1Unimpl::unknown();
1294 //Table A-16 MIPS32 COP1 Encoding of Function
1296 0x4: decode FUNCTION {
1297 format FloatConvertOp {
1298 0x20: cvt_s_w({{ val = Fs_sw; }}, ToSingle);
1299 0x21: cvt_d_w({{ val = Fs_sw; }}, ToDouble);
1300 0x26: CP1Unimpl::cvt_ps_w();
1302 default: CP1Unimpl::unknown();
1305 //Table A-16 MIPS32 COP1 Encoding of Function Field
1307 //Note: "1. Format type L is legal only if 64-bit
1308 //floating point operations are enabled."
1309 0x5: decode FUNCTION {
1310 format FloatConvertOp {
1311 0x20: cvt_s_l({{ val = Fs_sd; }}, ToSingle);
1312 0x21: cvt_d_l({{ val = Fs_sd; }}, ToDouble);
1313 0x26: CP1Unimpl::cvt_ps_l();
1315 default: CP1Unimpl::unknown();
1318 //Table A-17 MIPS64 COP1 Encoding of Function Field
1320 //Note: "1. Format type PS is legal only if 64-bit
1321 //floating point operations are enabled. "
1322 0x6: decode FUNCTION_HI {
1323 0x0: decode FUNCTION_LO {
1326 Fd1_sf = Fs1_sf + Ft2_sf;
1327 Fd2_sf = Fs2_sf + Ft2_sf;
1330 Fd1_sf = Fs1_sf - Ft2_sf;
1331 Fd2_sf = Fs2_sf - Ft2_sf;
1334 Fd1_sf = Fs1_sf * Ft2_sf;
1335 Fd2_sf = Fs2_sf * Ft2_sf;
1338 Fd1_sf = fabs(Fs1_sf);
1339 Fd2_sf = fabs(Fs2_sf);
1349 default: CP1Unimpl::unknown();
1352 0x1: CP1Unimpl::unknown();
1353 0x2: decode FUNCTION_LO {
1357 Fd1 = (getCondCode(FCSR, CC) == 0) ?
1359 Fd2 = (getCondCode(FCSR, CC+1) == 0) ?
1363 Fd2 = (getCondCode(FCSR, CC) == 1) ?
1365 Fd2 = (getCondCode(FCSR, CC+1) == 1) ?
1373 Fd1 = (getCondCode(FCSR, CC) == 0) ?
1375 Fd2 = (getCondCode(FCSR, CC) == 0) ?
1379 Fd1 = (getCondCode(FCSR, CC) == 1) ?
1381 Fd2 = (getCondCode(FCSR, CC) == 1) ?
1385 default: CP1Unimpl::unknown();
1387 0x3: CP1Unimpl::unknown();
1388 0x4: decode FUNCTION_LO {
1389 0x0: FloatOp::cvt_s_pu({{ Fd_sf = Fs2_sf; }});
1390 default: CP1Unimpl::unknown();
1393 0x5: decode FUNCTION_LO {
1394 0x0: FloatOp::cvt_s_pl({{ Fd_sf = Fs1_sf; }});
1397 Fd_ud = (uint64_t)Fs1_uw << 32 | Ft1_uw;
1400 Fd_ud = (uint64_t)Fs1_uw << 32 | Ft2_uw;
1403 Fd_ud = (uint64_t)Fs2_uw << 32 | Ft1_uw;
1406 Fd_ud = (uint64_t)Fs2_uw << 32 | Ft2_uw;
1409 default: CP1Unimpl::unknown();
1412 0x6: decode FUNCTION_LO {
1413 format FloatPSCompareOp {
1414 0x0: c_f_ps({{ cond1 = 0; }}, {{ cond2 = 0; }},
1416 0x1: c_un_ps({{ cond1 = 0; }}, {{ cond2 = 0; }},
1418 0x2: c_eq_ps({{ cond1 = (Fs1_sf == Ft1_sf); }},
1419 {{ cond2 = (Fs2_sf == Ft2_sf); }},
1421 0x3: c_ueq_ps({{ cond1 = (Fs1_sf == Ft1_sf); }},
1422 {{ cond2 = (Fs2_sf == Ft2_sf); }},
1424 0x4: c_olt_ps({{ cond1 = (Fs1_sf < Ft1_sf); }},
1425 {{ cond2 = (Fs2_sf < Ft2_sf); }},
1427 0x5: c_ult_ps({{ cond1 = (Fs_sf < Ft_sf); }},
1428 {{ cond2 = (Fs2_sf < Ft2_sf); }},
1430 0x6: c_ole_ps({{ cond1 = (Fs_sf <= Ft_sf); }},
1431 {{ cond2 = (Fs2_sf <= Ft2_sf); }},
1433 0x7: c_ule_ps({{ cond1 = (Fs1_sf <= Ft1_sf); }},
1434 {{ cond2 = (Fs2_sf <= Ft2_sf); }},
1439 0x7: decode FUNCTION_LO {
1440 format FloatPSCompareOp {
1441 0x0: c_sf_ps({{ cond1 = 0; }}, {{ cond2 = 0; }},
1442 UnorderedFalse, QnanException);
1443 0x1: c_ngle_ps({{ cond1 = 0; }},
1445 UnorderedTrue, QnanException);
1446 0x2: c_seq_ps({{ cond1 = (Fs1_sf == Ft1_sf); }},
1447 {{ cond2 = (Fs2_sf == Ft2_sf); }},
1448 UnorderedFalse, QnanException);
1449 0x3: c_ngl_ps({{ cond1 = (Fs1_sf == Ft1_sf); }},
1450 {{ cond2 = (Fs2_sf == Ft2_sf); }},
1451 UnorderedTrue, QnanException);
1452 0x4: c_lt_ps({{ cond1 = (Fs1_sf < Ft1_sf); }},
1453 {{ cond2 = (Fs2_sf < Ft2_sf); }},
1454 UnorderedFalse, QnanException);
1455 0x5: c_nge_ps({{ cond1 = (Fs1_sf < Ft1_sf); }},
1456 {{ cond2 = (Fs2_sf < Ft2_sf); }},
1457 UnorderedTrue, QnanException);
1458 0x6: c_le_ps({{ cond1 = (Fs1_sf <= Ft1_sf); }},
1459 {{ cond2 = (Fs2_sf <= Ft2_sf); }},
1460 UnorderedFalse, QnanException);
1461 0x7: c_ngt_ps({{ cond1 = (Fs1_sf <= Ft1_sf); }},
1462 {{ cond2 = (Fs2_sf <= Ft2_sf); }},
1463 UnorderedTrue, QnanException);
1468 default: CP1Unimpl::unknown();
1472 //Table A-19 MIPS32 COP2 Encoding of rs Field
1473 0x2: decode RS_MSB {
1507 //Table A-20 MIPS64 COP1X Encoding of Function Field 1
1508 //Note: "COP1X instructions are legal only if 64-bit floating point
1509 //operations are enabled."
1510 0x3: decode FUNCTION_HI {
1511 0x0: decode FUNCTION_LO {
1512 format LoadIndexedMemory {
1513 0x0: lwxc1({{ Fd_uw = Mem; }});
1514 0x1: ldxc1({{ Fd_ud = Mem_ud; }});
1515 0x5: luxc1({{ Fd_ud = Mem_ud; }},
1516 {{ EA = (Rs + Rt) & ~7; }});
1520 0x1: decode FUNCTION_LO {
1521 format StoreIndexedMemory {
1522 0x0: swxc1({{ Mem = Fs_uw; }});
1523 0x1: sdxc1({{ Mem_ud = Fs_ud; }});
1524 0x5: suxc1({{ Mem_ud = Fs_ud; }},
1525 {{ EA = (Rs + Rt) & ~7; }});
1527 0x7: Prefetch::prefx({{ EA = Rs + Rt; }});
1530 0x3: decode FUNCTION_LO {
1531 0x6: Float64Op::alnv_ps({{
1534 } else if (Rs<2:0> == 4) {
1535 if (GuestByteOrder == ByteOrder::big)
1536 Fd_ud = Fs_ud<31:0> << 32 | Ft_ud<63:32>;
1538 Fd_ud = Ft_ud<31:0> << 32 | Fs_ud<63:32>;
1546 0x4: decode FUNCTION_LO {
1547 0x0: madd_s({{ Fd_sf = (Fs_sf * Ft_sf) + Fr_sf; }});
1548 0x1: madd_d({{ Fd_df = (Fs_df * Ft_df) + Fr_df; }});
1550 Fd1_sf = (Fs1_df * Ft1_df) + Fr1_df;
1551 Fd2_sf = (Fs2_df * Ft2_df) + Fr2_df;
1555 0x5: decode FUNCTION_LO {
1556 0x0: msub_s({{ Fd_sf = (Fs_sf * Ft_sf) - Fr_sf; }});
1557 0x1: msub_d({{ Fd_df = (Fs_df * Ft_df) - Fr_df; }});
1559 Fd1_sf = (Fs1_df * Ft1_df) - Fr1_df;
1560 Fd2_sf = (Fs2_df * Ft2_df) - Fr2_df;
1564 0x6: decode FUNCTION_LO {
1565 0x0: nmadd_s({{ Fd_sf = (-1 * Fs_sf * Ft_sf) - Fr_sf; }});
1566 0x1: nmadd_d({{ Fd_df = (-1 * Fs_df * Ft_df) - Fr_df; }});
1568 Fd1_sf = -((Fs1_df * Ft1_df) + Fr1_df);
1569 Fd2_sf = -((Fs2_df * Ft2_df) + Fr2_df);
1573 0x7: decode FUNCTION_LO {
1574 0x0: nmsub_s({{ Fd_sf = (-1 * Fs_sf * Ft_sf) + Fr_sf; }});
1575 0x1: nmsub_d({{ Fd_df = (-1 * Fs_df * Ft_df) + Fr_df; }});
1577 Fd1_sf = -((Fs1_df * Ft1_df) - Fr1_df);
1578 Fd2_sf = -((Fs2_df * Ft2_df) - Fr2_df);
1585 0x4: beql({{ cond = (Rs_sw == Rt_sw); }}, Likely);
1586 0x5: bnel({{ cond = (Rs_sw != Rt_sw); }}, Likely);
1587 0x6: blezl({{ cond = (Rs_sw <= 0); }}, Likely);
1588 0x7: bgtzl({{ cond = (Rs_sw > 0); }}, Likely);
1592 0x3: decode OPCODE_LO {
1593 //Table A-5 MIPS32 SPECIAL2 Encoding of Function Field
1594 0x4: decode FUNCTION_HI {
1595 0x0: decode FUNCTION_LO {
1597 int64_t temp1 = Rs_sd * Rt_sd;
1601 format HiLoRdSelValOp {
1603 val = ((int64_t)HI_RD_SEL << 32 | LO_RD_SEL) +
1607 val = ((uint64_t)HI_RD_SEL << 32 | LO_RD_SEL) +
1611 val = ((int64_t)HI_RD_SEL << 32 | LO_RD_SEL) -
1615 val = ((uint64_t)HI_RD_SEL << 32 | LO_RD_SEL) -
1621 0x4: decode FUNCTION_LO {
1625 for (int idx = 31; idx >= 0; idx--) {
1626 if (Rs<idx:idx> == 1) {
1635 for (int idx = 31; idx >= 0; idx--) {
1636 if (Rs<idx:idx> == 0) {
1646 0x7: decode FUNCTION_LO {
1647 0x7: FailUnimpl::sdbbp();
1651 //Table A-6 MIPS32 SPECIAL3 Encoding of Function Field for Release 2
1652 //of the Architecture
1653 0x7: decode FUNCTION_HI {
1654 0x0: decode FUNCTION_LO {
1656 0x0: ext({{ Rt = bits(Rs, MSB + LSB, LSB); }});
1658 Rt = bits(Rt, 31, MSB + 1) << (MSB + 1) |
1659 bits(Rs, MSB - LSB, 0) << LSB |
1660 bits(Rt, LSB - 1, 0);
1665 0x1: decode FUNCTION_LO {
1668 forkThread(xc->tcBase(), fault, RD, Rs, Rt);
1671 Rd = yieldThread(xc->tcBase(), fault, Rs_sw,
1676 //Table 5-9 MIPS32 LX Encoding of the op Field (DSP ASE MANUAL)
1679 format LoadIndexedMemory {
1680 0x0: lwx({{ Rd = Mem; }});
1681 0x4: lhx({{ Rd = Mem_sh; }});
1682 0x6: lbux({{ Rd = Mem_ub; }});
1686 0x4: DspIntOp::insv({{
1687 int pos = dspctl<5:0>;
1688 int size = dspctl<12:7> - 1;
1689 Rt = insertBits(Rt, pos + size, pos, Rs<size:0>);
1693 0x2: decode FUNCTION_LO {
1695 //Table 5-5 MIPS32 ADDU.QB Encoding of the op Field
1701 Rd = dspAdd(Rs, Rt, SIMD_FMT_QB,
1702 NOSATURATE, UNSIGNED, &dspctl);
1705 Rd = dspSub(Rs, Rt, SIMD_FMT_QB,
1706 NOSATURATE, UNSIGNED, &dspctl);
1709 Rd = dspAdd(Rs, Rt, SIMD_FMT_QB,
1710 SATURATE, UNSIGNED, &dspctl);
1713 Rd = dspSub(Rs, Rt, SIMD_FMT_QB,
1714 SATURATE, UNSIGNED, &dspctl);
1716 0x6: muleu_s_ph_qbl({{
1717 Rd = dspMuleu(Rs, Rt, MODE_L, &dspctl);
1719 0x7: muleu_s_ph_qbr({{
1720 Rd = dspMuleu(Rs, Rt, MODE_R, &dspctl);
1727 Rd = dspAdd(Rs, Rt, SIMD_FMT_PH,
1728 NOSATURATE, UNSIGNED, &dspctl);
1731 Rd = dspSub(Rs, Rt, SIMD_FMT_PH,
1732 NOSATURATE, UNSIGNED, &dspctl);
1735 Rd = dspAdd(Rs, Rt, SIMD_FMT_PH,
1736 NOSATURATE, SIGNED, &dspctl);
1739 Rd = dspSub(Rs, Rt, SIMD_FMT_PH,
1740 NOSATURATE, SIGNED, &dspctl);
1743 Rd = dspAdd(Rs, Rt, SIMD_FMT_PH,
1744 SATURATE, UNSIGNED, &dspctl);
1747 Rd = dspSub(Rs, Rt, SIMD_FMT_PH,
1748 SATURATE, UNSIGNED, &dspctl);
1751 Rd = dspAdd(Rs, Rt, SIMD_FMT_PH,
1752 SATURATE, SIGNED, &dspctl);
1755 Rd = dspSub(Rs, Rt, SIMD_FMT_PH,
1756 SATURATE, SIGNED, &dspctl);
1764 dresult = Rs_ud + Rt_ud;
1766 dspctl = insertBits(dspctl, 13, 13,
1771 dresult = Rs_sd + Rt_sd + dspctl<13:13>;
1773 if (dresult<32:32> != dresult<31:31>)
1774 dspctl = insertBits(dspctl, 20, 20, 1);
1777 Rd = (Rs_sw == 0) ? Rt_sw<23:8> :
1781 Rd = Rs<31:24> + Rs<23:16> +
1785 Rd = dspAdd(Rs_sw, Rt_sw, SIMD_FMT_W,
1786 SATURATE, SIGNED, &dspctl);
1789 Rd = dspSub(Rs_sw, Rt_sw, SIMD_FMT_W,
1790 SATURATE, SIGNED, &dspctl);
1796 0x4: muleq_s_w_phl({{
1797 Rd = dspMuleq(Rs_sw, Rt_sw,
1800 0x5: muleq_s_w_phr({{
1801 Rd = dspMuleq(Rs_sw, Rt_sw,
1805 Rd = dspMulq(Rs_sw, Rt_sw, SIMD_FMT_PH,
1806 SATURATE, NOROUND, &dspctl);
1809 Rd = dspMulq(Rs_sw, Rt_sw, SIMD_FMT_PH,
1810 SATURATE, ROUND, &dspctl);
1816 //Table 5-6 MIPS32 CMPU_EQ_QB Encoding of the op Field
1822 dspCmp(Rs, Rt, SIMD_FMT_QB,
1823 UNSIGNED, CMP_EQ, &dspctl);
1826 dspCmp(Rs, Rt, SIMD_FMT_QB,
1827 UNSIGNED, CMP_LT, &dspctl);
1830 dspCmp(Rs, Rt, SIMD_FMT_QB,
1831 UNSIGNED, CMP_LE, &dspctl);
1834 Rd = dspPick(Rs, Rt, SIMD_FMT_QB, &dspctl);
1837 Rd = dspCmpg(Rs, Rt, SIMD_FMT_QB,
1841 Rd = dspCmpg(Rs, Rt, SIMD_FMT_QB,
1845 Rd = dspCmpg(Rs, Rt, SIMD_FMT_QB,
1853 dspCmp(Rs, Rt, SIMD_FMT_PH,
1854 SIGNED, CMP_EQ, &dspctl);
1857 dspCmp(Rs, Rt, SIMD_FMT_PH,
1858 SIGNED, CMP_LT, &dspctl);
1861 dspCmp(Rs, Rt, SIMD_FMT_PH,
1862 SIGNED, CMP_LE, &dspctl);
1865 Rd = dspPick(Rs, Rt, SIMD_FMT_PH, &dspctl);
1867 0x4: precrq_qb_ph({{
1868 Rd = Rs<31:24> << 24 | Rs<15:8> << 16 |
1869 Rt<31:24> << 8 | Rt<15:8>;
1872 Rd = Rs<23:16> << 24 | Rs<7:0> << 16 |
1873 Rt<23:16> << 8 | Rt<7:0>;
1876 Rd = dspPack(Rs, Rt, SIMD_FMT_PH);
1878 0x7: precrqu_s_qb_ph({{
1879 Rd = dspPrecrqu(Rs, Rt, &dspctl);
1886 Rd = Rs<31:16> << 16 | Rt<31:16>;
1888 0x5: precrq_rs_ph_w({{
1889 Rd = dspPrecrq(Rs, Rt, SIMD_FMT_W, &dspctl);
1895 0x0: cmpgdu_eq_qb({{
1896 Rd = dspCmpgd(Rs, Rt, SIMD_FMT_QB,
1897 UNSIGNED, CMP_EQ, &dspctl);
1899 0x1: cmpgdu_lt_qb({{
1900 Rd = dspCmpgd(Rs, Rt, SIMD_FMT_QB,
1901 UNSIGNED, CMP_LT, &dspctl);
1903 0x2: cmpgdu_le_qb({{
1904 Rd = dspCmpgd(Rs, Rt, SIMD_FMT_QB,
1905 UNSIGNED, CMP_LE, &dspctl);
1907 0x6: precr_sra_ph_w({{
1908 Rt = dspPrecrSra(Rt, Rs, RD,
1909 SIMD_FMT_W, NOROUND);
1911 0x7: precr_sra_r_ph_w({{
1912 Rt = dspPrecrSra(Rt, Rs, RD,
1919 //Table 5-7 MIPS32 ABSQ_S.PH Encoding of the op Field
1925 Rd = dspAbs(Rt_sw, SIMD_FMT_QB, &dspctl);
1928 Rd = RS_RT<7:0> << 24 | RS_RT<7:0> << 16 |
1929 RS_RT<7:0> << 8 | RS_RT<7:0>;
1932 Rd = Rt<7:0> << 24 | Rt<7:0> << 16 |
1933 Rt<7:0> << 8 | Rt<7:0>;
1935 0x4: precequ_ph_qbl({{
1936 Rd = dspPrece(Rt, SIMD_FMT_QB, UNSIGNED,
1937 SIMD_FMT_PH, SIGNED, MODE_L);
1939 0x5: precequ_ph_qbr({{
1940 Rd = dspPrece(Rt, SIMD_FMT_QB, UNSIGNED,
1941 SIMD_FMT_PH, SIGNED, MODE_R);
1943 0x6: precequ_ph_qbla({{
1944 Rd = dspPrece(Rt, SIMD_FMT_QB, UNSIGNED,
1945 SIMD_FMT_PH, SIGNED, MODE_LA);
1947 0x7: precequ_ph_qbra({{
1948 Rd = dspPrece(Rt, SIMD_FMT_QB, UNSIGNED,
1949 SIMD_FMT_PH, SIGNED, MODE_RA);
1956 Rd = dspAbs(Rt_sw, SIMD_FMT_PH, &dspctl);
1959 Rd = (sext<10>(RS_RT))<15:0> << 16 |
1960 (sext<10>(RS_RT))<15:0>;
1963 Rd = Rt<15:0> << 16 | Rt<15:0>;
1965 0x4: preceq_w_phl({{
1966 Rd = dspPrece(Rt, SIMD_FMT_PH, SIGNED,
1967 SIMD_FMT_W, SIGNED, MODE_L);
1969 0x5: preceq_w_phr({{
1970 Rd = dspPrece(Rt, SIMD_FMT_PH, SIGNED,
1971 SIMD_FMT_W, SIGNED, MODE_R);
1978 Rd = dspAbs(Rt_sw, SIMD_FMT_W, &dspctl);
1983 0x3: IntOp::bitrev({{
1984 Rd = bitrev(Rt<15:0>);
1987 0x4: preceu_ph_qbl({{
1988 Rd = dspPrece(Rt, SIMD_FMT_QB,
1989 UNSIGNED, SIMD_FMT_PH,
1992 0x5: preceu_ph_qbr({{
1993 Rd = dspPrece(Rt, SIMD_FMT_QB,
1994 UNSIGNED, SIMD_FMT_PH,
1997 0x6: preceu_ph_qbla({{
1998 Rd = dspPrece(Rt, SIMD_FMT_QB,
1999 UNSIGNED, SIMD_FMT_PH,
2000 UNSIGNED, MODE_LA );
2002 0x7: preceu_ph_qbra({{
2003 Rd = dspPrece(Rt, SIMD_FMT_QB,
2004 UNSIGNED, SIMD_FMT_PH,
2011 //Table 5-8 MIPS32 SHLL.QB Encoding of the op Field
2017 Rd = dspShll(Rt_sw, RS, SIMD_FMT_QB,
2018 NOSATURATE, UNSIGNED, &dspctl);
2021 Rd = dspShrl(Rt_sw, RS, SIMD_FMT_QB,
2025 Rd = dspShll(Rt_sw, Rs_sw, SIMD_FMT_QB,
2026 NOSATURATE, UNSIGNED, &dspctl);
2029 Rd = dspShrl(Rt_sw, Rs_sw, SIMD_FMT_QB,
2033 Rd = dspShra(Rt_sw, RS, SIMD_FMT_QB,
2034 NOROUND, SIGNED, &dspctl);
2037 Rd = dspShra(Rt_sw, RS, SIMD_FMT_QB,
2038 ROUND, SIGNED, &dspctl);
2041 Rd = dspShra(Rt_sw, Rs_sw, SIMD_FMT_QB,
2042 NOROUND, SIGNED, &dspctl);
2045 Rd = dspShra(Rt_sw, Rs_sw, SIMD_FMT_QB,
2046 ROUND, SIGNED, &dspctl);
2053 Rd = dspShll(Rt, RS, SIMD_FMT_PH,
2054 NOSATURATE, SIGNED, &dspctl);
2057 Rd = dspShra(Rt_sw, RS, SIMD_FMT_PH,
2058 NOROUND, SIGNED, &dspctl);
2061 Rd = dspShll(Rt_sw, Rs_sw, SIMD_FMT_PH,
2062 NOSATURATE, SIGNED, &dspctl);
2065 Rd = dspShra(Rt_sw, Rs_sw, SIMD_FMT_PH,
2066 NOROUND, SIGNED, &dspctl);
2069 Rd = dspShll(Rt_sw, RS, SIMD_FMT_PH,
2070 SATURATE, SIGNED, &dspctl);
2073 Rd = dspShra(Rt_sw, RS, SIMD_FMT_PH,
2074 ROUND, SIGNED, &dspctl);
2077 Rd = dspShll(Rt_sw, Rs_sw, SIMD_FMT_PH,
2078 SATURATE, SIGNED, &dspctl);
2081 Rd = dspShra(Rt_sw, Rs_sw, SIMD_FMT_PH,
2082 ROUND, SIGNED, &dspctl);
2089 Rd = dspShll(Rt_sw, RS, SIMD_FMT_W,
2090 SATURATE, SIGNED, &dspctl);
2093 Rd = dspShra(Rt_sw, RS, SIMD_FMT_W,
2094 ROUND, SIGNED, &dspctl);
2097 Rd = dspShll(Rt_sw, Rs_sw, SIMD_FMT_W,
2098 SATURATE, SIGNED, &dspctl);
2101 Rd = dspShra(Rt_sw, Rs_sw, SIMD_FMT_W,
2102 ROUND, SIGNED, &dspctl);
2109 Rd = dspShrl(Rt_sw, RS, SIMD_FMT_PH,
2113 Rd = dspShrl(Rt_sw, Rs_sw, SIMD_FMT_PH,
2121 0x3: decode FUNCTION_LO {
2123 //Table 3.12 MIPS32 ADDUH.QB Encoding of the op Field
2124 //(DSP ASE Rev2 Manual)
2129 Rd = dspAddh(Rs_sw, Rt_sw, SIMD_FMT_QB,
2133 Rd = dspSubh(Rs_sw, Rt_sw, SIMD_FMT_QB,
2137 Rd = dspAddh(Rs_sw, Rt_sw, SIMD_FMT_QB,
2141 Rd = dspSubh(Rs_sw, Rt_sw, SIMD_FMT_QB,
2149 Rd = dspAddh(Rs_sw, Rt_sw, SIMD_FMT_PH,
2153 Rd = dspSubh(Rs_sw, Rt_sw, SIMD_FMT_PH,
2157 Rd = dspAddh(Rs_sw, Rt_sw, SIMD_FMT_PH,
2161 Rd = dspSubh(Rs_sw, Rt_sw, SIMD_FMT_PH,
2165 Rd = dspMul(Rs_sw, Rt_sw, SIMD_FMT_PH,
2166 NOSATURATE, &dspctl);
2169 Rd = dspMul(Rs_sw, Rt_sw, SIMD_FMT_PH,
2177 Rd = dspAddh(Rs_sw, Rt_sw, SIMD_FMT_W,
2181 Rd = dspSubh(Rs_sw, Rt_sw, SIMD_FMT_W,
2185 Rd = dspAddh(Rs_sw, Rt_sw, SIMD_FMT_W,
2189 Rd = dspSubh(Rs_sw, Rt_sw, SIMD_FMT_W,
2193 Rd = dspMulq(Rs_sw, Rt_sw, SIMD_FMT_W,
2194 SATURATE, NOROUND, &dspctl);
2197 Rd = dspMulq(Rs_sw, Rt_sw, SIMD_FMT_W,
2198 SATURATE, ROUND, &dspctl);
2205 //Table A-10 MIPS32 BSHFL Encoding of sa Field
2209 Rd = Rt<23:16> << 24 | Rt<31:24> << 16 |
2210 Rt<7:0> << 8 | Rt<15:8>;
2212 0x10: seb({{ Rd = Rt_sb; }});
2213 0x18: seh({{ Rd = Rt_sh; }});
2217 0x6: decode FUNCTION_LO {
2219 //Table 5-10 MIPS32 DPAQ.W.PH Encoding of the op Field
2225 dspac = dspDpa(dspac, Rs_sw, Rt_sw, ACDST,
2226 SIMD_FMT_PH, SIGNED, MODE_L);
2229 dspac = dspDps(dspac, Rs_sw, Rt_sw, ACDST,
2230 SIMD_FMT_PH, SIGNED, MODE_L);
2233 dspac = dspMulsa(dspac, Rs_sw, Rt_sw,
2234 ACDST, SIMD_FMT_PH );
2237 dspac = dspDpa(dspac, Rs_sw, Rt_sw, ACDST,
2238 SIMD_FMT_QB, UNSIGNED, MODE_L);
2241 dspac = dspDpaq(dspac, Rs_sw, Rt_sw,
2243 SIMD_FMT_W, NOSATURATE,
2247 dspac = dspDpsq(dspac, Rs_sw, Rt_sw,
2249 SIMD_FMT_W, NOSATURATE,
2252 0x6: mulsaq_s_w_ph({{
2253 dspac = dspMulsaq(dspac, Rs_sw, Rt_sw,
2258 dspac = dspDpa(dspac, Rs_sw, Rt_sw, ACDST,
2259 SIMD_FMT_QB, UNSIGNED, MODE_R);
2266 dspac = dspDpa(dspac, Rs_sw, Rt_sw, ACDST,
2267 SIMD_FMT_PH, SIGNED, MODE_X);
2270 dspac = dspDps(dspac, Rs_sw, Rt_sw, ACDST,
2271 SIMD_FMT_PH, SIGNED, MODE_X);
2274 dspac = dspDps(dspac, Rs_sw, Rt_sw, ACDST,
2275 SIMD_FMT_QB, UNSIGNED, MODE_L);
2278 dspac = dspDpaq(dspac, Rs_sw, Rt_sw,
2280 SIMD_FMT_L, SATURATE,
2284 dspac = dspDpsq(dspac, Rs_sw, Rt_sw,
2286 SIMD_FMT_L, SATURATE,
2290 dspac = dspDps(dspac, Rs_sw, Rt_sw, ACDST,
2291 SIMD_FMT_QB, UNSIGNED, MODE_R);
2297 0x0: maq_sa_w_phl({{
2298 dspac = dspMaq(dspac, Rs, Rt,
2300 MODE_L, SATURATE, &dspctl);
2302 0x2: maq_sa_w_phr({{
2303 dspac = dspMaq(dspac, Rs, Rt,
2305 MODE_R, SATURATE, &dspctl);
2308 dspac = dspMaq(dspac, Rs, Rt,
2310 MODE_L, NOSATURATE, &dspctl);
2313 dspac = dspMaq(dspac, Rs, Rt,
2315 MODE_R, NOSATURATE, &dspctl);
2321 0x0: dpaqx_s_w_ph({{
2322 dspac = dspDpaq(dspac, Rs_sw, Rt_sw,
2324 SIMD_FMT_W, NOSATURATE,
2327 0x1: dpsqx_s_w_ph({{
2328 dspac = dspDpsq(dspac, Rs_sw, Rt_sw,
2330 SIMD_FMT_W, NOSATURATE,
2333 0x2: dpaqx_sa_w_ph({{
2334 dspac = dspDpaq(dspac, Rs_sw, Rt_sw,
2336 SIMD_FMT_W, SATURATE,
2339 0x3: dpsqx_sa_w_ph({{
2340 dspac = dspDpsq(dspac, Rs_sw, Rt_sw,
2342 SIMD_FMT_W, SATURATE,
2349 //Table 3.3 MIPS32 APPEND Encoding of the op Field
2354 Rt = (Rt << RD) | bits(Rs, RD - 1, 0);
2358 (bits(Rs, RD - 1, 0) << (32 - RD));
2365 Rt = (Rt << (8 * BP)) | (Rs >> (8 * (4 - BP)));
2372 0x7: decode FUNCTION_LO {
2374 //Table 5-11 MIPS32 EXTR.W Encoding of the op Field
2380 Rt = dspExtr(dspac, SIMD_FMT_W, RS,
2381 NOROUND, NOSATURATE, &dspctl);
2384 Rt = dspExtr(dspac, SIMD_FMT_W, Rs,
2385 NOROUND, NOSATURATE, &dspctl);
2388 Rt = dspExtp(dspac, RS, &dspctl);
2391 Rt = dspExtp(dspac, Rs, &dspctl);
2394 Rt = dspExtr(dspac, SIMD_FMT_W, RS,
2395 ROUND, NOSATURATE, &dspctl);
2398 Rt = dspExtr(dspac, SIMD_FMT_W, Rs,
2399 ROUND, NOSATURATE, &dspctl);
2402 Rt = dspExtr(dspac, SIMD_FMT_W, RS,
2403 ROUND, SATURATE, &dspctl);
2406 Rt = dspExtr(dspac, SIMD_FMT_W, Rs,
2407 ROUND, SATURATE, &dspctl);
2414 Rt = dspExtpd(dspac, RS, &dspctl);
2417 Rt = dspExtpd(dspac, Rs, &dspctl);
2420 Rt = dspExtr(dspac, SIMD_FMT_PH, RS,
2421 NOROUND, SATURATE, &dspctl);
2424 Rt = dspExtr(dspac, SIMD_FMT_PH, Rs,
2425 NOROUND, SATURATE, &dspctl);
2432 Rd = readDSPControl(&dspctl, RDDSPMASK);
2435 writeDSPControl(&dspctl, Rs, WRDSPMASK);
2442 if ((int64_t)sext<6>(HILOSA) < 0) {
2443 dspac = (uint64_t)dspac <<
2446 dspac = (uint64_t)dspac >>
2451 if ((int64_t)sext<6>(Rs_sw<5:0>) < 0) {
2452 dspac = (uint64_t)dspac <<
2453 -sext<6>(Rs_sw<5:0>);
2455 dspac = (uint64_t)dspac >>
2456 sext<6>(Rs_sw<5:0>);
2460 dspac = dspac << 32;
2462 dspctl = insertBits(dspctl, 5, 0,
2468 0x3: decode OP default FailUnimpl::rdhwr() {
2469 0x0: decode FullSystemInt {
2471 29: BasicOp::rdhwr_se({{ Rt = TpValue; }});
2479 0x4: decode OPCODE_LO {
2481 0x0: lb({{ Rt = Mem_sb; }});
2482 0x1: lh({{ Rt = Mem_sh; }});
2483 0x3: lw({{ Rt = Mem_sw; }});
2484 0x4: lbu({{ Rt = Mem_ub;}});
2485 0x5: lhu({{ Rt = Mem_uh; }});
2488 format LoadUnalignedMemory {
2490 uint32_t mem_shift = 24 - (8 * byte_offset);
2491 Rt = mem_word << mem_shift | (Rt & mask(mem_shift));
2494 uint32_t mem_shift = 8 * byte_offset;
2495 Rt = (Rt & (mask(mem_shift) << (32 - mem_shift))) |
2496 (mem_word >> mem_shift);
2501 0x5: decode OPCODE_LO {
2502 format StoreMemory {
2503 0x0: sb({{ Mem_ub = Rt<7:0>; }});
2504 0x1: sh({{ Mem_uh = Rt<15:0>; }});
2505 0x3: sw({{ Mem = Rt<31:0>; }});
2508 format StoreUnalignedMemory {
2510 uint32_t reg_shift = 24 - (8 * byte_offset);
2511 uint32_t mem_shift = 32 - reg_shift;
2512 mem_word = (mem_word & (mask(reg_shift) << mem_shift)) |
2516 uint32_t reg_shift = 8 * byte_offset;
2517 mem_word = Rt << reg_shift |
2518 (mem_word & (mask(reg_shift)));
2523 //Addr CacheEA = Rs + OFFSET;
2524 //fault = xc->CacheOp((uint8_t)CACHE_OP,(Addr) CacheEA);
2529 0x6: decode OPCODE_LO {
2531 0x0: ll({{ Rt = Mem; }}, mem_flags=LLSC);
2532 0x1: lwc1({{ Ft_uw = Mem; }});
2533 0x5: ldc1({{ Ft_ud = Mem_ud; }});
2535 0x2: CP2Unimpl::lwc2();
2536 0x6: CP2Unimpl::ldc2();
2537 0x3: Prefetch::pref();
2541 0x7: decode OPCODE_LO {
2542 0x0: StoreCond::sc({{ Mem = Rt; }},
2543 {{ uint64_t tmp = write_result;
2544 Rt = (tmp == 0 || tmp == 1) ? tmp : Rt;
2546 inst_flags = IsStoreConditional);
2547 format StoreMemory {
2548 0x1: swc1({{ Mem = Ft_uw; }});
2549 0x5: sdc1({{ Mem_ud = Ft_ud; }});
2551 0x2: CP2Unimpl::swc2();
2552 0x6: CP2Unimpl::sdc2();