| /* |
| * Source file for nanoMIPS disassembler component of QEMU |
| * |
| * Copyright (C) 2018 Wave Computing, Inc. |
| * Copyright (C) 2018 Matthew Fortune <matthew.fortune@mips.com> |
| * Copyright (C) 2018 Aleksandar Markovic <amarkovic@wavecomp.com> |
| * |
| * This program is free software: you can redistribute it and/or modify |
| * it under the terms of the GNU General Public License as published by |
| * the Free Software Foundation, either version 2 of the License, or |
| * (at your option) any later version. |
| * |
| * This program is distributed in the hope that it will be useful, |
| * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| * GNU General Public License for more details. |
| * |
| * You should have received a copy of the GNU General Public License |
| * along with this program. If not, see <https://www.gnu.org/licenses/>. |
| * |
| */ |
| |
| /* |
| * Documentation used while implementing this component: |
| * |
| * [1] "MIPSĀ® Architecture Base: nanoMIPS32(tm) Instruction Set Technical |
| * Reference Manual", Revision 01.01, April 27, 2018 |
| */ |
| |
| extern "C" { |
| #include "qemu/osdep.h" |
| #include "disas/dis-asm.h" |
| } |
| |
| #include <cstring> |
| #include <stdexcept> |
| #include <sstream> |
| #include <stdio.h> |
| #include <stdarg.h> |
| |
| #include "nanomips.h" |
| |
| #define IMGASSERTONCE(test) |
| |
| |
| int nanomips_dis(char *buf, |
| unsigned address, |
| unsigned short one, |
| unsigned short two, |
| unsigned short three) |
| { |
| std::string disasm; |
| uint16 bits[3] = {one, two, three}; |
| |
| NMD::TABLE_ENTRY_TYPE type; |
| NMD d(address, NMD::ALL_ATTRIBUTES); |
| int size = d.Disassemble(bits, disasm, type); |
| |
| strcpy(buf, disasm.c_str()); |
| return size; |
| } |
| |
| int print_insn_nanomips(bfd_vma memaddr, struct disassemble_info *info) |
| { |
| int status; |
| bfd_byte buffer[2]; |
| uint16_t insn1 = 0, insn2 = 0, insn3 = 0; |
| char buf[200]; |
| |
| info->bytes_per_chunk = 2; |
| info->display_endian = info->endian; |
| info->insn_info_valid = 1; |
| info->branch_delay_insns = 0; |
| info->data_size = 0; |
| info->insn_type = dis_nonbranch; |
| info->target = 0; |
| info->target2 = 0; |
| |
| status = (*info->read_memory_func)(memaddr, buffer, 2, info); |
| if (status != 0) { |
| (*info->memory_error_func)(status, memaddr, info); |
| return -1; |
| } |
| |
| if (info->endian == BFD_ENDIAN_BIG) { |
| insn1 = bfd_getb16(buffer); |
| } else { |
| insn1 = bfd_getl16(buffer); |
| } |
| (*info->fprintf_func)(info->stream, "%04x ", insn1); |
| |
| /* Handle 32-bit opcodes. */ |
| if ((insn1 & 0x1000) == 0) { |
| status = (*info->read_memory_func)(memaddr + 2, buffer, 2, info); |
| if (status != 0) { |
| (*info->memory_error_func)(status, memaddr + 2, info); |
| return -1; |
| } |
| |
| if (info->endian == BFD_ENDIAN_BIG) { |
| insn2 = bfd_getb16(buffer); |
| } else { |
| insn2 = bfd_getl16(buffer); |
| } |
| (*info->fprintf_func)(info->stream, "%04x ", insn2); |
| } else { |
| (*info->fprintf_func)(info->stream, " "); |
| } |
| /* Handle 48-bit opcodes. */ |
| if ((insn1 >> 10) == 0x18) { |
| status = (*info->read_memory_func)(memaddr + 4, buffer, 2, info); |
| if (status != 0) { |
| (*info->memory_error_func)(status, memaddr + 4, info); |
| return -1; |
| } |
| |
| if (info->endian == BFD_ENDIAN_BIG) { |
| insn3 = bfd_getb16(buffer); |
| } else { |
| insn3 = bfd_getl16(buffer); |
| } |
| (*info->fprintf_func)(info->stream, "%04x ", insn3); |
| } else { |
| (*info->fprintf_func)(info->stream, " "); |
| } |
| |
| int length = nanomips_dis(buf, memaddr, insn1, insn2, insn3); |
| |
| /* FIXME: Should probably use a hash table on the major opcode here. */ |
| |
| (*info->fprintf_func) (info->stream, "%s", buf); |
| if (length > 0) { |
| return length / 8; |
| } |
| |
| info->insn_type = dis_noninsn; |
| |
| return insn3 ? 6 : insn2 ? 4 : 2; |
| } |
| |
| |
| namespace img |
| { |
| address addr32(address a) |
| { |
| return a; |
| } |
| |
| std::string format(const char *format, ...) |
| { |
| char buffer[256]; |
| va_list args; |
| va_start(args, format); |
| int err = vsprintf(buffer, format, args); |
| if (err < 0) { |
| perror(buffer); |
| } |
| va_end(args); |
| return buffer; |
| } |
| |
| std::string format(const char *format, |
| std::string s) |
| { |
| char buffer[256]; |
| |
| sprintf(buffer, format, s.c_str()); |
| |
| return buffer; |
| } |
| |
| std::string format(const char *format, |
| std::string s1, |
| std::string s2) |
| { |
| char buffer[256]; |
| |
| sprintf(buffer, format, s1.c_str(), s2.c_str()); |
| |
| return buffer; |
| } |
| |
| std::string format(const char *format, |
| std::string s1, |
| std::string s2, |
| std::string s3) |
| { |
| char buffer[256]; |
| |
| sprintf(buffer, format, s1.c_str(), s2.c_str(), s3.c_str()); |
| |
| return buffer; |
| } |
| |
| std::string format(const char *format, |
| std::string s1, |
| std::string s2, |
| std::string s3, |
| std::string s4) |
| { |
| char buffer[256]; |
| |
| sprintf(buffer, format, s1.c_str(), s2.c_str(), s3.c_str(), |
| s4.c_str()); |
| |
| return buffer; |
| } |
| |
| std::string format(const char *format, |
| std::string s1, |
| std::string s2, |
| std::string s3, |
| std::string s4, |
| std::string s5) |
| { |
| char buffer[256]; |
| |
| sprintf(buffer, format, s1.c_str(), s2.c_str(), s3.c_str(), |
| s4.c_str(), s5.c_str()); |
| |
| return buffer; |
| } |
| |
| std::string format(const char *format, |
| uint64 d, |
| std::string s2) |
| { |
| char buffer[256]; |
| |
| sprintf(buffer, format, d, s2.c_str()); |
| |
| return buffer; |
| } |
| |
| std::string format(const char *format, |
| std::string s1, |
| uint64 d, |
| std::string s2) |
| { |
| char buffer[256]; |
| |
| sprintf(buffer, format, s1.c_str(), d, s2.c_str()); |
| |
| return buffer; |
| } |
| |
| std::string format(const char *format, |
| std::string s1, |
| std::string s2, |
| uint64 d) |
| { |
| char buffer[256]; |
| |
| sprintf(buffer, format, s1.c_str(), s2.c_str(), d); |
| |
| return buffer; |
| } |
| |
| char as_char(int c) |
| { |
| return static_cast<char>(c); |
| } |
| }; |
| |
| |
| std::string to_string(img::address a) |
| { |
| char buffer[256]; |
| sprintf(buffer, "0x%" PRIx64, a); |
| return buffer; |
| } |
| |
| |
| uint64 extract_bits(uint64 data, uint32 bit_offset, uint32 bit_size) |
| { |
| return (data << (64 - (bit_size + bit_offset))) >> (64 - bit_size); |
| } |
| |
| |
| int64 sign_extend(int64 data, int msb) |
| { |
| uint64 shift = 63 - msb; |
| return (data << shift) >> shift; |
| } |
| |
| |
| uint64 NMD::renumber_registers(uint64 index, uint64 *register_list, |
| size_t register_list_size) |
| { |
| if (index < register_list_size) { |
| return register_list[index]; |
| } |
| |
| throw std::runtime_error(img::format( |
| "Invalid register mapping index %" PRIu64 |
| ", size of list = %zu", |
| index, register_list_size)); |
| } |
| |
| |
| /* |
| * NMD::decode_gpr_gpr4() - decoder for 'gpr4' gpr encoding type |
| * |
| * Map a 4-bit code to the 5-bit register space according to this pattern: |
| * |
| * 1 0 |
| * 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0 |
| * | | | | | | | | | | | | | | | | |
| * | | | | | | | | | | | | | | | | |
| * | | | | | | | | | | | ā---------------ā |
| * | | | | | | | | | | ā---------------ā | |
| * | | | | | | | | | ā---------------ā | | |
| * | | | | | | | | ā---------------ā | | | |
| * | | | | | | | | | | | | | | | | |
| * | | | | | | | | | | | | | | | | |
| * 1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0 |
| * 3 2 1 0 |
| * |
| * Used in handling following instructions: |
| * |
| * - ADDU[4X4] |
| * - LW[4X4] |
| * - MOVEP[REV] |
| * - MUL[4X4] |
| * - SW[4X4] |
| */ |
| uint64 NMD::decode_gpr_gpr4(uint64 d) |
| { |
| static uint64 register_list[] = { 8, 9, 10, 11, 4, 5, 6, 7, |
| 16, 17, 18, 19, 20, 21, 22, 23 }; |
| return renumber_registers(d, register_list, |
| sizeof(register_list) / sizeof(register_list[0])); |
| } |
| |
| |
| /* |
| * NMD::decode_gpr_gpr4_zero() - decoder for 'gpr4.zero' gpr encoding type |
| * |
| * Map a 4-bit code to the 5-bit register space according to this pattern: |
| * |
| * 1 0 |
| * 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0 |
| * | | | | | | | | | | | | | | | | |
| * | | | | | | | | | | | | ā---------------------ā |
| * | | | | | | | | | | | ā---------------ā | |
| * | | | | | | | | | | ā---------------ā | | |
| * | | | | | | | | | ā---------------ā | | | |
| * | | | | | | | | ā---------------ā | | | | |
| * | | | | | | | | | | | | | | | | |
| * | | | | | | | | | | | | | | | | |
| * 1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0 |
| * 3 2 1 0 |
| * |
| * This pattern is the same one used for 'gpr4' gpr encoding type, except for |
| * the input value 3, that is mapped to the output value 0 instead of 11. |
| * |
| * Used in handling following instructions: |
| * |
| * - MOVE.BALC |
| * - MOVEP |
| * - SW[4X4] |
| */ |
| uint64 NMD::decode_gpr_gpr4_zero(uint64 d) |
| { |
| static uint64 register_list[] = { 8, 9, 10, 0, 4, 5, 6, 7, |
| 16, 17, 18, 19, 20, 21, 22, 23 }; |
| return renumber_registers(d, register_list, |
| sizeof(register_list) / sizeof(register_list[0])); |
| } |
| |
| |
| /* |
| * NMD::decode_gpr_gpr3() - decoder for 'gpr3' gpr encoding type |
| * |
| * Map a 3-bit code to the 5-bit register space according to this pattern: |
| * |
| * 7 6 5 4 3 2 1 0 |
| * | | | | | | | | |
| * | | | | | | | | |
| * | | | ā-----------------------ā |
| * | | ā-----------------------ā | |
| * | ā-----------------------ā | | |
| * ā-----------------------ā | | | |
| * | | | | | | | | |
| * ā-------ā | | | | | | | |
| * | ā-------ā | | | | | | |
| * | | ā-------ā | | | | | |
| * | | | ā-------ā | | | | |
| * | | | | | | | | |
| * 1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0 |
| * 3 2 1 0 |
| * |
| * Used in handling following instructions: |
| * |
| * - ADDIU[R1.SP] |
| * - ADDIU[R2] |
| * - ADDU[16] |
| * - AND[16] |
| * - ANDI[16] |
| * - BEQC[16] |
| * - BEQZC[16] |
| * - BNEC[16] |
| * - BNEZC[16] |
| * - LB[16] |
| * - LBU[16] |
| * - LH[16] |
| * - LHU[16] |
| * - LI[16] |
| * - LW[16] |
| * - LW[GP16] |
| * - LWXS[16] |
| * - NOT[16] |
| * - OR[16] |
| * - SB[16] |
| * - SH[16] |
| * - SLL[16] |
| * - SRL[16] |
| * - SUBU[16] |
| * - SW[16] |
| * - XOR[16] |
| */ |
| uint64 NMD::decode_gpr_gpr3(uint64 d) |
| { |
| static uint64 register_list[] = { 16, 17, 18, 19, 4, 5, 6, 7 }; |
| return renumber_registers(d, register_list, |
| sizeof(register_list) / sizeof(register_list[0])); |
| } |
| |
| |
| /* |
| * NMD::decode_gpr_gpr3_src_store() - decoder for 'gpr3.src.store' gpr encoding |
| * type |
| * |
| * Map a 3-bit code to the 5-bit register space according to this pattern: |
| * |
| * 7 6 5 4 3 2 1 0 |
| * | | | | | | | | |
| * | | | | | | | ā-----------------------ā |
| * | | | ā-----------------------ā | |
| * | | ā-----------------------ā | | |
| * | ā-----------------------ā | | | |
| * ā-----------------------ā | | | | |
| * | | | | | | | | |
| * ā-------ā | | | | | | | |
| * | ā-------ā | | | | | | |
| * | | ā-------ā | | | | | |
| * | | | | | | | | |
| * | | | | | | | | |
| * 1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0 |
| * 3 2 1 0 |
| * |
| * This pattern is the same one used for 'gpr3' gpr encoding type, except for |
| * the input value 0, that is mapped to the output value 0 instead of 16. |
| * |
| * Used in handling following instructions: |
| * |
| * - SB[16] |
| * - SH[16] |
| * - SW[16] |
| * - SW[GP16] |
| */ |
| uint64 NMD::decode_gpr_gpr3_src_store(uint64 d) |
| { |
| static uint64 register_list[] = { 0, 17, 18, 19, 4, 5, 6, 7 }; |
| return renumber_registers(d, register_list, |
| sizeof(register_list) / sizeof(register_list[0])); |
| } |
| |
| |
| /* |
| * NMD::decode_gpr_gpr2_reg1() - decoder for 'gpr2.reg1' gpr encoding type |
| * |
| * Map a 2-bit code to the 5-bit register space according to this pattern: |
| * |
| * 3 2 1 0 |
| * | | | | |
| * | | | | |
| * | | | ā-------------------ā |
| * | | ā-------------------ā | |
| * | ā-------------------ā | | |
| * ā-------------------ā | | | |
| * | | | | |
| * | | | | |
| * 1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0 |
| * 3 2 1 0 |
| * |
| * Used in handling following instructions: |
| * |
| * - MOVEP |
| * - MOVEP[REV] |
| */ |
| uint64 NMD::decode_gpr_gpr2_reg1(uint64 d) |
| { |
| static uint64 register_list[] = { 4, 5, 6, 7 }; |
| return renumber_registers(d, register_list, |
| sizeof(register_list) / sizeof(register_list[0])); |
| } |
| |
| |
| /* |
| * NMD::decode_gpr_gpr2_reg2() - decoder for 'gpr2.reg2' gpr encoding type |
| * |
| * Map a 2-bit code to the 5-bit register space according to this pattern: |
| * |
| * 3 2 1 0 |
| * | | | | |
| * | | | | |
| * | | | ā-----------------ā |
| * | | ā-----------------ā | |
| * | ā-----------------ā | | |
| * ā-----------------ā | | | |
| * | | | | |
| * | | | | |
| * 1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0 |
| * 3 2 1 0 |
| * |
| * Used in handling following instructions: |
| * |
| * - MOVEP |
| * - MOVEP[REV] |
| */ |
| uint64 NMD::decode_gpr_gpr2_reg2(uint64 d) |
| { |
| static uint64 register_list[] = { 5, 6, 7, 8 }; |
| return renumber_registers(d, register_list, |
| sizeof(register_list) / sizeof(register_list[0])); |
| } |
| |
| |
| /* |
| * NMD::decode_gpr_gpr1() - decoder for 'gpr1' gpr encoding type |
| * |
| * Map a 1-bit code to the 5-bit register space according to this pattern: |
| * |
| * 1 0 |
| * | | |
| * | | |
| * | ā---------------------ā |
| * ā---------------------ā | |
| * | | |
| * | | |
| * | | |
| * | | |
| * 1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0 |
| * 3 2 1 0 |
| * |
| * Used in handling following instruction: |
| * |
| * - MOVE.BALC |
| */ |
| uint64 NMD::decode_gpr_gpr1(uint64 d) |
| { |
| static uint64 register_list[] = { 4, 5 }; |
| return renumber_registers(d, register_list, |
| sizeof(register_list) / sizeof(register_list[0])); |
| } |
| |
| |
| uint64 NMD::copy(uint64 d) |
| { |
| return d; |
| } |
| |
| |
| int64 NMD::copy(int64 d) |
| { |
| return d; |
| } |
| |
| |
| int64 NMD::neg_copy(uint64 d) |
| { |
| return 0ll - d; |
| } |
| |
| |
| int64 NMD::neg_copy(int64 d) |
| { |
| return -d; |
| } |
| |
| |
| /* strange wrapper around gpr3 */ |
| uint64 NMD::encode_rs3_and_check_rs3_ge_rt3(uint64 d) |
| { |
| return decode_gpr_gpr3(d); |
| } |
| |
| |
| /* strange wrapper around gpr3 */ |
| uint64 NMD::encode_rs3_and_check_rs3_lt_rt3(uint64 d) |
| { |
| return decode_gpr_gpr3(d); |
| } |
| |
| |
| /* nop - done by extraction function */ |
| uint64 NMD::encode_s_from_address(uint64 d) |
| { |
| return d; |
| } |
| |
| |
| /* nop - done by extraction function */ |
| uint64 NMD::encode_u_from_address(uint64 d) |
| { |
| return d; |
| } |
| |
| |
| /* nop - done by extraction function */ |
| uint64 NMD::encode_s_from_s_hi(uint64 d) |
| { |
| return d; |
| } |
| |
| |
| uint64 NMD::encode_count3_from_count(uint64 d) |
| { |
| IMGASSERTONCE(d < 8); |
| return d == 0ull ? 8ull : d; |
| } |
| |
| |
| uint64 NMD::encode_shift3_from_shift(uint64 d) |
| { |
| IMGASSERTONCE(d < 8); |
| return d == 0ull ? 8ull : d; |
| } |
| |
| |
| /* special value for load literal */ |
| int64 NMD::encode_eu_from_s_li16(uint64 d) |
| { |
| IMGASSERTONCE(d < 128); |
| return d == 127 ? -1 : (int64)d; |
| } |
| |
| |
| uint64 NMD::encode_msbd_from_size(uint64 d) |
| { |
| IMGASSERTONCE(d < 32); |
| return d + 1; |
| } |
| |
| |
| uint64 NMD::encode_eu_from_u_andi16(uint64 d) |
| { |
| IMGASSERTONCE(d < 16); |
| if (d == 12) { |
| return 0x00ffull; |
| } |
| if (d == 13) { |
| return 0xffffull; |
| } |
| return d; |
| } |
| |
| |
| uint64 NMD::encode_msbd_from_pos_and_size(uint64 d) |
| { |
| IMGASSERTONCE(0); |
| return d; |
| } |
| |
| |
| /* save16 / restore16 ???? */ |
| uint64 NMD::encode_rt1_from_rt(uint64 d) |
| { |
| return d ? 31 : 30; |
| } |
| |
| |
| /* ? */ |
| uint64 NMD::encode_lsb_from_pos_and_size(uint64 d) |
| { |
| return d; |
| } |
| |
| |
| std::string NMD::save_restore_list(uint64 rt, uint64 count, uint64 gp) |
| { |
| std::string str; |
| |
| for (uint64 counter = 0; counter != count; counter++) { |
| bool use_gp = gp && (counter == count - 1); |
| uint64 this_rt = use_gp ? 28 : ((rt & 0x10) | (rt + counter)) & 0x1f; |
| str += img::format(",%s", GPR(this_rt)); |
| } |
| |
| return str; |
| } |
| |
| |
| std::string NMD::GPR(uint64 reg) |
| { |
| static const char *gpr_reg[32] = { |
| "zero", "at", "v0", "v1", "a0", "a1", "a2", "a3", |
| "a4", "a5", "a6", "a7", "r12", "r13", "r14", "r15", |
| "s0", "s1", "s2", "s3", "s4", "s5", "s6", "s7", |
| "r24", "r25", "k0", "k1", "gp", "sp", "fp", "ra" |
| }; |
| |
| if (reg < 32) { |
| return gpr_reg[reg]; |
| } |
| |
| throw std::runtime_error(img::format("Invalid GPR register index %" PRIu64, |
| reg)); |
| } |
| |
| |
| std::string NMD::FPR(uint64 reg) |
| { |
| static const char *fpr_reg[32] = { |
| "f0", "f1", "f2", "f3", "f4", "f5", "f6", "f7", |
| "f8", "f9", "f10", "f11", "f12", "f13", "f14", "f15", |
| "f16", "f17", "f18", "f19", "f20", "f21", "f22", "f23", |
| "f24", "f25", "f26", "f27", "f28", "f29", "f30", "f31" |
| }; |
| |
| if (reg < 32) { |
| return fpr_reg[reg]; |
| } |
| |
| throw std::runtime_error(img::format("Invalid FPR register index %" PRIu64, |
| reg)); |
| } |
| |
| |
| std::string NMD::AC(uint64 reg) |
| { |
| static const char *ac_reg[4] = { |
| "ac0", "ac1", "ac2", "ac3" |
| }; |
| |
| if (reg < 4) { |
| return ac_reg[reg]; |
| } |
| |
| throw std::runtime_error(img::format("Invalid AC register index %" PRIu64, |
| reg)); |
| } |
| |
| |
| std::string NMD::IMMEDIATE(uint64 value) |
| { |
| return img::format("0x%" PRIx64, value); |
| } |
| |
| |
| std::string NMD::IMMEDIATE(int64 value) |
| { |
| return img::format("%" PRId64, value); |
| } |
| |
| |
| std::string NMD::CPR(uint64 reg) |
| { |
| /* needs more work */ |
| return img::format("CP%" PRIu64, reg); |
| } |
| |
| |
| std::string NMD::ADDRESS(uint64 value, int instruction_size) |
| { |
| /* token for string replace */ |
| /* const char TOKEN_REPLACE = (char)0xa2; */ |
| img::address address = m_pc + value + instruction_size; |
| /* symbol replacement */ |
| /* return img::as_char(TOKEN_REPLACE) + to_string(address); */ |
| return to_string(address); |
| } |
| |
| |
| uint64 NMD::extract_op_code_value(const uint16 * data, int size) |
| { |
| switch (size) { |
| case 16: |
| return data[0]; |
| case 32: |
| return ((uint64)data[0] << 16) | data[1]; |
| case 48: |
| return ((uint64)data[0] << 32) | ((uint64)data[1] << 16) | data[2]; |
| default: |
| return data[0]; |
| } |
| } |
| |
| |
| int NMD::Disassemble(const uint16 * data, std::string & dis, |
| NMD::TABLE_ENTRY_TYPE & type) |
| { |
| return Disassemble(data, dis, type, MAJOR, 2); |
| } |
| |
| |
| /* |
| * Recurse through tables until the instruction is found then return |
| * the string and size |
| * |
| * inputs: |
| * pointer to a word stream, |
| * disassember table and size |
| * returns: |
| * instruction size - negative is error |
| * disassembly string - on error will constain error string |
| */ |
| int NMD::Disassemble(const uint16 * data, std::string & dis, |
| NMD::TABLE_ENTRY_TYPE & type, const Pool *table, |
| int table_size) |
| { |
| try |
| { |
| for (int i = 0; i < table_size; i++) { |
| uint64 op_code = extract_op_code_value(data, |
| table[i].instructions_size); |
| if ((op_code & table[i].mask) == table[i].value) { |
| /* possible match */ |
| conditional_function cond = table[i].condition; |
| if ((cond == 0) || (this->*cond)(op_code)) { |
| try |
| { |
| if (table[i].type == pool) { |
| return Disassemble(data, dis, type, |
| table[i].next_table, |
| table[i].next_table_size); |
| } else if ((table[i].type == instruction) || |
| (table[i].type == call_instruction) || |
| (table[i].type == branch_instruction) || |
| (table[i].type == return_instruction)) { |
| if ((table[i].attributes != 0) && |
| (m_requested_instruction_categories & |
| table[i].attributes) == 0) { |
| /* |
| * failed due to instruction having |
| * an ASE attribute and the requested version |
| * not having that attribute |
| */ |
| dis = "ASE attribute missmatch"; |
| return -5; |
| } |
| disassembly_function dis_fn = table[i].disassembly; |
| if (dis_fn == 0) { |
| dis = "disassembler failure - bad table entry"; |
| return -6; |
| } |
| type = table[i].type; |
| dis = (this->*dis_fn)(op_code); |
| return table[i].instructions_size; |
| } else { |
| dis = "reserved instruction"; |
| return -2; |
| } |
| } |
| catch (std::runtime_error & e) |
| { |
| dis = e.what(); |
| return -3; /* runtime error */ |
| } |
| } |
| } |
| } |
| } |
| catch (std::exception & e) |
| { |
| dis = e.what(); |
| return -4; /* runtime error */ |
| } |
| |
| dis = "failed to disassemble"; |
| return -1; /* failed to disassemble */ |
| } |
| |
| |
| uint64 NMD::extract_code_18_to_0(uint64 instruction) |
| { |
| uint64 value = 0; |
| value |= extract_bits(instruction, 0, 19); |
| return value; |
| } |
| |
| |
| uint64 NMD::extract_shift3_2_1_0(uint64 instruction) |
| { |
| uint64 value = 0; |
| value |= extract_bits(instruction, 0, 3); |
| return value; |
| } |
| |
| |
| uint64 NMD::extract_u_11_10_9_8_7_6_5_4_3__s3(uint64 instruction) |
| { |
| uint64 value = 0; |
| value |= extract_bits(instruction, 3, 9) << 3; |
| return value; |
| } |
| |
| |
| uint64 NMD::extract_count_3_2_1_0(uint64 instruction) |
| { |
| uint64 value = 0; |
| value |= extract_bits(instruction, 0, 4); |
| return value; |
| } |
| |
| |
| uint64 NMD::extract_rtz3_9_8_7(uint64 instruction) |
| { |
| uint64 value = 0; |
| value |= extract_bits(instruction, 7, 3); |
| return value; |
| } |
| |
| |
| uint64 NMD::extract_u_17_to_1__s1(uint64 instruction) |
| { |
| uint64 value = 0; |
| value |= extract_bits(instruction, 1, 17) << 1; |
| return value; |
| } |
| |
| |
| int64 NMD::extract_s__se9_20_19_18_17_16_15_14_13_12_11(uint64 instruction) |
| { |
| int64 value = 0; |
| value |= extract_bits(instruction, 11, 10); |
| value = sign_extend(value, 9); |
| return value; |
| } |
| |
| |
| int64 NMD::extract_s__se11_0_10_9_8_7_6_5_4_3_2_1_0_s1(uint64 instruction) |
| { |
| int64 value = 0; |
| value |= extract_bits(instruction, 0, 1) << 11; |
| value |= extract_bits(instruction, 1, 10) << 1; |
| value = sign_extend(value, 11); |
| return value; |
| } |
| |
| |
| uint64 NMD::extract_u_10(uint64 instruction) |
| { |
| uint64 value = 0; |
| value |= extract_bits(instruction, 10, 1); |
| return value; |
| } |
| |
| |
| uint64 NMD::extract_rtz4_27_26_25_23_22_21(uint64 instruction) |
| { |
| uint64 value = 0; |
| value |= extract_bits(instruction, 21, 3); |
| value |= extract_bits(instruction, 25, 1) << 3; |
| return value; |
| } |
| |
| |
| uint64 NMD::extract_sa_15_14_13_12_11(uint64 instruction) |
| { |
| uint64 value = 0; |
| value |= extract_bits(instruction, 11, 5); |
| return value; |
| } |
| |
| |
| uint64 NMD::extract_shift_4_3_2_1_0(uint64 instruction) |
| { |
| uint64 value = 0; |
| value |= extract_bits(instruction, 0, 5); |
| return value; |
| } |
| |
| |
| uint64 NMD::extract_shiftx_10_9_8_7__s1(uint64 instruction) |
| { |
| uint64 value = 0; |
| value |= extract_bits(instruction, 7, 4) << 1; |
| return value; |
| } |
| |
| |
| uint64 NMD::extract_hint_25_24_23_22_21(uint64 instruction) |
| { |
| uint64 value = 0; |
| value |= extract_bits(instruction, 21, 5); |
| return value; |
| } |
| |
| |
| uint64 NMD::extract_count3_14_13_12(uint64 instruction) |
| { |
| uint64 value = 0; |
| value |= extract_bits(instruction, 12, 3); |
| return value; |
| } |
| |
| |
| int64 NMD::extract_s__se31_0_11_to_2_20_to_12_s12(uint64 instruction) |
| { |
| int64 value = 0; |
| value |= extract_bits(instruction, 0, 1) << 31; |
| value |= extract_bits(instruction, 2, 10) << 21; |
| value |= extract_bits(instruction, 12, 9) << 12; |
| value = sign_extend(value, 31); |
| return value; |
| } |
| |
| |
| int64 NMD::extract_s__se7_0_6_5_4_3_2_1_s1(uint64 instruction) |
| { |
| int64 value = 0; |
| value |= extract_bits(instruction, 0, 1) << 7; |
| value |= extract_bits(instruction, 1, 6) << 1; |
| value = sign_extend(value, 7); |
| return value; |
| } |
| |
| |
| uint64 NMD::extract_u2_10_9(uint64 instruction) |
| { |
| uint64 value = 0; |
| value |= extract_bits(instruction, 9, 2); |
| return value; |
| } |
| |
| |
| uint64 NMD::extract_code_25_24_23_22_21_20_19_18_17_16(uint64 instruction) |
| { |
| uint64 value = 0; |
| value |= extract_bits(instruction, 16, 10); |
| return value; |
| } |
| |
| |
| uint64 NMD::extract_rs_20_19_18_17_16(uint64 instruction) |
| { |
| uint64 value = 0; |
| value |= extract_bits(instruction, 16, 5); |
| return value; |
| } |
| |
| |
| uint64 NMD::extract_u_2_1__s1(uint64 instruction) |
| { |
| uint64 value = 0; |
| value |= extract_bits(instruction, 1, 2) << 1; |
| return value; |
| } |
| |
| |
| uint64 NMD::extract_stripe_6(uint64 instruction) |
| { |
| uint64 value = 0; |
| value |= extract_bits(instruction, 6, 1); |
| return value; |
| } |
| |
| |
| uint64 NMD::extract_ac_15_14(uint64 instruction) |
| { |
| uint64 value = 0; |
| value |= extract_bits(instruction, 14, 2); |
| return value; |
| } |
| |
| |
| uint64 NMD::extract_shift_20_19_18_17_16(uint64 instruction) |
| { |
| uint64 value = 0; |
| value |= extract_bits(instruction, 16, 5); |
| return value; |
| } |
| |
| |
| uint64 NMD::extract_rdl_25_24(uint64 instruction) |
| { |
| uint64 value = 0; |
| value |= extract_bits(instruction, 24, 1); |
| return value; |
| } |
| |
| |
| int64 NMD::extract_s__se10_0_9_8_7_6_5_4_3_2_1_s1(uint64 instruction) |
| { |
| int64 value = 0; |
| value |= extract_bits(instruction, 0, 1) << 10; |
| value |= extract_bits(instruction, 1, 9) << 1; |
| value = sign_extend(value, 10); |
| return value; |
| } |
| |
| |
| uint64 NMD::extract_eu_6_5_4_3_2_1_0(uint64 instruction) |
| { |
| uint64 value = 0; |
| value |= extract_bits(instruction, 0, 7); |
| return value; |
| } |
| |
| |
| uint64 NMD::extract_shift_5_4_3_2_1_0(uint64 instruction) |
| { |
| uint64 value = 0; |
| value |= extract_bits(instruction, 0, 6); |
| return value; |
| } |
| |
| |
| uint64 NMD::extract_count_19_18_17_16(uint64 instruction) |
| { |
| uint64 value = 0; |
| value |= extract_bits(instruction, 16, 4); |
| return value; |
| } |
| |
| |
| uint64 NMD::extract_code_2_1_0(uint64 instruction) |
| { |
| uint64 value = 0; |
| value |= extract_bits(instruction, 0, 3); |
| return value; |
| } |
| |
| |
| uint64 NMD::extract_u_11_10_9_8_7_6_5_4_3_2_1_0(uint64 instruction) |
| { |
| uint64 value = 0; |
| value |= extract_bits(instruction, 0, 12); |
| return value; |
| } |
| |
| |
| uint64 NMD::extract_rs_4_3_2_1_0(uint64 instruction) |
| { |
| uint64 value = 0; |
| value |= extract_bits(instruction, 0, 5); |
| return value; |
| } |
| |
| |
| uint64 NMD::extract_u_20_to_3__s3(uint64 instruction) |
| { |
| uint64 value = 0; |
| value |= extract_bits(instruction, 3, 18) << 3; |
| return value; |
| } |
| |
| |
| uint64 NMD::extract_u_3_2_1_0__s2(uint64 instruction) |
| { |
| uint64 value = 0; |
| value |= extract_bits(instruction, 0, 4) << 2; |
| return value; |
| } |
| |
| |
| uint64 NMD::extract_cofun_25_24_23(uint64 instruction) |
| { |
| uint64 value = 0; |
| value |= extract_bits(instruction, 3, 23); |
| return value; |
| } |
| |
| |
| uint64 NMD::extract_u_2_1_0__s2(uint64 instruction) |
| { |
| uint64 value = 0; |
| value |= extract_bits(instruction, 0, 3) << 2; |
| return value; |
| } |
| |
| |
| uint64 NMD::extract_rd3_3_2_1(uint64 instruction) |
| { |
| uint64 value = 0; |
| value |= extract_bits(instruction, 1, 3); |
| return value; |
| } |
| |
| |
| uint64 NMD::extract_sa_15_14_13_12(uint64 instruction) |
| { |
| uint64 value = 0; |
| value |= extract_bits(instruction, 12, 4); |
| return value; |
| } |
| |
| |
| uint64 NMD::extract_rt_25_24_23_22_21(uint64 instruction) |
| { |
| uint64 value = 0; |
| value |= extract_bits(instruction, 21, 5); |
| return value; |
| } |
| |
| |
| uint64 NMD::extract_ru_7_6_5_4_3(uint64 instruction) |
| { |
| uint64 value = 0; |
| value |= extract_bits(instruction, 3, 5); |
| return value; |
| } |
| |
| |
| uint64 NMD::extract_u_17_to_0(uint64 instruction) |
| { |
| uint64 value = 0; |
| value |= extract_bits(instruction, 0, 18); |
| return value; |
| } |
| |
| |
| uint64 NMD::extract_rsz4_4_2_1_0(uint64 instruction) |
| { |
| uint64 value = 0; |
| value |= extract_bits(instruction, 0, 3); |
| value |= extract_bits(instruction, 4, 1) << 3; |
| return value; |
| } |
| |
| |
| int64 NMD::extract_s__se21_0_20_to_1_s1(uint64 instruction) |
| { |
| int64 value = 0; |
| value |= extract_bits(instruction, 0, 1) << 21; |
| value |= extract_bits(instruction, 1, 20) << 1; |
| value = sign_extend(value, 21); |
| return value; |
| } |
| |
| |
| uint64 NMD::extract_op_25_to_3(uint64 instruction) |
| { |
| uint64 value = 0; |
| value |= extract_bits(instruction, 3, 23); |
| return value; |
| } |
| |
| |
| uint64 NMD::extract_rs4_4_2_1_0(uint64 instruction) |
| { |
| uint64 value = 0; |
| value |= extract_bits(instruction, 0, 3); |
| value |= extract_bits(instruction, 4, 1) << 3; |
| return value; |
| } |
| |
| |
| uint64 NMD::extract_bit_23_22_21(uint64 instruction) |
| { |
| uint64 value = 0; |
| value |= extract_bits(instruction, 21, 3); |
| return value; |
| } |
| |
| |
| uint64 NMD::extract_rt_41_40_39_38_37(uint64 instruction) |
| { |
| uint64 value = 0; |
| value |= extract_bits(instruction, 37, 5); |
| return value; |
| } |
| |
| |
| int64 NMD::extract_shift__se5_21_20_19_18_17_16(uint64 instruction) |
| { |
| int64 value = 0; |
| value |= extract_bits(instruction, 16, 6); |
| value = sign_extend(value, 5); |
| return value; |
| } |
| |
| |
| uint64 NMD::extract_rd2_3_8(uint64 instruction) |
| { |
| uint64 value = 0; |
| value |= extract_bits(instruction, 3, 1) << 1; |
| value |= extract_bits(instruction, 8, 1); |
| return value; |
| } |
| |
| |
| uint64 NMD::extract_code_17_to_0(uint64 instruction) |
| { |
| uint64 value = 0; |
| value |= extract_bits(instruction, 0, 18); |
| return value; |
| } |
| |
| |
| uint64 NMD::extract_size_20_19_18_17_16(uint64 instruction) |
| { |
| uint64 value = 0; |
| value |= extract_bits(instruction, 16, 5); |
| return value; |
| } |
| |
| |
| int64 NMD::extract_s__se8_15_7_6_5_4_3_2_s2(uint64 instruction) |
| { |
| int64 value = 0; |
| value |= extract_bits(instruction, 2, 6) << 2; |
| value |= extract_bits(instruction, 15, 1) << 8; |
| value = sign_extend(value, 8); |
| return value; |
| } |
| |
| |
| uint64 NMD::extract_u_15_to_0(uint64 instruction) |
| { |
| uint64 value = 0; |
| value |= extract_bits(instruction, 0, 16); |
| return value; |
| } |
| |
| |
| uint64 NMD::extract_fs_20_19_18_17_16(uint64 instruction) |
| { |
| uint64 value = 0; |
| value |= extract_bits(instruction, 16, 5); |
| return value; |
| } |
| |
| |
| int64 NMD::extract_s__se8_15_7_6_5_4_3_2_1_0(uint64 instruction) |
| { |
| int64 value = 0; |
| value |= extract_bits(instruction, 0, 8); |
| value |= extract_bits(instruction, 15, 1) << 8; |
| value = sign_extend(value, 8); |
| return value; |
| } |
| |
| |
| uint64 NMD::extract_stype_20_19_18_17_16(uint64 instruction) |
| { |
| uint64 value = 0; |
| value |= extract_bits(instruction, 16, 5); |
| return value; |
| } |
| |
| |
| uint64 NMD::extract_rtl_11(uint64 instruction) |
| { |
| uint64 value = 0; |
| value |= extract_bits(instruction, 9, 1); |
| return value; |
| } |
| |
| |
| uint64 NMD::extract_hs_20_19_18_17_16(uint64 instruction) |
| { |
| uint64 value = 0; |
| value |= extract_bits(instruction, 16, 5); |
| return value; |
| } |
| |
| |
| uint64 NMD::extract_sel_13_12_11(uint64 instruction) |
| { |
| uint64 value = 0; |
| value |= extract_bits(instruction, 11, 3); |
| return value; |
| } |
| |
| |
| uint64 NMD::extract_lsb_4_3_2_1_0(uint64 instruction) |
| { |
| uint64 value = 0; |
| value |= extract_bits(instruction, 0, 5); |
| return value; |
| } |
| |
| |
| uint64 NMD::extract_gp_2(uint64 instruction) |
| { |
| uint64 value = 0; |
| value |= extract_bits(instruction, 2, 1); |
| return value; |
| } |
| |
| |
| uint64 NMD::extract_rt3_9_8_7(uint64 instruction) |
| { |
| uint64 value = 0; |
| value |= extract_bits(instruction, 7, 3); |
| return value; |
| } |
| |
| |
| uint64 NMD::extract_ft_25_24_23_22_21(uint64 instruction) |
| { |
| uint64 value = 0; |
| value |= extract_bits(instruction, 21, 5); |
| return value; |
| } |
| |
| |
| uint64 NMD::extract_u_17_16_15_14_13_12_11(uint64 instruction) |
| { |
| uint64 value = 0; |
| value |= extract_bits(instruction, 11, 7); |
| return value; |
| } |
| |
| |
| uint64 NMD::extract_cs_20_19_18_17_16(uint64 instruction) |
| { |
| uint64 value = 0; |
| value |= extract_bits(instruction, 16, 5); |
| return value; |
| } |
| |
| |
| uint64 NMD::extract_rt4_9_7_6_5(uint64 instruction) |
| { |
| uint64 value = 0; |
| value |= extract_bits(instruction, 5, 3); |
| value |= extract_bits(instruction, 9, 1) << 3; |
| return value; |
| } |
| |
| |
| uint64 NMD::extract_msbt_10_9_8_7_6(uint64 instruction) |
| { |
| uint64 value = 0; |
| value |= extract_bits(instruction, 6, 5); |
| return value; |
| } |
| |
| |
| uint64 NMD::extract_u_5_4_3_2_1_0__s2(uint64 instruction) |
| { |
| uint64 value = 0; |
| value |= extract_bits(instruction, 0, 6) << 2; |
| return value; |
| } |
| |
| |
| uint64 NMD::extract_sa_15_14_13(uint64 instruction) |
| { |
| uint64 value = 0; |
| value |= extract_bits(instruction, 13, 3); |
| return value; |
| } |
| |
| |
| int64 NMD::extract_s__se14_0_13_to_1_s1(uint64 instruction) |
| { |
| int64 value = 0; |
| value |= extract_bits(instruction, 0, 1) << 14; |
| value |= extract_bits(instruction, 1, 13) << 1; |
| value = sign_extend(value, 14); |
| return value; |
| } |
| |
| |
| uint64 NMD::extract_rs3_6_5_4(uint64 instruction) |
| { |
| uint64 value = 0; |
| value |= extract_bits(instruction, 4, 3); |
| return value; |
| } |
| |
| |
| uint64 NMD::extract_u_31_to_0__s32(uint64 instruction) |
| { |
| uint64 value = 0; |
| value |= extract_bits(instruction, 0, 32) << 32; |
| return value; |
| } |
| |
| |
| uint64 NMD::extract_shift_10_9_8_7_6(uint64 instruction) |
| { |
| uint64 value = 0; |
| value |= extract_bits(instruction, 6, 5); |
| return value; |
| } |
| |
| |
| uint64 NMD::extract_cs_25_24_23_22_21(uint64 instruction) |
| { |
| uint64 value = 0; |
| value |= extract_bits(instruction, 21, 5); |
| return value; |
| } |
| |
| |
| uint64 NMD::extract_shiftx_11_10_9_8_7_6(uint64 instruction) |
| { |
| uint64 value = 0; |
| value |= extract_bits(instruction, 6, 6); |
| return value; |
| } |
| |
| |
| uint64 NMD::extract_rt_9_8_7_6_5(uint64 instruction) |
| { |
| uint64 value = 0; |
| value |= extract_bits(instruction, 5, 5); |
| return value; |
| } |
| |
| |
| uint64 NMD::extract_op_25_24_23_22_21(uint64 instruction) |
| { |
| uint64 value = 0; |
| value |= extract_bits(instruction, 21, 5); |
| return value; |
| } |
| |
| |
| uint64 NMD::extract_u_6_5_4_3_2_1_0__s2(uint64 instruction) |
| { |
| uint64 value = 0; |
| value |= extract_bits(instruction, 0, 7) << 2; |
| return value; |
| } |
| |
| |
| uint64 NMD::extract_bit_16_15_14_13_12_11(uint64 instruction) |
| { |
| uint64 value = 0; |
| value |= extract_bits(instruction, 11, 6); |
| return value; |
| } |
| |
| |
| uint64 NMD::extract_mask_20_19_18_17_16_15_14(uint64 instruction) |
| { |
| uint64 value = 0; |
| value |= extract_bits(instruction, 14, 7); |
| return value; |
| } |
| |
| |
| uint64 NMD::extract_eu_3_2_1_0(uint64 instruction) |
| { |
| uint64 value = 0; |
| value |= extract_bits(instruction, 0, 4); |
| return value; |
| } |
| |
| |
| uint64 NMD::extract_u_7_6_5_4__s4(uint64 instruction) |
| { |
| uint64 value = 0; |
| value |= extract_bits(instruction, 4, 4) << 4; |
| return value; |
| } |
| |
| |
| int64 NMD::extract_s__se8_15_7_6_5_4_3_s3(uint64 instruction) |
| { |
| int64 value = 0; |
| value |= extract_bits(instruction, 3, 5) << 3; |
| value |= extract_bits(instruction, 15, 1) << 8; |
| value = sign_extend(value, 8); |
| return value; |
| } |
| |
| |
| uint64 NMD::extract_ft_15_14_13_12_11(uint64 instruction) |
| { |
| uint64 value = 0; |
| value |= extract_bits(instruction, 11, 5); |
| return value; |
| } |
| |
| |
| int64 NMD::extract_s__se31_15_to_0_31_to_16(uint64 instruction) |
| { |
| int64 value = 0; |
| value |= extract_bits(instruction, 0, 16) << 16; |
| value |= extract_bits(instruction, 16, 16); |
| value = sign_extend(value, 31); |
| return value; |
| } |
| |
| |
| uint64 NMD::extract_u_20_19_18_17_16_15_14_13(uint64 instruction) |
| { |
| uint64 value = 0; |
| value |= extract_bits(instruction, 13, 8); |
| return value; |
| } |
| |
| |
| uint64 NMD::extract_u_17_to_2__s2(uint64 instruction) |
| { |
| uint64 value = 0; |
| value |= extract_bits(instruction, 2, 16) << 2; |
| return value; |
| } |
| |
| |
| uint64 NMD::extract_rd_15_14_13_12_11(uint64 instruction) |
| { |
| uint64 value = 0; |
| value |= extract_bits(instruction, 11, 5); |
| return value; |
| } |
| |
| |
| uint64 NMD::extract_c0s_20_19_18_17_16(uint64 instruction) |
| { |
| uint64 value = 0; |
| value |= extract_bits(instruction, 16, 5); |
| return value; |
| } |
| |
| |
| uint64 NMD::extract_code_1_0(uint64 instruction) |
| { |
| uint64 value = 0; |
| value |= extract_bits(instruction, 0, 2); |
| return value; |
| } |
| |
| |
| int64 NMD::extract_s__se25_0_24_to_1_s1(uint64 instruction) |
| { |
| int64 value = 0; |
| value |= extract_bits(instruction, 0, 1) << 25; |
| value |= extract_bits(instruction, 1, 24) << 1; |
| value = sign_extend(value, 25); |
| return value; |
| } |
| |
| |
| uint64 NMD::extract_u_1_0(uint64 instruction) |
| { |
| uint64 value = 0; |
| value |= extract_bits(instruction, 0, 2); |
| return value; |
| } |
| |
| |
| uint64 NMD::extract_u_3_8__s2(uint64 instruction) |
| { |
| uint64 value = 0; |
| value |= extract_bits(instruction, 3, 1) << 3; |
| value |= extract_bits(instruction, 8, 1) << 2; |
| return value; |
| } |
| |
| |
| uint64 NMD::extract_fd_15_14_13_12_11(uint64 instruction) |
| { |
| uint64 value = 0; |
| value |= extract_bits(instruction, 11, 5); |
| return value; |
| } |
| |
| |
| uint64 NMD::extract_u_4_3_2_1_0__s2(uint64 instruction) |
| { |
| uint64 value = 0; |
| value |= extract_bits(instruction, 0, 5) << 2; |
| return value; |
| } |
| |
| |
| uint64 NMD::extract_rtz4_9_7_6_5(uint64 instruction) |
| { |
| uint64 value = 0; |
| value |= extract_bits(instruction, 5, 3); |
| value |= extract_bits(instruction, 9, 1) << 3; |
| return value; |
| } |
| |
| |
| uint64 NMD::extract_sel_15_14_13_12_11(uint64 instruction) |
| { |
| uint64 value = 0; |
| value |= extract_bits(instruction, 11, 5); |
| return value; |
| } |
| |
| |
| uint64 NMD::extract_ct_25_24_23_22_21(uint64 instruction) |
| { |
| uint64 value = 0; |
| value |= extract_bits(instruction, 21, 5); |
| return value; |
| } |
| |
| |
| uint64 NMD::extract_u_20_to_2__s2(uint64 instruction) |
| { |
| uint64 value = 0; |
| value |= extract_bits(instruction, 2, 19) << 2; |
| return value; |
| } |
| |
| |
| int64 NMD::extract_s__se3_4_2_1_0(uint64 instruction) |
| { |
| int64 value = 0; |
| value |= extract_bits(instruction, 0, 3); |
| value |= extract_bits(instruction, 4, 1) << 3; |
| value = sign_extend(value, 3); |
| return value; |
| } |
| |
| |
| uint64 NMD::extract_u_3_2_1_0__s1(uint64 instruction) |
| { |
| uint64 value = 0; |
| value |= extract_bits(instruction, 0, 4) << 1; |
| return value; |
| } |
| |
| |
| |
| bool NMD::ADDIU_32__cond(uint64 instruction) |
| { |
| uint64 rt = extract_rt_25_24_23_22_21(instruction); |
| return rt != 0; |
| } |
| |
| |
| bool NMD::ADDIU_RS5__cond(uint64 instruction) |
| { |
| uint64 rt = extract_rt_9_8_7_6_5(instruction); |
| return rt != 0; |
| } |
| |
| |
| bool NMD::BALRSC_cond(uint64 instruction) |
| { |
| uint64 rt = extract_rt_25_24_23_22_21(instruction); |
| return rt != 0; |
| } |
| |
| |
| bool NMD::BEQC_16__cond(uint64 instruction) |
| { |
| uint64 rs3 = extract_rs3_6_5_4(instruction); |
| uint64 rt3 = extract_rt3_9_8_7(instruction); |
| uint64 u = extract_u_3_2_1_0__s1(instruction); |
| return rs3 < rt3 && u != 0; |
| } |
| |
| |
| bool NMD::BNEC_16__cond(uint64 instruction) |
| { |
| uint64 rs3 = extract_rs3_6_5_4(instruction); |
| uint64 rt3 = extract_rt3_9_8_7(instruction); |
| uint64 u = extract_u_3_2_1_0__s1(instruction); |
| return rs3 >= rt3 && u != 0; |
| } |
| |
| |
| bool NMD::MOVE_cond(uint64 instruction) |
| { |
| uint64 rt = extract_rt_9_8_7_6_5(instruction); |
| return rt != 0; |
| } |
| |
| |
| bool NMD::P16_BR1_cond(uint64 instruction) |
| { |
| uint64 u = extract_u_3_2_1_0__s1(instruction); |
| return u != 0; |
| } |
| |
| |
| bool NMD::PREF_S9__cond(uint64 instruction) |
| { |
| uint64 hint = extract_hint_25_24_23_22_21(instruction); |
| return hint != 31; |
| } |
| |
| |
| bool NMD::PREFE_cond(uint64 instruction) |
| { |
| uint64 hint = extract_hint_25_24_23_22_21(instruction); |
| return hint != 31; |
| } |
| |
| |
| bool NMD::SLTU_cond(uint64 instruction) |
| { |
| uint64 rd = extract_rd_15_14_13_12_11(instruction); |
| return rd != 0; |
| } |
| |
| |
| |
| /* |
| * ABS.D fd, fs - Floating Point Absolute Value |
| * |
| * 3 2 1 |
| * 10987654321098765432109876543210 |
| * 010001 00000 000101 |
| * fmt ----- |
| * fs ----- |
| * fd ----- |
| */ |
| std::string NMD::ABS_D(uint64 instruction) |
| { |
| uint64 fd_value = extract_ft_25_24_23_22_21(instruction); |
| uint64 fs_value = extract_fs_20_19_18_17_16(instruction); |
| |
| std::string fs = FPR(copy(fs_value)); |
| std::string fd = FPR(copy(fd_value)); |
| |
| return img::format("ABS.D %s, %s", fd, fs); |
| } |
| |
| |
| /* |
| * ABS.S fd, fs - Floating Point Absolute Value |
| * |
| * 3 2 1 |
| * 10987654321098765432109876543210 |
| * 010001 00000 000101 |
| * fmt ----- |
| * fd ----- |
| * fs ----- |
| */ |
| std::string NMD::ABS_S(uint64 instruction) |
| { |
| uint64 fd_value = extract_ft_25_24_23_22_21(instruction); |
| uint64 fs_value = extract_fs_20_19_18_17_16(instruction); |
| |
| std::string fs = FPR(copy(fs_value)); |
| std::string fd = FPR(copy(fd_value)); |
| |
| return img::format("ABS.S %s, %s", fd, fs); |
| } |
| |
| |
| /* |
| * [DSP] ABSQ_S.PH rt, rs - Find absolute value of two fractional halfwords |
| * with 16-bit saturation |
| * |
| * 3 2 1 |
| * 10987654321098765432109876543210 |
| * 001000 0001000100111111 |
| * rt ----- |
| * rs ----- |
| */ |
| std::string NMD::ABSQ_S_PH(uint64 instruction) |
| { |
| uint64 rt_value = extract_rt_25_24_23_22_21(instruction); |
| uint64 rs_value = extract_rs_20_19_18_17_16(instruction); |
| |
| std::string rt = GPR(copy(rt_value)); |
| std::string rs = GPR(copy(rs_value)); |
| |
| return img::format("ABSQ_S.PH %s, %s", rt, rs); |
| } |
| |
| |
| /* |
| * [DSP] ABSQ_S.QB rt, rs - Find absolute value of four fractional byte values |
| * with 8-bit saturation |
| * |
| * 3 2 1 |
| * 10987654321098765432109876543210 |
| * 001000 0000000100111111 |
| * rt ----- |
| * rs ----- |
| */ |
| std::string NMD::ABSQ_S_QB(uint64 instruction) |
| { |
| uint64 rt_value = extract_rt_25_24_23_22_21(instruction); |
| uint64 rs_value = extract_rs_20_19_18_17_16(instruction); |
| |
| std::string rt = GPR(copy(rt_value)); |
| std::string rs = GPR(copy(rs_value)); |
| |
| return img::format("ABSQ_S.QB %s, %s", rt, rs); |
| } |
| |
| |
| /* |
| * [DSP] ABSQ_S.W rt, rs - Find absolute value of fractional word with 32-bit |
| * saturation |
| * |
| * 3 2 1 |
| * 10987654321098765432109876543210 |
| * 001000 0010000100111111 |
| * rt ----- |
| * rs ----- |
| */ |
| std::string NMD::ABSQ_S_W(uint64 instruction) |
| { |
| uint64 rt_value = extract_rt_25_24_23_22_21(instruction); |
| uint64 rs_value = extract_rs_20_19_18_17_16(instruction); |
| |
| std::string rt = GPR(copy(rt_value)); |
| std::string rs = GPR(copy(rs_value)); |
| |
| return img::format("ABSQ_S.W %s, %s", rt, rs); |
| } |
| |
| |
| /* |
| * |
| * |
| * 3 2 1 |
| * 10987654321098765432109876543210 |
| * 001000 0010000100111111 |
| * rt ----- |
| * rs ----- |
| */ |
| std::string NMD::ACLR(uint64 instruction) |
| { |
| uint64 bit_value = extract_bit_23_22_21(instruction); |
| uint64 rs_value = extract_rs_20_19_18_17_16(instruction); |
| int64 s_value = extract_s__se8_15_7_6_5_4_3_2_1_0(instruction); |
| |
| std::string bit = IMMEDIATE(copy(bit_value)); |
| std::string s = IMMEDIATE(copy(s_value)); |
| std::string rs = GPR(copy(rs_value)); |
| |
| return img::format("ACLR %s, %s(%s)", bit, s, rs); |
| } |
| |
| |
| /* |
| * |
| * |
| * 3 2 1 |
| * 10987654321098765432109876543210 |
| * 001000 0010000100111111 |
| * rt ----- |
| * rs ----- |
| */ |
| std::string NMD::ADD(uint64 instruction) |
| { |
| uint64 rt_value = extract_rt_25_24_23_22_21(instruction); |
| uint64 rs_value = extract_rs_20_19_18_17_16(instruction); |
| uint64 rd_value = extract_rd_15_14_13_12_11(instruction); |
| |
| std::string rd = GPR(copy(rd_value)); |
| std::string rs = GPR(copy(rs_value)); |
| std::string rt = GPR(copy(rt_value)); |
| |
| return img::format("ADD %s, %s, %s", rd, rs, rt); |
| } |
| |
| |
| /* |
| * ADD.D fd, fs, ft - Floating Point Add |
| * |
| * 3 2 1 |
| * 10987654321098765432109876543210 |
| * 010001 000101 |
| * fmt ----- |
| * ft ----- |
| * fs ----- |
| * fd ----- |
| */ |
| std::string NMD::ADD_D(uint64 instruction) |
| { |
| uint64 ft_value = extract_ft_25_24_23_22_21(instruction); |
| uint64 fs_value = extract_fs_20_19_18_17_16(instruction); |
| uint64 fd_value = extract_fd_15_14_13_12_11(instruction); |
| |
| std::string ft = FPR(copy(ft_value)); |
| std::string fs = FPR(copy(fs_value)); |
| std::string fd = FPR(copy(fd_value)); |
| |
| return img::format("ADD.D %s, %s, %s", fd, fs, ft); |
| } |
| |
| |
| /* |
| * ADD.S fd, fs, ft - Floating Point Add |
| * |
| * 3 2 1 |
| * 10987654321098765432109876543210 |
| * 010001 000101 |
| * fmt ----- |
| * ft ----- |
| * fs ----- |
| * fd ----- |
| */ |
| std::string NMD::ADD_S(uint64 instruction) |
| { |
| uint64 ft_value = extract_ft_25_24_23_22_21(instruction); |
| uint64 fs_value = extract_fs_20_19_18_17_16(instruction); |
| uint64 fd_value = extract_fd_15_14_13_12_11(instruction); |
| |
| std::string ft = FPR(copy(ft_value)); |
| std::string fs = FPR(copy(fs_value)); |
| std::string fd = FPR(copy(fd_value)); |
| |
| return img::format("ADD.S %s, %s, %s", fd, fs, ft); |
| } |
| |
| |
| /* |
| * |
| * |
| * 3 2 1 |
| * 10987654321098765432109876543210 |
| * 001000 0010000100111111 |
| * rt ----- |
| * rs ----- |
| */ |
| std::string NMD::ADDIU_32_(uint64 instruction) |
| { |
| uint64 rt_value = extract_rt_25_24_23_22_21(instruction); |
| uint64 rs_value = extract_rs_20_19_18_17_16(instruction); |
| uint64 u_value = extract_u_15_to_0(instruction); |
| |
| std::string rt = GPR(copy(rt_value)); |
| std::string rs = GPR(copy(rs_value)); |
| std::string u = IMMEDIATE(copy(u_value)); |
| |
| return img::format("ADDIU %s, %s, %s", rt, rs, u); |
| } |
| |
| |
| /* |
| * |
| * |
| * 3 2 1 |
| * 10987654321098765432109876543210 |
| * 001000 0010000100111111 |
| * rt ----- |
| * rs ----- |
| */ |
| std::string NMD::ADDIU_48_(uint64 instruction) |
| { |
| uint64 rt_value = extract_rt_41_40_39_38_37(instruction); |
| int64 s_value = extract_s__se31_15_to_0_31_to_16(instruction); |
| |
| std::string rt = GPR(copy(rt_value)); |
| std::string s = IMMEDIATE(copy(s_value)); |
| |
| return img::format("ADDIU %s, %s", rt, s); |
| } |
| |
| |
| /* |
| * |
| * |
| * 3 2 1 |
| * 10987654321098765432109876543210 |
| * 001000 0010000100111111 |
| * rt ----- |
| * rs ----- |
| */ |
| std::string NMD::ADDIU_GP48_(uint64 instruction) |
| { |
| uint64 rt_value = extract_rt_41_40_39_38_37(instruction); |
| int64 s_value = extract_s__se31_15_to_0_31_to_16(instruction); |
| |
| std::string rt = GPR(copy(rt_value)); |
| std::string s = IMMEDIATE(copy(s_value)); |
| |
| return img::format("ADDIU %s, $%d, %s", rt, 28, s); |
| } |
| |
| |
| /* |
| * |
| * |
| * 3 2 1 |
| * 10987654321098765432109876543210 |
| * 001000 0010000100111111 |
| * rt ----- |
| * rs ----- |
| */ |
| std::string NMD::ADDIU_GP_B_(uint64 instruction) |
| { |
| uint64 rt_value = extract_rt_25_24_23_22_21(instruction); |
| uint64 u_value = extract_u_17_to_0(instruction); |
| |
| std::string rt = GPR(copy(rt_value)); |
| std::string u = IMMEDIATE(copy(u_value)); |
| |
| return img::format("ADDIU %s, $%d, %s", rt, 28, u); |
| } |
| |
| |
| /* |
| * |
| * |
| * 3 2 1 |
| * 10987654321098765432109876543210 |
| * 001000 0010000100111111 |
| * rt ----- |
| * rs ----- |
| */ |
| std::string NMD::ADDIU_GP_W_(uint64 instruction) |
| { |
| uint64 rt_value = extract_rt_25_24_23_22_21(instruction); |
| uint64 u_value = extract_u_20_to_2__s2(instruction); |
| |
| std::string rt = GPR(copy(rt_value)); |
| std::string u = IMMEDIATE(copy(u_value)); |
| |
| return img::format("ADDIU %s, $%d, %s", rt, 28, u); |
| } |
| |
| |
| /* |
| * |
| * |
| * 3 2 1 |
| * 10987654321098765432109876543210 |
| * 001000 0010000100111111 |
| * rt ----- |
| * rs ----- |
| */ |
| std::string NMD::ADDIU_NEG_(uint64 instruction) |
| { |
| uint64 rt_value = extract_rt_25_24_23_22_21(instruction); |
| uint64 rs_value = extract_rs_20_19_18_17_16(instruction); |
| uint64 u_value = extract_u_11_10_9_8_7_6_5_4_3_2_1_0(instruction); |
| |
| std::string rt = GPR(copy(rt_value)); |
| std::string rs = GPR(copy(rs_value)); |
| std::string u = IMMEDIATE(neg_copy(u_value)); |
| |
| return img::format("ADDIU %s, %s, %s", rt, rs, u); |
| } |
| |
| |
| /* |
| * |
| * |
| * 3 2 1 |
| * 10987654321098765432109876543210 |
| * 001000 0010000100111111 |
| * rt ----- |
| * rs ----- |
| */ |
| std::string NMD::ADDIU_R1_SP_(uint64 instruction) |
| { |
| uint64 u_value = extract_u_5_4_3_2_1_0__s2(instruction); |
| uint64 rt3_value = extract_rt3_9_8_7(instruction); |
| |
| std::string rt3 = GPR(decode_gpr_gpr3(rt3_value)); |
| std::string u = IMMEDIATE(copy(u_value)); |
| |
| return img::format("ADDIU %s, $%d, %s", rt3, 29, u); |
| } |
| |
| |
| /* |
| * |
| * |
| * 3 2 1 |
| * 10987654321098765432109876543210 |
| * 001000 0010000100111111 |
| * rt ----- |
| * rs ----- |
| */ |
| std::string NMD::ADDIU_R2_(uint64 instruction) |
| { |
| uint64 rt3_value = extract_rt3_9_8_7(instruction); |
| uint64 rs3_value = extract_rs3_6_5_4(instruction); |
| uint64 u_value = extract_u_2_1_0__s2(instruction); |
| |
| std::string rt3 = GPR(decode_gpr_gpr3(rt3_value)); |
| std::string rs3 = GPR(decode_gpr_gpr3(rs3_value)); |
| std::string u = IMMEDIATE(copy(u_value)); |
| |
| return img::format("ADDIU %s, %s, %s", rt3, rs3, u); |
| } |
| |
| |
| /* |
| * ADDIU[RS5] rt, s5 - Add Signed Word and Set Carry Bit |
| * |
| * 5432109876543210 |
| * 100100 1 |
| * rt ----- |
| * s - --- |
| */ |
| std::string NMD::ADDIU_RS5_(uint64 instruction) |
| { |
| uint64 rt_value = extract_rt_9_8_7_6_5(instruction); |
| int64 s_value = extract_s__se3_4_2_1_0(instruction); |
| |
| std::string rt = GPR(copy(rt_value)); |
| std::string s = IMMEDIATE(copy(s_value)); |
| |
| return img::format("ADDIU %s, %s", rt, s); |
| } |
| |
| |
| /* |
| * |
| * |
| * 3 2 1 |
| * 10987654321098765432109876543210 |
| * 001000 x1110000101 |
| * rt ----- |
| * rs ----- |
| * rd ----- |
| */ |
| std::string NMD::ADDIUPC_32_(uint64 instruction) |
| { |
| uint64 rt_value = extract_rt_25_24_23_22_21(instruction); |
| int64 s_value = extract_s__se21_0_20_to_1_s1(instruction); |
| |
| std::string rt = GPR(copy(rt_value)); |
| std::string s = ADDRESS(encode_s_from_address(s_value), 4); |
| |
| return img::format("ADDIUPC %s, %s", rt, s); |
| } |
| |
| |
| /* |
| * |
| * |
| * 3 2 1 |
| * 10987654321098765432109876543210 |
| * 001000 x1110000101 |
| * rt ----- |
| * rs ----- |
| * rd ----- |
| */ |
| std::string NMD::ADDIUPC_48_(uint64 instruction) |
| { |
| uint64 rt_value = extract_rt_41_40_39_38_37(instruction); |
| int64 s_value = extract_s__se31_15_to_0_31_to_16(instruction); |
| |
| std::string rt = GPR(copy(rt_value)); |
| std::string s = ADDRESS(encode_s_from_address(s_value), 6); |
| |
| return img::format("ADDIUPC %s, %s", rt, s); |
| } |
| |
| |
| /* |
| * [DSP] ADDQ.PH rd, rt, rs - Add fractional halfword vectors |
| * |
| * 3 2 1 |
| * 10987654321098765432109876543210 |
| * 001000 00000001101 |
| * rt ----- |
| * rs ----- |
| * rd ----- |
| */ |
| std::string NMD::ADDQ_PH(uint64 instruction) |
| { |
| uint64 rt_value = extract_rt_25_24_23_22_21(instruction); |
| uint64 rs_value = extract_rs_20_19_18_17_16(instruction); |
| uint64 rd_value = extract_rd_15_14_13_12_11(instruction); |
| |
| std::string rd = GPR(copy(rd_value)); |
| std::string rs = GPR(copy(rs_value)); |
| std::string rt = GPR(copy(rt_value)); |
| |
| return img::format("ADDQ.PH %s, %s, %s", rd, rs, rt); |
| } |
| |
| |
| /* |
| * [DSP] ADDQ_S.PH rd, rt, rs - Add fractional halfword vectors with 16-bit |
| * saturation |
| * |
| * 3 2 1 |
| * 10987654321098765432109876543210 |
| * 001000 10000001101 |
| * rt ----- |
| * rs ----- |
| * rd ----- |
| */ |
| std::string NMD::ADDQ_S_PH(uint64 instruction) |
| { |
| uint64 rt_value = extract_rt_25_24_23_22_21(instruction); |
| uint64 rs_value = extract_rs_20_19_18_17_16(instruction); |
| uint64 rd_value = extract_rd_15_14_13_12_11(instruction); |
| |
| std::string rd = GPR(copy(rd_value)); |
| std::string rs = GPR(copy(rs_value)); |
| std::string rt = GPR(copy(rt_value)); |
| |
| return img::format("ADDQ_S.PH %s, %s, %s", rd, rs, rt); |
| } |
| |
| |
| /* |
| * [DSP] ADDQ_S.W rd, rt, rs - Add fractional words with 32-bit saturation |
| * |
| * 3 2 1 |
| * 10987654321098765432109876543210 |
| * 001000 x1100000101 |
| * rt ----- |
| * rs ----- |
| * rd ----- |
| */ |
| std::string NMD::ADDQ_S_W(uint64 instruction) |
| { |
| uint64 rt_value = extract_rt_25_24_23_22_21(instruction); |
| uint64 rs_value = extract_rs_20_19_18_17_16(instruction); |
| uint64 rd_value = extract_rd_15_14_13_12_11(instruction); |
| |
| std::string rd = GPR(copy(rd_value)); |
| std::string rs = GPR(copy(rs_value)); |
| std::string rt = GPR(copy(rt_value)); |
| |
| return img::format("ADDQ_S.W %s, %s, %s", rd, rs, rt); |
| } |
| |
| |
| /* |
| * [DSP] ADDQH.PH rd, rt, rs - Add fractional halfword vectors and shift |
| * right to halve results |
| * |
| * 3 2 1 |
| * 10987654321098765432109876543210 |
| * 001000 00001001101 |
| * rt ----- |
| * rs ----- |
| * rd ----- |
| */ |
| std::string NMD::ADDQH_PH(uint64 instruction) |
| { |
| uint64 rt_value = extract_rt_25_24_23_22_21(instruction); |
| uint64 rs_value = extract_rs_20_19_18_17_16(instruction); |
| uint64 rd_value = extract_rd_15_14_13_12_11(instruction); |
| |
| std::string rd = GPR(copy(rd_value)); |
| std::string rs = GPR(copy(rs_value)); |
| std::string rt = GPR(copy(rt_value)); |
| |
| return img::format("ADDQH.PH %s, %s, %s", rd, rs, rt); |
| } |
| |
| |
| /* |
| * [DSP] ADDQH_R.PH rd, rt, rs - Add fractional halfword vectors and shift |
| * right to halve results with rounding |
| * |
| * 3 2 1 |
| * 10987654321098765432109876543210 |
| * 001000 10001001101 |
| * rt ----- |
| * rs ----- |
| * rd ----- |
| */ |
| std::string NMD::ADDQH_R_PH(uint64 instruction) |
| { |
| uint64 rt_value = extract_rt_25_24_23_22_21(instruction); |
| uint64 rs_value = extract_rs_20_19_18_17_16(instruction); |
| uint64 rd_value = extract_rd_15_14_13_12_11(instruction); |
| |
| std::string rd = GPR(copy(rd_value)); |
| std::string rs = GPR(copy(rs_value)); |
| std::string rt = GPR(copy(rt_value)); |
| |
| return img::format("ADDQH_R.PH %s, %s, %s", rd, rs, rt); |
| } |
| |
| |
| /* |
| * [DSP] ADDQH_R.W rd, rt, rs - Add fractional words and shift right to halve |
| * results with rounding |
| * |
| * 3 2 1 |
| * 10987654321098765432109876543210 |
| * 001000 00010001101 |
| * rt ----- |
| * rs ----- |
| * rd ----- |
| */ |
| std::string NMD::ADDQH_R_W(uint64 instruction) |
| { |
| uint64 rt_value = extract_rt_25_24_23_22_21(instruction); |
| uint64 rs_value = extract_rs_20_19_18_17_16(instruction); |
| uint64 rd_value = extract_rd_15_14_13_12_11(instruction); |
| |
| std::string rd = GPR(copy(rd_value)); |
| std::string rs = GPR(copy(rs_value)); |
| std::string rt = GPR(copy(rt_value)); |
| |
| return img::format("ADDQH_R.W %s, %s, %s", rd, rs, rt); |
| } |
| |
| |
| /* |
| * [DSP] ADDQH.W rd, rt, rs - Add fractional words and shift right to halve |
| * results |
| * |
| * 3 2 1 |
| * 10987654321098765432109876543210 |
| * 001000 10010001101 |
| * rt ----- |
| * rs ----- |
| * rd ----- |
| */ |
| std::string NMD::ADDQH_W(uint64 instruction) |
| { |
| uint64 rt_value = extract_rt_25_24_23_22_21(instruction); |
| uint64 rs_value = extract_rs_20_19_18_17_16(instruction); |
| uint64 rd_value = extract_rd_15_14_13_12_11(instruction); |
| |
| std::string rd = GPR(copy(rd_value)); |
| std::string rs = GPR(copy(rs_value)); |
| std::string rt = GPR(copy(rt_value)); |
| |
| return img::format("ADDQH.W %s, %s, %s", rd, rs, rt); |
| } |
| |
| |
| /* |
| * [DSP] ADDSC rd, rt, rs - Add two signed words and set carry bit |
| * |
| * 3 2 1 |
| * 10987654321098765432109876543210 |
| * 001000 x1110000101 |
| * rt ----- |
| * rs ----- |
| * rd ----- |
| */ |
| std::string NMD::ADDSC(uint64 instruction) |
| { |
| uint64 rt_value = extract_rt_25_24_23_22_21(instruction); |
| uint64 rs_value = extract_rs_20_19_18_17_16(instruction); |
| uint64 rd_value = extract_rd_15_14_13_12_11(instruction); |
| |
| std::string rd = GPR(copy(rd_value)); |
| std::string rs = GPR(copy(rs_value)); |
| std::string rt = GPR(copy(rt_value)); |
| |
| return img::format("ADDSC %s, %s, %s", rd, rs, rt); |
| } |
| |
| |
| /* |
| * ADDU[16] rd3, rs3, rt3 - |
| * |
| * 5432109876543210 |
| * 101100 0 |
| * rt3 --- |
| * rs3 --- |
| * rd3 --- |
| */ |
| std::string NMD::ADDU_16_(uint64 instruction) |
| { |
| uint64 rt3_value = extract_rt3_9_8_7(instruction); |
| uint64 rs3_value = extract_rs3_6_5_4(instruction); |
| uint64 rd3_value = extract_rd3_3_2_1(instruction); |
| |
| std::string rt3 = GPR(decode_gpr_gpr3(rt3_value)); |
| std::string rs3 = GPR(decode_gpr_gpr3(rs3_value)); |
| std::string rd3 = GPR(decode_gpr_gpr3(rd3_value)); |
| |
| return img::format("ADDU %s, %s, %s", rd3, rs3, rt3); |
| } |
| |
| |
| /* |
| * |
| * |
| * 3 2 1 |
| * 10987654321098765432109876543210 |
| * 001000 x1110000101 |
| * rt ----- |
| * rs ----- |
| * rd ----- |
| */ |
| std::string NMD::ADDU_32_(uint64 instruction) |
| { |
| uint64 rt_value = extract_rt_25_24_23_22_21(instruction); |
| uint64 rs_value = extract_rs_20_19_18_17_16(instruction); |
| uint64 rd_value = extract_rd_15_14_13_12_11(instruction); |
| |
| std::string rd = GPR(copy(rd_value)); |
| std::string rs = GPR(copy(rs_value)); |
| std::string rt = GPR(copy(rt_value)); |
| |
| return img::format("ADDU %s, %s, %s", rd, rs, rt); |
| } |
| |
| |
| /* |
| * |
| * |
| * 3 2 1 |
| * 10987654321098765432109876543210 |
| * 001000 x1110000101 |
| * rt ----- |
| * rs ----- |
| * rd ----- |
| */ |
| std::string NMD::ADDU_4X4_(uint64 instruction) |
| { |
| uint64 rt4_value = extract_rt4_9_7_6_5(instruction); |
| uint64 rs4_value = extract_rs4_4_2_1_0(instruction); |
| |
| std::string rs4 = GPR(decode_gpr_gpr4(rs4_value)); |
| std::string rt4 = GPR(decode_gpr_gpr4(rt4_value)); |
| |
| return img::format("ADDU %s, %s", rs4, rt4); |
| } |
| |
| |
| /* |
| * [DSP] ADDU.PH rd, rt, rs - Add two pairs of unsigned halfwords |
| * |
| * 3 2 1 |
| * 10987654321098765432109876543210 |
| * 001000 00100001101 |
| * rt ----- |
| * rs ----- |
| * rd ----- |
| */ |
| std::string NMD::ADDU_PH(uint64 instruction) |
| { |
| uint64 rt_value = extract_rt_25_24_23_22_21(instruction); |
| uint64 rs_value = extract_rs_20_19_18_17_16(instruction); |
| uint64 rd_value = extract_rd_15_14_13_12_11(instruction); |
| |
| std::string rd = GPR(copy(rd_value)); |
| std::string rs = GPR(copy(rs_value)); |
| std::string rt = GPR(copy(rt_value)); |
| |
| return img::format("ADDU.PH %s, %s, %s", rd, rs, rt); |
| } |
| |
| |
| /* |
| * ADDU.QB rd, rt, rs - Unsigned Add Quad Byte Vectors |
| * |
| * 3 2 1 |
| * 10987654321098765432109876543210 |
| * 001000 00011001101 |
| * rt ----- |
| * rs ----- |
| * rd ----- |
| */ |
| std::string NMD::ADDU_QB(uint64 instruction) |
| { |
| uint64 rt_value = extract_rt_25_24_23_22_21(instruction); |
| uint64 rs_value = extract_rs_20_19_18_17_16(instruction); |
| uint64 rd_value = extract_rd_15_14_13_12_11(instruction); |
| |
| std::string rd = GPR(copy(rd_value)); |
| std::string rs = GPR(copy(rs_value)); |
| std::string rt = GPR(copy(rt_value)); |
| |
| return img::format("ADDU.QB %s, %s, %s", rd, rs, rt); |
| } |
| |
| |
| /* |
| * [DSP] ADDU_S.PH rd, rt, rs - Add two pairs of unsigned halfwords with 16-bit |
| * saturation |
| * |
| * 3 2 1 |
| * 10987654321098765432109876543210 |
| * 001000 10100001101 |
| * rt ----- |
| * rs ----- |
| * rd ----- |
| */ |
| std::string NMD::ADDU_S_PH(uint64 instruction) |
| { |
| uint64 rt_value = extract_rt_25_24_23_22_21(instruction); |
| uint64 rs_value = extract_rs_20_19_18_17_16(instruction); |
| uint64 rd_value = extract_rd_15_14_13_12_11(instruction); |
| |
| std::string rd = GPR(copy(rd_value)); |
| std::string rs = GPR(copy(rs_value)); |
| std::string rt = GPR(copy(rt_value)); |
| |
| return img::format("ADDU_S.PH %s, %s, %s", rd, rs, rt); |
| } |
| |
| |
| /* |
| * ADDU_S.QB rd, rt, rs - Unsigned Add Quad Byte Vectors |
| * |
| * 3 2 1 |
| * 10987654321098765432109876543210 |
| * 001000 10011001101 |
| * rt ----- |
| * rs ----- |
| * rd ----- |
| */ |
| std::string NMD::ADDU_S_QB(uint64 instruction) |
| { |
| uint64 rt_value = extract_rt_25_24_23_22_21(instruction); |
| uint64 rs_value = extract_rs_20_19_18_17_16(instruction); |
| uint64 rd_value = extract_rd_15_14_13_12_11(instruction); |
| |
| std::string rd = GPR(copy(rd_value)); |
| std::string rs = GPR(copy(rs_value)); |
| std::string rt = GPR(copy(rt_value)); |
| |
| return img::format("ADDU_S.QB %s, %s, %s", rd, rs, rt); |
| } |
| |
| |
| /* |
| * ADDUH.QB rd, rt, rs - Unsigned Add Vector Quad-Bytes And Right Shift |
| * to Halve Results |
| * |
| * 3 2 1 |
| * 10987654321098765432109876543210 |
| * 001000 00101001101 |
| * rt ----- |
| * rs ----- |
| * rd ----- |
| */ |
| std::string NMD::ADDUH_QB(uint64 instruction) |
| { |
| uint64 rt_value = extract_rt_25_24_23_22_21(instruction); |
| uint64 rs_value = extract_rs_20_19_18_17_16(instruction); |
| uint64 rd_value = extract_rd_15_14_13_12_11(instruction); |
| |
| std::string rd = GPR(copy(rd_value)); |
| std::string rs = GPR(copy(rs_value)); |
| std::string rt = GPR(copy(rt_value)); |
| |
| return img::format("ADDUH.QB %s, %s, %s", rd, rs, rt); |
| } |
| |
| |
| /* |
| * ADDUH_R.QB rd, rt, rs - Unsigned Add Vector Quad-Bytes And Right Shift |
| * to Halve Results |
| * |
| * 3 2 1 |
| * 10987654321098765432109876543210 |
| * 001000 10101001101 |
| * rt ----- |
| * rs ----- |
| * rd ----- |
| */ |
| std::string NMD::ADDUH_R_QB(uint64 instruction) |
| { |
| uint64 rt_value = extract_rt_25_24_23_22_21(instruction); |
| uint64 rs_value = extract_rs_20_19_18_17_16(instruction); |
| uint64 rd_value = extract_rd_15_14_13_12_11(instruction); |
| |
| std::string rd = GPR(copy(rd_value)); |
| std::string rs = GPR(copy(rs_value)); |
| std::string rt = GPR(copy(rt_value)); |
| |
| return img::format("ADDUH_R.QB %s, %s, %s", rd, rs, rt); |
| } |
| |
| /* |
| * ADDWC rd, rt, rs - Add Word with Carry Bit |
| * |
| * 3 2 1 |
| * 10987654321098765432109876543210 |
| * 001000 x1111000101 |
| * rt ----- |
| * rs ----- |
| * rd ----- |
| */ |
| std::string NMD::ADDWC(uint64 instruction) |
| { |
| uint64 rt_value = extract_rt_25_24_23_22_21(instruction); |
| uint64 rs_value = extract_rs_20_19_18_17_16(instruction); |
| uint64 rd_value = extract_rd_15_14_13_12_11(instruction); |
| |
| std::string rd = GPR(copy(rd_value)); |
| std::string rs = GPR(copy(rs_value)); |
| std::string rt = GPR(copy(rt_value)); |
| |
| return img::format("ADDWC %s, %s, %s", rd, rs, rt); |
| } |
| |
| |
| /* |
| * |
| * |
| * 3 2 1 |
| * 10987654321098765432109876543210 |
| * 001000 x1110000101 |
| * rt ----- |
| * rs ----- |
| * rd ----- |
| */ |
| std::string NMD::ALUIPC(uint64 instruction) |
| { |
| uint64 rt_value = extract_rt_25_24_23_22_21(instruction); |
| int64 s_value = extract_s__se31_0_11_to_2_20_to_12_s12(instruction); |
| |
| std::string rt = GPR(copy(rt_value)); |
| std::string s = ADDRESS(encode_s_from_address(s_value), 4); |
| |
| return img::format("ALUIPC %s, %%pcrel_hi(%s)", rt, s); |
| } |
| |
| |
| /* |
| * AND[16] rt3, rs3 - |
| * |
| * 5432109876543210 |
| * 101100 |
| * rt3 --- |
| * rs3 --- |
| * eu ---- |
| */ |
| std::string NMD::AND_16_(uint64 instruction) |
| { |
| uint64 rt3_value = extract_rt3_9_8_7(instruction); |
| uint64 rs3_value = extract_rs3_6_5_4(instruction); |
| |
| std::string rt3 = GPR(decode_gpr_gpr3(rt3_value)); |
| std::string rs3 = GPR(decode_gpr_gpr3(rs3_value)); |
| |
| return img::format("AND %s, %s", rs3, rt3); |
| } |
| |
| |
| /* |
| * |
| * |
| * 3 2 1 |
| * 10987654321098765432109876543210 |
| * 001000 x1110000101 |
| * rt ----- |
| * rs ----- |
| * rd ----- |
| */ |
| std::string NMD::AND_32_(uint64 instruction) |
| { |
| uint64 rt_value = extract_rt_25_24_23_22_21(instruction); |
| uint64 rs_value = extract_rs_20_19_18_17_16(instruction); |
| uint64 rd_value = extract_rd_15_14_13_12_11(instruction); |
| |
| std::string rd = GPR(copy(rd_value)); |
| std::string rs = GPR(copy(rs_value)); |
| std::string rt = GPR(copy(rt_value)); |
| |
| return img::format("AND %s, %s, %s", rd, rs, rt); |
| } |
| |
| |
| /* |
| * ANDI rt, rs, u - |
| * |
| * 5432109876543210 |
| * 101100 |
| * rt3 --- |
| * rs3 --- |
| * eu ---- |
| */ |
| std::string NMD::ANDI_16_(uint64 instruction) |
| { |
| uint64 rt3_value = extract_rt3_9_8_7(instruction); |
| uint64 rs3_value = extract_rs3_6_5_4(instruction); |
| uint64 eu_value = extract_eu_3_2_1_0(instruction); |
| |
| std::string rt3 = GPR(decode_gpr_gpr3(rt3_value)); |
| std::string rs3 = GPR(decode_gpr_gpr3(rs3_value)); |
| std::string eu = IMMEDIATE(encode_eu_from_u_andi16(eu_value)); |
| |
| return img::format("ANDI %s, %s, %s", rt3, rs3, eu); |
| } |
| |
| |
| /* |
| * |
| * |
| * 3 2 1 |
| * 10987654321098765432109876543210 |
| * 001000 x1110000101 |
| * rt ----- |
| * rs ----- |
| * rd ----- |
| */ |
| std::string NMD::ANDI_32_(uint64 instruction) |
| { |
| uint64 rt_value = extract_rt_25_24_23_22_21(instruction); |
| uint64 rs_value = extract_rs_20_19_18_17_16(instruction); |
| uint64 u_value = extract_u_11_10_9_8_7_6_5_4_3_2_1_0(instruction); |
| |
| std::string rt = GPR(copy(rt_value)); |
| std::string rs = GPR(copy(rs_value)); |
| std::string u = IMMEDIATE(copy(u_value)); |
| |
| return img::format("ANDI %s, %s, %s", rt, rs, u); |
| } |
| |
| |
| /* |
| * |
| * |
| * 3 2 1 |
| * 10987654321098765432109876543210 |
| * 001000 x1110000101 |
| * rt ----- |
| * rs ----- |
| * rd ----- |
| */ |
| std::string NMD::APPEND(uint64 instruction) |
| { |
| uint64 rt_value = extract_rt_25_24_23_22_21(instruction); |
| uint64 rs_value = extract_rs_20_19_18_17_16(instruction); |
| uint64 sa_value = extract_sa_15_14_13_12_11(instruction); |
| |
| std::string rt = GPR(copy(rt_value)); |
| std::string rs = GPR(copy(rs_value)); |
| std::string sa = IMMEDIATE(copy(sa_value)); |
| |
| return img::format("APPEND %s, %s, %s", rt, rs, sa); |
| } |
| |
| |
| /* |
| * |
| * |
| * 3 2 1 |
| * 10987654321098765432109876543210 |
| * 001000 x1110000101 |
| * rt ----- |
| * rs ----- |
| * rd ----- |
| */ |
| std::string NMD::ASET(uint64 instruction) |
| { |
| uint64 bit_value = extract_bit_23_22_21(instruction); |
| uint64 rs_value = extract_rs_20_19_18_17_16(instruction); |
| int64 s_value = extract_s__se8_15_7_6_5_4_3_2_1_0(instruction); |
| |
| std::string bit = IMMEDIATE(copy(bit_value)); |
| std::string s = IMMEDIATE(copy(s_value)); |
| std::string rs = GPR(copy(rs_value)); |
| |
| return img::format("ASET %s, %s(%s)", bit, s, rs); |
| } |
| |
| |
| /* |
| * |
| * |
| * 3 2 1 |
| * 10987654321098765432109876543210 |
| * 001000 x1110000101 |
| * rt ----- |
| * rs ----- |
| * rd ----- |
| */ |
| std::string NMD::BALC_16_(uint64 instruction) |
| { |
| int64 s_value = extract_s__se10_0_9_8_7_6_5_4_3_2_1_s1(instruction); |
| |
| std::string s = ADDRESS(encode_s_from_address(s_value), 2); |
| |
| return img::format("BALC %s", s); |
| } |
| |
| |
| /* |
| * |
| * |
| * 3 2 1 |
| * 10987654321098765432109876543210 |
| * 001000 x1110000101 |
| * rt ----- |
| * rs ----- |
| * rd ----- |
| */ |
| std::string NMD::BALC_32_(uint64 instruction) |
| { |
| int64 s_value = extract_s__se25_0_24_to_1_s1(instruction); |
| |
| std::string s = ADDRESS(encode_s_from_address(s_value), 4); |
| |
| return img::format("BALC %s", s); |
| } |
| |
| |
| /* |
| * |
| * |
| * 3 2 1 |
| * 10987654321098765432109876543210 |
| * 001000 x1110000101 |
| * rt ----- |
| * rs ----- |
| * rd ----- |
| */ |
| std::string NMD::BALRSC(uint64 instruction) |
| { |
| uint64 rt_value = extract_rt_25_24_23_22_21(instruction); |
| uint64 rs_value = extract_rs_20_19_18_17_16(instruction); |
| |
| std::string rt = GPR(copy(rt_value)); |
| std::string rs = GPR(copy(rs_value)); |
| |
| return img::format("BALRSC %s, %s", rt, rs); |
| } |
| |
| |
| /* |
| * |
| * |
| * 3 2 1 |
| * 10987654321098765432109876543210 |
| * 001000 x1110000101 |
| * rt ----- |
| * rs ----- |
| * rd ----- |
| */ |
| std::string NMD::BBEQZC(uint64 instruction) |
| { |
| uint64 rt_value = extract_rt_25_24_23_22_21(instruction); |
| uint64 bit_value = extract_bit_16_15_14_13_12_11(instruction); |
| int64 s_value = extract_s__se11_0_10_9_8_7_6_5_4_3_2_1_0_s1(instruction); |
| |
| std::string rt = GPR(copy(rt_value)); |
| std::string bit = IMMEDIATE(copy(bit_value)); |
| std::string s = ADDRESS(encode_s_from_address(s_value), 4); |
| |
| return img::format("BBEQZC %s, %s, %s", rt, bit, s); |
| } |
| |
| |
| /* |
| * |
| * |
| * 3 2 1 |
| * 10987654321098765432109876543210 |
| * 001000 x1110000101 |
| * rt ----- |
| * rs ----- |
| * rd ----- |
| */ |
| std::string NMD::BBNEZC(uint64 instruction) |
| { |
| uint64 rt_value = extract_rt_25_24_23_22_21(instruction); |
| uint64 bit_value = extract_bit_16_15_14_13_12_11(instruction); |
| int64 s_value = extract_s__se11_0_10_9_8_7_6_5_4_3_2_1_0_s1(instruction); |
| |
| std::string rt = GPR(copy(rt_value)); |
| std::string bit = IMMEDIATE(copy(bit_value)); |
| std::string s = ADDRESS(encode_s_from_address(s_value), 4); |
| |
| return img::format("BBNEZC %s, %s, %s", rt, bit, s); |
| } |
| |
| |
| /* |
| * |
| * |
| * 3 2 1 |
| * 10987654321098765432109876543210 |
| * 001000 x1110000101 |
| * rt ----- |
| * rs ----- |
| * rd ----- |
| */ |
| std::string NMD::BC_16_(uint64 instruction) |
| { |
| int64 s_value = extract_s__se10_0_9_8_7_6_5_4_3_2_1_s1(instruction); |
| |
| std::string s = ADDRESS(encode_s_from_address(s_value), 2); |
| |
| return img::format("BC %s", s); |
| } |
| |
| |
| /* |
| * |
| * |
| * 3 2 1 |
| * 10987654321098765432109876543210 |
| * 001000 x1110000101 |
| * rt ----- |
| * rs ----- |
| * rd ----- |
| */ |
| std::string NMD::BC_32_(uint64 instruction) |
| { |
| int64 s_value = extract_s__se25_0_24_to_1_s1(instruction); |
| |
| std::string s = ADDRESS(encode_s_from_address(s_value), 4); |
| |
| return img::format("BC %s", s); |
| } |
| |
| |
| /* |
| * |
| * |
| * 3 2 1 |
| * 10987654321098765432109876543210 |
| * 001000 x1110000101 |
| * rt ----- |
| * rs ----- |
| * rd ----- |
| */ |
| std::string NMD::BC1EQZC(uint64 instruction) |
| { |
| uint64 ft_value = extract_ft_25_24_23_22_21(instruction); |
| int64 s_value = extract_s__se14_0_13_to_1_s1(instruction); |
| |
| std::string ft = FPR(copy(ft_value)); |
| std::string s = ADDRESS(encode_s_from_address(s_value), 4); |
| |
| return img::format("BC1EQZC %s, %s", ft, s); |
| } |
| |
| |
| /* |
| * |
| * |
| * 3 2 1 |
| * 10987654321098765432109876543210 |
| * 001000 x1110000101 |
| * rt ----- |
| * rs ----- |
| * rd ----- |
| */ |
| std::string NMD::BC1NEZC(uint64 instruction) |
| { |
| uint64 ft_value = extract_ft_25_24_23_22_21(instruction); |
| int64 s_value = extract_s__se14_0_13_to_1_s1(instruction); |
| |
| std::string ft = FPR(copy(ft_value)); |
| std::string s = ADDRESS(encode_s_from_address(s_value), 4); |
| |
| return img::format("BC1NEZC %s, %s", ft, s); |
| } |
| |
| |
| /* |
| * |
| * |
| * 3 2 1 |
| * 10987654321098765432109876543210 |
| * 001000 x1110000101 |
| * rt ----- |
| * rs ----- |
| * rd ----- |
| */ |
| std::string NMD::BC2EQZC(uint64 instruction) |
| { |
| uint64 ct_value = extract_ct_25_24_23_22_21(instruction); |
| int64 s_value = extract_s__se14_0_13_to_1_s1(instruction); |
| |
| std::string ct = CPR(copy(ct_value)); |
| std::string s = ADDRESS(encode_s_from_address(s_value), 4); |
| |
| return img::format("BC2EQZC %s, %s", ct, s); |
| } |
| |
| |
| /* |
| * |
| * |
| * 3 2 1 |
| * 10987654321098765432109876543210 |
| * 001000 x1110000101 |
| * rt ----- |
| * rs ----- |
| * rd ----- |
| */ |
| std::string NMD::BC2NEZC(uint64 instruction) |
| { |
| uint64 ct_value = extract_ct_25_24_23_22_21(instruction); |
| int64 s_value = extract_s__se14_0_13_to_1_s1(instruction); |
| |
| std::string ct = CPR(copy(ct_value)); |
| std::string s = ADDRESS(encode_s_from_address(s_value), 4); |
| |
| return img::format("BC2NEZC %s, %s", ct, s); |
| } |
| |
| |
| /* |
| * |
| * |
| * 3 2 1 |
| * 10987654321098765432109876543210 |
| * 001000 x1110000101 |
| * rt ----- |
| * rs ----- |
| * rd ----- |
| */ |
| std::string NMD::BEQC_16_(uint64 instruction) |
| { |
| uint64 rt3_value = extract_rt3_9_8_7(instruction); |
| uint64 rs3_value = extract_rs3_6_5_4(instruction); |
| uint64 u_value = extract_u_3_2_1_0__s1(instruction); |
| |
| std::string rs3 = GPR(encode_rs3_and_check_rs3_lt_rt3(rs3_value)); |
| std::string rt3 = GPR(decode_gpr_gpr3(rt3_value)); |
| std::string u = ADDRESS(encode_u_from_address(u_value), 2); |
| |
| return img::format("BEQC %s, %s, %s", rs3, rt3, u); |
| } |
| |
| |
| /* |
| * |
| * |
| * 3 2 1 |
| * 10987654321098765432109876543210 |
| * 001000 x1110000101 |
| * rt ----- |
| * rs ----- |
| * rd ----- |
| */ |
| std::string NMD::BEQC_32_(uint64 instruction) |
| { |
| uint64 rt_value = extract_rt_25_24_23_22_21(instruction); |
| uint64 rs_value = extract_rs_20_19_18_17_16(instruction); |
| int64 s_value = extract_s__se14_0_13_to_1_s1(instruction); |
| |
| std::string rs = GPR(copy(rs_value)); |
| std::string rt = GPR(copy(rt_value)); |
| std::string s = ADDRESS(encode_s_from_address(s_value), 4); |
| |
| return img::format("BEQC %s, %s, %s", rs, rt, s); |
| } |
| |
| |
| /* |
| * |
| * |
| * 3 2 1 |
| * 10987654321098765432109876543210 |
| * 001000 x1110000101 |
| * rt ----- |
| * rs ----- |
| * rd ----- |
| */ |
| std::string NMD::BEQIC(uint64 instruction) |
| { |
| uint64 rt_value = extract_rt_25_24_23_22_21(instruction); |
| uint64 u_value = extract_u_17_16_15_14_13_12_11(instruction); |
| int64 s_value = extract_s__se11_0_10_9_8_7_6_5_4_3_2_1_0_s1(instruction); |
| |
| std::string rt = GPR(copy(rt_value)); |
| std::string u = IMMEDIATE(copy(u_value)); |
| std::string s = ADDRESS(encode_s_from_address(s_value), 4); |
| |
| return img::format("BEQIC %s, %s, %s", rt, u, s); |
| } |
| |
| |
| /* |
| * |
| * |
| * 3 2 1 |
| * 10987654321098765432109876543210 |
| * 001000 x1110000101 |
| * rt ----- |
| * rs ----- |
| * rd ----- |
| */ |
| std::string NMD::BEQZC_16_(uint64 instruction) |
| { |
| uint64 rt3_value = extract_rt3_9_8_7(instruction); |
| int64 s_value = extract_s__se7_0_6_5_4_3_2_1_s1(instruction); |
| |
| std::string rt3 = GPR(decode_gpr_gpr3(rt3_value)); |
| std::string s = ADDRESS(encode_s_from_address(s_value), 2); |
| |
| return img::format("BEQZC %s, %s", rt3, s); |
| } |
| |
| |
| /* |
| * |
| * |
| * 3 2 1 |
| * 10987654321098765432109876543210 |
| * 001000 x1110000101 |
| * rt ----- |
| * rs ----- |
| * rd ----- |
| */ |
| std::string NMD::BGEC(uint64 instruction) |
| { |
| uint64 rt_value = extract_rt_25_24_23_22_21(instruction); |
| uint64 rs_value = extract_rs_20_19_18_17_16(instruction); |
| int64 s_value = extract_s__se14_0_13_to_1_s1(instruction); |
| |
| std::string rs = GPR(copy(rs_value)); |
| std::string rt = GPR(copy(rt_value)); |
| std::string s = ADDRESS(encode_s_from_address(s_value), 4); |
| |
| return img::format("BGEC %s, %s, %s", rs, rt, s); |
| } |
| |
| |
| /* |
| * |
| * |
| * 3 2 1 |
| * 10987654321098765432109876543210 |
| * 001000 x1110000101 |
| * rt ----- |
| * rs ----- |
| * rd ----- |
| */ |
| std::string NMD::BGEIC(uint64 instruction) |
| { |
| uint64 rt_value = extract_rt_25_24_23_22_21(instruction); |
| uint64 u_value = extract_u_17_16_15_14_13_12_11(instruction); |
| int64 s_value = extract_s__se11_0_10_9_8_7_6_5_4_3_2_1_0_s1(instruction); |
| |
| std::string rt = GPR(copy(rt_value)); |
| std::string u = IMMEDIATE(copy(u_value)); |
| std::string s = ADDRESS(encode_s_from_address(s_value), 4); |
| |
| return img::format("BGEIC %s, %s, %s", rt, u, s); |
| } |
| |
| |
| /* |
| * |
| * |
| * 3 2 1 |
| * 10987654321098765432109876543210 |
| * 001000 x1110000101 |
| * rt ----- |
| * rs ----- |
| * rd ----- |
| */ |
| std::string NMD::BGEIUC(uint64 instruction) |
| { |
| uint64 rt_value = extract_rt_25_24_23_22_21(instruction); |
| uint64 u_value = extract_u_17_16_15_14_13_12_11(instruction); |
| int64 s_value = extract_s__se11_0_10_9_8_7_6_5_4_3_2_1_0_s1(instruction); |
| |
| std::string rt = GPR(copy(rt_value)); |
| std::string u = IMMEDIATE(copy(u_value)); |
| std::string s = ADDRESS(encode_s_from_address(s_value), 4); |
| |
| return img::format("BGEIUC %s, %s, %s", rt, u, s); |
| } |
| |
| |
| /* |
| * |
| * |
| * 3 2 1 |
| * 10987654321098765432109876543210 |
| * 001000 x1110000101 |
| * rt ----- |
| * rs ----- |
| * rd ----- |
| */ |
| std::string NMD::BGEUC(uint64 instruction) |
| { |
| uint64 rt_value = extract_rt_25_24_23_22_21(instruction); |
| uint64 rs_value = extract_rs_20_19_18_17_16(instruction); |
| int64 s_value = extract_s__se14_0_13_to_1_s1(instruction); |
| |
| std::string rs = GPR(copy(rs_value)); |
| std::string rt = GPR(copy(rt_value)); |
| std::string s = ADDRESS(encode_s_from_address(s_value), 4); |
| |
| return img::format("BGEUC %s, %s, %s", rs, rt, s); |
| } |
| |
| |
| /* |
| * |
| * |
| * 3 2 1 |
| * 10987654321098765432109876543210 |
| * 001000 x1110000101 |
| * rt ----- |
| * rs ----- |
| * rd ----- |
| */ |
| std::string NMD::BLTC(uint64 instruction) |
| { |
| uint64 rt_value = extract_rt_25_24_23_22_21(instruction); |
| uint64 rs_value = extract_rs_20_19_18_17_16(instruction); |
| int64 s_value = extract_s__se14_0_13_to_1_s1(instruction); |
| |
| std::string rs = GPR(copy(rs_value)); |
| std::string rt = GPR(copy(rt_value)); |
| std::string s = ADDRESS(encode_s_from_address(s_value), 4); |
| |
| return img::format("BLTC %s, %s, %s", rs, rt, s); |
| } |
| |
| |
| /* |
| * |
| * |
| * 3 2 1 |
| * 10987654321098765432109876543210 |
| * 001000 x1110000101 |
| * rt ----- |
| * rs ----- |
| * rd ----- |
| */ |
| std::string NMD::BLTIC(uint64 instruction) |
| { |
| uint64 rt_value = extract_rt_25_24_23_22_21(instruction); |
| uint64 u_value = extract_u_17_16_15_14_13_12_11(instruction); |
| int64 s_value = extract_s__se11_0_10_9_8_7_6_5_4_3_2_1_0_s1(instruction); |
| |
| std::string rt = GPR(copy(rt_value)); |
| std::string u = IMMEDIATE(copy(u_value)); |
| std::string s = ADDRESS(encode_s_from_address(s_value), 4); |
| |
| return img::format("BLTIC %s, %s, %s", rt, u, s); |
| } |
| |
| |
| /* |
| * |
| * |
| * 3 2 1 |
| * 10987654321098765432109876543210 |
| * 001000 x1110000101 |
| * rt ----- |
| * rs ----- |
| * rd ----- |
| */ |
| std::string NMD::BLTIUC(uint64 instruction) |
| { |
| uint64 rt_value = extract_rt_25_24_23_22_21(instruction); |
| uint64 u_value = extract_u_17_16_15_14_13_12_11(instruction); |
| int64 s_value = extract_s__se11_0_10_9_8_7_6_5_4_3_2_1_0_s1(instruction); |
| |
| std::string rt = GPR(copy(rt_value)); |
| std::string u = IMMEDIATE(copy(u_value)); |
| std::string s = ADDRESS(encode_s_from_address(s_value), 4); |
| |
| return img::format("BLTIUC %s, %s, %s", rt, u, s); |
| } |
| |
| |
| /* |
| * |
| * |
| * 3 2 1 |
| * 10987654321098765432109876543210 |
| * 001000 x1110000101 |
| * rt ----- |
| * rs ----- |
| * rd ----- |
| */ |
| std::string NMD::BLTUC(uint64 instruction) |
| { |
| uint64 rt_value = extract_rt_25_24_23_22_21(instruction); |
| uint64 rs_value = extract_rs_20_19_18_17_16(instruction); |
| int64 s_value = extract_s__se14_0_13_to_1_s1(instruction); |
| |
| std::string rs = GPR(copy(rs_value)); |
| std::string rt = GPR(copy(rt_value)); |
| std::string s = ADDRESS(encode_s_from_address(s_value), 4); |
| |
| return img::format("BLTUC %s, %s, %s", rs, rt, s); |
| } |
| |
| |
| /* |
| * |
| * |
| * 3 2 1 |
| * 10987654321098765432109876543210 |
| * 001000 x1110000101 |
| * rt ----- |
| * rs ----- |
| * rd ----- |
| */ |
| std::string NMD::BNEC_16_(uint64 instruction) |
| { |
| uint64 rt3_value = extract_rt3_9_8_7(instruction); |
| uint64 rs3_value = extract_rs3_6_5_4(instruction); |
| uint64 u_value = extract_u_3_2_1_0__s1(instruction); |
| |
| std::string rs3 = GPR(encode_rs3_and_check_rs3_ge_rt3(rs3_value)); |
| std::string rt3 = GPR(decode_gpr_gpr3(rt3_value)); |
| std::string u = ADDRESS(encode_u_from_address(u_value), 2); |
| |
| return img::format("BNEC %s, %s, %s", rs3, rt3, u); |
| } |
| |
| |
| /* |
| * |
| * |
| * 3 2 1 |
| * 10987654321098765432109876543210 |
| * 001000 x1110000101 |
| * rt ----- |
| * rs ----- |
| * rd ----- |
| */ |
| std::string NMD::BNEC_32_(uint64 instruction) |
| { |
| uint64 rt_value = extract_rt_25_24_23_22_21(instruction); |
| uint64 rs_value = extract_rs_20_19_18_17_16(instruction); |
| int64 s_value = extract_s__se14_0_13_to_1_s1(instruction); |
| |
| std::string rs = GPR(copy(rs_value)); |
| std::string rt = GPR(copy(rt_value)); |
| std::string s = ADDRESS(encode_s_from_address(s_value), 4); |
| |
| return img::format("BNEC %s, %s, %s", rs, rt, s); |
| } |
| |
| |
| /* |
| * |
| * |
| * 3 2 1 |
| * 10987654321098765432109876543210 |
| * 001000 x1110000101 |
| * rt ----- |
| * rs ----- |
| * rd ----- |
| */ |
| std::string NMD::BNEIC(uint64 instruction) |
| { |
| uint64 rt_value = extract_rt_25_24_23_22_21(instruction); |
| uint64 u_value = extract_u_17_16_15_14_13_12_11(instruction); |
| int64 s_value = extract_s__se11_0_10_9_8_7_6_5_4_3_2_1_0_s1(instruction); |
| |
| std::string rt = GPR(copy(rt_value)); |
| std::string u = IMMEDIATE(copy(u_value)); |
| std::string s = ADDRESS(encode_s_from_address(s_value), 4); |
| |
| return img::format("BNEIC %s, %s, %s", rt, u, s); |
| } |
| |
| |
| /* |
| * |
| * |
| * 3 2 1 |
| * 10987654321098765432109876543210 |
| * 001000 x1110000101 |
| * rt ----- |
| * rs ----- |
| * rd ----- |
| */ |
| std::string NMD::BNEZC_16_(uint64 instruction) |
| { |
| uint64 rt3_value = extract_rt3_9_8_7(instruction); |
| int64 s_value = extract_s__se7_0_6_5_4_3_2_1_s1(instruction); |
| |
| std::string rt3 = GPR(decode_gpr_gpr3(rt3_value)); |
| std::string s = ADDRESS(encode_s_from_address(s_value), 2); |
| |
| return img::format("BNEZC %s, %s", rt3, s); |
| } |
| |
| |
| /* |
| * [DSP] BPOSGE32C offset - Branch on greater than or equal to value 32 in |
| * DSPControl Pos field |
| * |
| * 3 2 1 |
| * 10987654321098765432109876543210 |
| * 100010xxxxx0010001 |
| * s[13:1] ------------- |
| * s[14] - |
| */ |
| std::string NMD::BPOSGE32C(uint64 instruction) |
| { |
| int64 s_value = extract_s__se14_0_13_to_1_s1(instruction); |
| |
| std::string s = ADDRESS(encode_s_from_address(s_value), 4); |
| |
| return img::format("BPOSGE32C %s", s); |
| } |
| |
| |
| /* |
| * |
| * |
| * 3 2 1 |
| * 10987654321098765432109876543210 |
| * 001000 x1110000101 |
| * rt ----- |
| * rs ----- |
| * rd ----- |
| */ |
| std::string NMD::BREAK_16_(uint64 instruction) |
| { |
| uint64 code_value = extract_code_2_1_0(instruction); |
| |
| std::string code = IMMEDIATE(copy(code_value)); |
| |
| return img::format("BREAK %s", code); |
| } |
| |
| |
| /* |
| * BREAK code - Break. Cause a Breakpoint exception |
| * |
| * 3 2 1 |
| * 10987654321098765432109876543210 |
| * 001000 x1110000101 |
| * rt ----- |
| * rs ----- |
| * rd ----- |
| */ |
| std::string NMD::BREAK_32_(uint64 instruction) |
| { |
| uint64 code_value = extract_code_18_to_0(instruction); |
| |
| std::string code = IMMEDIATE(copy(code_value)); |
| |
| return img::format("BREAK %s", code); |
| } |
| |
| |
| /* |
| * |
| * |
| * 3 2 1 |
| * 10987654321098765432109876543210 |
| * 001000 x1110000101 |
| * rt ----- |
| * rs ----- |
| * rd ----- |
| */ |
| std::string NMD::BRSC(uint64 instruction) |
| { |
| uint64 rs_value = extract_rs_20_19_18_17_16(instruction); |
| |
| std::string rs = GPR(copy(rs_value)); |
| |
| return img::format("BRSC %s", rs); |
| } |
| |
| |
| /* |
| * |
| * |
| * 3 2 1 |
| * 10987654321098765432109876543210 |
| * 001000 x1110000101 |
| * rt ----- |
| * rs ----- |
| * rd ----- |
| */ |
| std::string NMD::CACHE(uint64 instruction) |
| { |
| uint64 op_value = extract_op_25_24_23_22_21(instruction); |
| uint64 rs_value = extract_rs_20_19_18_17_16(instruction); |
| int64 s_value = extract_s__se8_15_7_6_5_4_3_2_1_0(instruction); |
| |
| std::string op = IMMEDIATE(copy(op_value)); |
| std::string s = IMMEDIATE(copy(s_value)); |
| std::string rs = GPR(copy(rs_value)); |
| |
| return img::format("CACHE %s, %s(%s)", op, s, rs); |
| } |
| |
| |
| /* |
| * |
| * |
| * 3 2 1 |
| * 10987654321098765432109876543210 |
| * 001000 x1110000101 |
| * rt ----- |
| * rs ----- |
| * rd ----- |
| */ |
| std::string NMD::CACHEE(uint64 instruction) |
| { |
| uint64 op_value = extract_op_25_24_23_22_21(instruction); |
| uint64 rs_value = extract_rs_20_19_18_17_16(instruction); |
| int64 s_value = extract_s__se8_15_7_6_5_4_3_2_1_0(instruction); |
| |
| std::string op = IMMEDIATE(copy(op_value)); |
| std::string s = IMMEDIATE(copy(s_value)); |
| std::string rs = GPR(copy(rs_value)); |
| |
| return img::format("CACHEE %s, %s(%s)", op, s, rs); |
| } |
| |
| |
| /* |
| * |
| * |
| * 3 2 1 |
| * 10987654321098765432109876543210 |
| * 001000 x1110000101 |
| * rt ----- |
| * rs ----- |
| * rd ----- |
| */ |
| std::string NMD::CEIL_L_D(uint64 instruction) |
| { |
| uint64 ft_value = extract_ft_25_24_23_22_21(instruction); |
| uint64 fs_value = extract_fs_20_19_18_17_16(instruction); |
| |
| std::string ft = FPR(copy(ft_value)); |
| std::string fs = FPR(copy(fs_value)); |
| |
| return img::format("CEIL.L.D %s, %s", ft, fs); |
| } |
| |
| |
| /* |
| * |
| * |
| * 3 2 1 |
| * 10987654321098765432109876543210 |
| * 001000 x1110000101 |
| * rt ----- |
| * rs ----- |
| * rd ----- |
| */ |
| std::string NMD::CEIL_L_S(uint64 instruction) |
| { |
| uint64 ft_value = extract_ft_25_24_23_22_21(instruction); |
| uint64 fs_value = extract_fs_20_19_18_17_16(instruction); |
| |
| std::string ft = FPR(copy(ft_value)); |
| std::string fs = FPR(copy(fs_value)); |
| |
| return img::format("CEIL.L.S %s, %s", ft, fs); |
| } |
| |
| |
| /* |
| * |
| * |
| * 3 2 1 |
| * 10987654321098765432109876543210 |
| * 001000 x1110000101 |
| * rt ----- |
| * rs ----- |
| * rd ----- |
| */ |
| std::string NMD::CEIL_W_D(uint64 instruction) |
| { |
| uint64 ft_value = extract_ft_25_24_23_22_21(instruction); |
| uint64 fs_value = extract_fs_20_19_18_17_16(instruction); |
| |
| std::string ft = FPR(copy(ft_value)); |
| std::string fs = FPR(copy(fs_value)); |
| |
| return img::format("CEIL.W.D %s, %s", ft, fs); |
| } |
| |
| |
| /* |
| * |
| * |
| * 3 2 1 |
| * 10987654321098765432109876543210 |
| * 001000 x1110000101 |
| * rt ----- |
| * rs ----- |
| * rd ----- |
| */ |
| std::string NMD::CEIL_W_S(uint64 instruction) |
| { |
| uint64 ft_value = extract_ft_25_24_23_22_21(instruction); |
| uint64 fs_value = extract_fs_20_19_18_17_16(instruction); |
| |
| std::string ft = FPR(copy(ft_value)); |
| std::string fs = FPR(copy(fs_value)); |
| |
| return img::format("CEIL.W.S %s, %s", ft, fs); |
| } |
| |
| |
| /* |
| * |
| * |
| * 3 2 1 |
| * 10987654321098765432109876543210 |
| * 001000 x1110000101 |
| * rt ----- |
| * rs ----- |
| * rd ----- |
| */ |
| std::string NMD::CFC1(uint64 instruction) |
| { |
| uint64 rt_value = extract_rt_25_24_23_22_21(instruction); |
| uint64 cs_value = extract_cs_20_19_18_17_16(instruction); |
| |
| std::string rt = GPR(copy(rt_value)); |
| std::string cs = CPR(copy(cs_value)); |
| |
| return img::format("CFC1 %s, %s", rt, cs); |
| } |
| |
| |
| /* |
| * |
| * |
| * 3 2 1 |
| * 10987654321098765432109876543210 |
| * 001000 x1110000101 |
| * rt ----- |
| * rs ----- |
| * rd ----- |
| */ |
| std::string NMD::CFC2(uint64 instruction) |
| { |
| uint64 rt_value = extract_rt_25_24_23_22_21(instruction); |
| uint64 cs_value = extract_cs_20_19_18_17_16(instruction); |
| |
| std::string rt = GPR(copy(rt_value)); |
| std::string cs = CPR(copy(cs_value)); |
| |
| return img::format("CFC2 %s, %s", rt, cs); |
| } |
| |
| |
| /* |
| * |
| * |
| * 3 2 1 |
| * 10987654321098765432109876543210 |
| * 001000 x1110000101 |
| * rt ----- |
| * rs ----- |
| * rd ----- |
| */ |
| std::string NMD::CLASS_D(uint64 instruction) |
| { |
| uint64 ft_value = extract_ft_25_24_23_22_21(instruction); |
| uint64 fs_value = extract_fs_20_19_18_17_16(instruction); |
| |
| std::string ft = FPR(copy(ft_value)); |
| std::string fs = FPR(copy(fs_value)); |
| |
| return img::format("CLASS.D %s, %s", ft, fs); |
| } |
| |
| |
| /* |
| * |
| * |
| * 3 2 1 |
| * 10987654321098765432109876543210 |
| * 001000 x1110000101 |
| * rt ----- |
| * rs ----- |
| * rd ----- |
| */ |
| std::string NMD::CLASS_S(uint64 instruction) |
| { |
| uint64 ft_value = extract_ft_25_24_23_22_21(instruction); |
| uint64 fs_value = extract_fs_20_19_18_17_16(instruction); |
| |
| std::string ft = FPR(copy(ft_value)); |
| std::string fs = FPR(copy(fs_value)); |
| |
| return img::format("CLASS.S %s, %s", ft, fs); |
| } |
| |
| |
| /* |
| * |
| * |
| * 3 2 1 |
| * 10987654321098765432109876543210 |
| * 001000 x1110000101 |
| * rt ----- |
| * rs ----- |
| * rd ----- |
| */ |
| std::string NMD::CLO(uint64 instruction) |
| { |
| uint64 rt_value = extract_rt_25_24_23_22_21(instruction); |
| uint64 rs_value = extract_rs_20_19_18_17_16(instruction); |
| |
| std::string rt = GPR(copy(rt_value)); |
| std::string rs = GPR(copy(rs_value)); |
| |
| return img::format("CLO %s, %s", rt, rs); |
| } |
| |
| |
| /* |
| * |
| * |
| * 3 2 1 |
| * 10987654321098765432109876543210 |
| * 001000 x1110000101 |
| * rt ----- |
| * rs ----- |
| * rd ----- |
| */ |
| std::string NMD::CLZ(uint64 instruction) |
| { |
| uint64 rt_value = extract_rt_25_24_23_22_21(instruction); |
| uint64 rs_value = extract_rs_20_19_18_17_16(instruction); |
| |
| std::string rt = GPR(copy(rt_value)); |
| std::string rs = GPR(copy(rs_value)); |
| |
| return img::format("CLZ %s, %s", rt, rs); |
| } |
| |
| |
| /* |
| * |
| * |
| * 3 2 1 |
| * 10987654321098765432109876543210 |
| * 001000 x1110000101 |
| * rt ----- |
| * rs ----- |
| * rd ----- |
| */ |
| std::string NMD::CMP_AF_D(uint64 instruction) |
| { |
| uint64 ft_value = extract_ft_25_24_23_22_21(instruction); |
| uint64 fs_value = extract_fs_20_19_18_17_16(instruction); |
| uint64 fd_value = extract_fd_15_14_13_12_11(instruction); |
| |
| std::string fd = FPR(copy(fd_value)); |
| std::string fs = FPR(copy(fs_value)); |
| std::string ft = FPR(copy(ft_value)); |
| |
| return img::format("CMP.AF.D %s, %s, %s", fd, fs, ft); |
| } |
| |
| |
| /* |
| * |
| * |
| * 3 2 1 |
| * 10987654321098765432109876543210 |
| * 001000 x1110000101 |
| * rt ----- |
| * rs ----- |
| * rd ----- |
| */ |
| std::string NMD::CMP_AF_S(uint64 instruction) |
| { |
| uint64 ft_value = extract_ft_25_24_23_22_21(instruction); |
| uint64 fs_value = extract_fs_20_19_18_17_16(instruction); |
| uint64 fd_value = extract_fd_15_14_13_12_11(instruction); |
| |
| std::string fd = FPR(copy(fd_value)); |
| std::string fs = FPR(copy(fs_value)); |
| std::string ft = FPR(copy(ft_value)); |
| |
| return img::format("CMP.AF.S %s, %s, %s", fd, fs, ft); |
| } |
| |
| |
| /* |
| * |
| * |
| * 3 2 1 |
| * 10987654321098765432109876543210 |
| * 001000 x1110000101 |
| * rt ----- |
| * rs ----- |
| * rd ----- |
| */ |
| std::string NMD::CMP_EQ_D(uint64 instruction) |
| { |
| uint64 ft_value = extract_ft_25_24_23_22_21(instruction); |
| uint64 fs_value = extract_fs_20_19_18_17_16(instruction); |
| uint64 fd_value = extract_fd_15_14_13_12_11(instruction); |
| |
| std::string fd = FPR(copy(fd_value)); |
| std::string fs = FPR(copy(fs_value)); |
| std::string ft = FPR(copy(ft_value)); |
| |
| return img::format("CMP.EQ.D %s, %s, %s", fd, fs, ft); |
| } |
| |
| |
| /* |
| * [DSP] CMP.EQ.PH rs, rt - Compare vectors of signed integer halfword values |
| * |
| * 3 2 1 |
| * 10987654321098765432109876543210 |
| * 001000 xxxxxx0000000101 |
| * rt ----- |
| * rs ----- |
| */ |
| std::string NMD::CMP_EQ_PH(uint64 instruction) |
| { |
| uint64 rt_value = extract_rt_25_24_23_22_21(instruction); |
| uint64 rs_value = extract_rs_20_19_18_17_16(instruction); |
| |
| std::string rs = GPR(copy(rs_value)); |
| std::string rt = GPR(copy(rt_value)); |
| |
| return img::format("CMP.EQ.PH %s, %s", rs, rt); |
| } |
| |
| |
| /* |
| * |
| * |
| * 3 2 1 |
| * 10987654321098765432109876543210 |
| * 001000 x1110000101 |
| * rt ----- |
| * rs ----- |
| * rd ----- |
| */ |
| std::string NMD::CMP_EQ_S(uint64 instruction) |
| { |
| uint64 ft_value = extract_ft_25_24_23_22_21(instruction); |
| uint64 fs_value = extract_fs_20_19_18_17_16(instruction); |
| uint64 fd_value = extract_fd_15_14_13_12_11(instruction); |
| |
| std::string fd = FPR(copy(fd_value)); |
| std::string fs = FPR(copy(fs_value)); |
| std::string ft = FPR(copy(ft_value)); |
| |
| return img::format("CMP.EQ.S %s, %s, %s", fd, fs, ft); |
| } |
| |
| |
| /* |
| * |
| * |
| * 3 2 1 |
| * 10987654321098765432109876543210 |
| * 001000 x1110000101 |
| * rt ----- |
| * rs ----- |
| * rd ----- |
| */ |
| std::string NMD::CMP_LE_D(uint64 instruction) |
| { |
| uint64 ft_value = extract_ft_25_24_23_22_21(instruction); |
| uint64 fs_value = extract_fs_20_19_18_17_16(instruction); |
| uint64 fd_value = extract_fd_15_14_13_12_11(instruction); |
| |
| std::string fd = FPR(copy(fd_value)); |
| std::string fs = FPR(copy(fs_value)); |
| std::string ft = FPR(copy(ft_value)); |
| |
| return img::format("CMP.LE.D %s, %s, %s", fd, fs, ft); |
| } |
| |
| |
| /* |
| * [DSP] CMP.LE.PH rs, rt - Compare vectors of signed integer halfword values |
| * |
| * 3 2 1 |
| * 10987654321098765432109876543210 |
| * 001000 xxxxxx0010000101 |
| * rt ----- |
| * rs ----- |
| */ |
| std::string NMD::CMP_LE_PH(uint64 instruction) |
| { |
| uint64 rt_value = extract_rt_25_24_23_22_21(instruction); |
| uint64 rs_value = extract_rs_20_19_18_17_16(instruction); |
| |
| std::string rs = GPR(copy(rs_value)); |
| std::string rt = GPR(copy(rt_value)); |
| |
| return img::format("CMP.LE.PH %s, %s", rs, rt); |
| } |
| |
| |
| /* |
| * |
| * |
| * 3 2 1 |
| * 10987654321098765432109876543210 |
| * 001000 x1110000101 |
| * rt ----- |
| * rs ----- |
| * rd ----- |
| */ |
| std::string NMD::CMP_LE_S(uint64 instruction) |
| { |
| uint64 ft_value = extract_ft_25_24_23_22_21(instruction); |
| uint64 fs_value = extract_fs_20_19_18_17_16(instruction); |
| uint64 fd_value = extract_fd_15_14_13_12_11(instruction); |
| |
| std::string fd = FPR(copy(fd_value)); |
| std::string fs = FPR(copy(fs_value)); |
| std::string ft = FPR(copy(ft_value)); |
| |
| return img::format("CMP.LE.S %s, %s, %s", fd, fs, ft); |
| } |
| |
| |
| /* |
| * |
| * |
| * 3 2 1 |
| * 10987654321098765432109876543210 |
| * 001000 x1110000101 |
| * rt ----- |
| * rs ----- |
| * rd ----- |
| */ |
| std::string NMD::CMP_LT_D(uint64 instruction) |
| { |
| uint64 ft_value = extract_ft_25_24_23_22_21(instruction); |
| uint64 fs_value = extract_fs_20_19_18_17_16(instruction); |
| uint64 fd_value = extract_fd_15_14_13_12_11(instruction); |
| |
| std::string fd = FPR(copy(fd_value)); |
| std::string fs = FPR(copy(fs_value)); |
| std::string ft = FPR(copy(ft_value)); |
| |
| return img::format("CMP.LT.D %s, %s, %s", fd, fs, ft); |
| } |
| |
| |
| /* |
| * [DSP] CMP.LT.PH rs, rt - Compare vectors of signed integer halfword values |
| * |
| * 3 2 1 |
| * 10987654321098765432109876543210 |
| * 001000 xxxxxx0001000101 |
| * rt ----- |
| * rs ----- |
| */ |
| std::string NMD::CMP_LT_PH(uint64 instruction) |
| { |
| uint64 rt_value = extract_rt_25_24_23_22_21(instruction); |
| uint64 rs_value = extract_rs_20_19_18_17_16(instruction); |
| |
| std::string rs = GPR(copy(rs_value)); |
| std::string rt = GPR(copy(rt_value)); |
| |
| return img::format("CMP.LT.PH %s, %s", rs, rt); |
| } |
| |
| |
| /* |
| * |
| * |
| * 3 2 1 |
| * 10987654321098765432109876543210 |
| * 001000 x1110000101 |
| * rt ----- |
| * rs ----- |
| * rd ----- |
| */ |
| std::string NMD::CMP_LT_S(uint64 instruction) |
| { |
| uint64 ft_value = extract_ft_25_24_23_22_21(instruction); |
| uint64 fs_value = extract_fs_20_19_18_17_16(instruction); |
| uint64 fd_value = extract_fd_15_14_13_12_11(instruction); |
| |
| std::string fd = FPR(copy(fd_value)); |
| std::string fs = FPR(copy(fs_value)); |
| std::string ft = FPR(copy(ft_value)); |
| |
| return img::format("CMP.LT.S %s, %s, %s", fd, fs, ft); |
| } |
| |
| |
| /* |
| * |
| * |
| * 3 2 1 |
| * 10987654321098765432109876543210 |
| * 001000 x1110000101 |
| * rt ----- |
| * rs ----- |
| * rd ----- |
| */ |
| std::string NMD::CMP_NE_D(uint64 instruction) |
| { |
| uint64 ft_value = extract_ft_25_24_23_22_21(instruction); |
| uint64 fs_value = extract_fs_20_19_18_17_16(instruction); |
| uint64 fd_value = extract_fd_15_14_13_12_11(instruction); |
| |
| std::string fd = FPR(copy(fd_value)); |
| std::string fs = FPR(copy(fs_value)); |
| std::string ft = FPR(copy(ft_value)); |
| |
| return img::format("CMP.NE.D %s, %s, %s", fd, fs, ft); |
| } |
| |
| |
| /* |
| * |
| * |
| * 3 2 1 |
| * 10987654321098765432109876543210 |
| * 001000 x1110000101 |
| * rt ----- |
| * rs ----- |
| * rd ----- |
| */ |
| std::string NMD::CMP_NE_S(uint64 instruction) |
| { |
| uint64 ft_value = extract_ft_25_24_23_22_21(instruction); |
| uint64 fs_value = extract_fs_20_19_18_17_16(instruction); |
| uint64 fd_value = extract_fd_15_14_13_12_11(instruction); |
| |
| std::string fd = FPR(copy(fd_value)); |
| std::string fs = FPR(copy(fs_value)); |
| std::string ft = FPR(copy(ft_value)); |
| |
| return img::format("CMP.NE.S %s, %s, %s", fd, fs, ft); |
| } |
| |
| |
| /* |
| * |
| * |
| * 3 2 1 |
| * 10987654321098765432109876543210 |
| * 001000 x1110000101 |
| * rt ----- |
| * rs ----- |
| * rd ----- |
| */ |
| std::string NMD::CMP_OR_D(uint64 instruction) |
| { |
| uint64 ft_value = extract_ft_25_24_23_22_21(instruction); |
| uint64 fs_value = extract_fs_20_19_18_17_16(instruction); |
| uint64 fd_value = extract_fd_15_14_13_12_11(instruction); |
| |
| std::string fd = FPR(copy(fd_value)); |
| std::string fs = FPR(copy(fs_value)); |
| std::string ft = FPR(copy(ft_value)); |
| |
| return img::format("CMP.OR.D %s, %s, %s", fd, fs, ft); |
| } |
| |
| |
| /* |
| * |
| * |
| * 3 2 1 |
| * 10987654321098765432109876543210 |
| * 001000 x1110000101 |
| * rt ----- |
| * rs ----- |
| * rd ----- |
| */ |
| std::string NMD::CMP_OR_S(uint64 instruction) |
| { |
| uint64 ft_value = extract_ft_25_24_23_22_21(instruction); |
| uint64 fs_value = extract_fs_20_19_18_17_16(instruction); |
| uint64 fd_value = extract_fd_15_14_13_12_11(instruction); |
| |
| std::string fd = FPR(copy(fd_value)); |
| std::string fs = FPR(copy(fs_value)); |
| std::string ft = FPR(copy(ft_value)); |
| |
| return img::format("CMP.OR.S %s, %s, %s", fd, fs, ft); |
| } |
| |
| |
| /* |
| * |
| * |
| * 3 2 1 |
| * 10987654321098765432109876543210 |
| * 001000 x1110000101 |
| * rt ----- |
| * rs ----- |
| * rd ----- |
| */ |
| std::string NMD::CMP_SAF_D(uint64 instruction) |
| { |
| uint64 ft_value = extract_ft_25_24_23_22_21(instruction); |
| uint64 fs_value = extract_fs_20_19_18_17_16(instruction); |
| uint64 fd_value = extract_fd_15_14_13_12_11(instruction); |
| |
| std::string fd = FPR(copy(fd_value)); |
| std::string fs = FPR(copy(fs_value)); |
| std::string ft = FPR(copy(ft_value)); |
| |
| return img::format("CMP.SAF.D %s, %s, %s", fd, fs, ft); |
| } |
| |
| |
| /* |
| * |
| * |
| * 3 2 1 |
| * 10987654321098765432109876543210 |
| * 001000 x1110000101 |
| * rt ----- |
| * rs ----- |
| * rd ----- |
| */ |
| std::string NMD::CMP_SAF_S(uint64 instruction) |
| { |
| uint64 ft_value = extract_ft_25_24_23_22_21(instruction); |
| uint64 fs_value = extract_fs_20_19_18_17_16(instruction); |
| uint64 fd_value = extract_fd_15_14_13_12_11(instruction); |
| |
| std::string fd = FPR(copy(fd_value)); |
| std::string fs = FPR(copy(fs_value)); |
| std::string ft = FPR(copy(ft_value)); |
| |
| return img::format("CMP.SAF.S %s, %s, %s", fd, fs, ft); |
| } |
| |
| |
| /* |
| * |
| * |
| * 3 2 1 |
| * 10987654321098765432109876543210 |
| * 001000 x1110000101 |
| * rt ----- |
| * rs ----- |
| * rd ----- |
| */ |
| std::string NMD::CMP_SEQ_D(uint64 instruction) |
| { |
| uint64 ft_value = extract_ft_25_24_23_22_21(instruction); |
| uint64 fs_value = extract_fs_20_19_18_17_16(instruction); |
| uint64 fd_value = extract_fd_15_14_13_12_11(instruction); |
| |
| std::string fd = FPR(copy(fd_value)); |
| std::string fs = FPR(copy(fs_value)); |
| std::string ft = FPR(copy(ft_value)); |
| |
| return img::format("CMP.SEQ.D %s, %s, %s", fd, fs, ft); |
| } |
| |
| |
| /* |
| * |
| * |
| * 3 2 1 |
| * 10987654321098765432109876543210 |
| * 001000 x1110000101 |
| * rt ----- |
| * rs ----- |
| * rd ----- |
| */ |
| std::string NMD::CMP_SEQ_S(uint64 instruction) |
| { |
| uint64 ft_value = extract_ft_25_24_23_22_21(instruction); |
| uint64 fs_value = extract_fs_20_19_18_17_16(instruction); |
| uint64 fd_value = extract_fd_15_14_13_12_11(instruction); |
| |
| std::string fd = FPR(copy(fd_value)); |
| std::string fs = FPR(copy(fs_value)); |
| std::string ft = FPR(copy(ft_value)); |
| |
| return img::format("CMP.SEQ.S %s, %s, %s", fd, fs, ft); |
| } |
| |
| |
| /* |
| * |
| * |
| * 3 2 1 |
| * 10987654321098765432109876543210 |
| * 001000 x1110000101 |
| * rt ----- |
| * rs ----- |
| * rd ----- |
| */ |
| std::string NMD::CMP_SLE_D(uint64 instruction) |
| { |
| uint64 ft_value = extract_ft_25_24_23_22_21(instruction); |
| uint64 fs_value = extract_fs_20_19_18_17_16(instruction); |
| uint64 fd_value = extract_fd_15_14_13_12_11(instruction); |
| |
| std::string fd = FPR(copy(fd_value)); |
| std::string fs = FPR(copy(fs_value)); |
| std::string ft = FPR(copy(ft_value)); |
| |
| return img::format("CMP.SLE.D %s, %s, %s", fd, fs, ft); |
| } |
| |
| |
| /* |
| * |
| * |
| * 3 2 1 |
| * 10987654321098765432109876543210 |
| * 001000 x1110000101 |
| * rt ----- |
| * rs ----- |
| * rd ----- |
| */ |
| std::string NMD::CMP_SLE_S(uint64 instruction) |
| { |
| uint64 ft_value = extract_ft_25_24_23_22_21(instruction); |
| uint64 fs_value = extract_fs_20_19_18_17_16(instruction); |
| uint64 fd_value = extract_fd_15_14_13_12_11(instruction); |
| |
| std::string fd = FPR(copy(fd_value)); |
| std::string fs = FPR(copy(fs_value)); |
| std::string ft = FPR(copy(ft_value)); |
| |
| return img::format("CMP.SLE.S %s, %s, %s", fd, fs, ft); |
| } |
| |
| |
| /* |
| * |
| * |
| * 3 2 1 |
| * 10987654321098765432109876543210 |
| * 001000 x1110000101 |
| * rt ----- |
| * rs ----- |
| * rd ----- |
| */ |
| std::string NMD::CMP_SLT_D(uint64 instruction) |
| { |
| uint64 ft_value = extract_ft_25_24_23_22_21(instruction); |
| uint64 fs_value = extract_fs_20_19_18_17_16(instruction); |
| uint64 fd_value = extract_fd_15_14_13_12_11(instruction); |
| |
| std::string fd = FPR(copy(fd_value)); |
| std::string fs = FPR(copy(fs_value)); |
| std::string ft = FPR(copy(ft_value)); |
| |
| return img::format("CMP.SLT.D %s, %s, %s", fd, fs, ft); |
| } |
| |
| |
| /* |
| * |
| * |
| * 3 2 1 |
| * 10987654321098765432109876543210 |
| * 001000 x1110000101 |
| * rt ----- |
| * rs ----- |
| * rd ----- |
| */ |
| std::string NMD::CMP_SLT_S(uint64 instruction) |
| { |
| uint64 ft_value = extract_ft_25_24_23_22_21(instruction); |
| uint64 fs_value = extract_fs_20_19_18_17_16(instruction); |
| uint64 fd_value = extract_fd_15_14_13_12_11(instruction); |
| |
| std::string fd = FPR(copy(fd_value)); |
| std::string fs = FPR(copy(fs_value)); |
| std::string ft = FPR(copy(ft_value)); |
| |
| return img::format("CMP.SLT.S %s, %s, %s", fd, fs, ft); |
| } |
| |
| |
| /* |
| * |
| * |
| * 3 2 1 |
| * 10987654321098765432109876543210 |
| * 001000 x1110000101 |
| * rt ----- |
| * rs ----- |
| * rd ----- |
| */ |
| std::string NMD::CMP_SNE_D(uint64 instruction) |
| { |
| uint64 ft_value = extract_ft_25_24_23_22_21(instruction); |
| uint64 fs_value = extract_fs_20_19_18_17_16(instruction); |
| uint64 fd_value = extract_fd_15_14_13_12_11(instruction); |
| |
| std::string fd = FPR(copy(fd_value)); |
| std::string fs = FPR(copy(fs_value)); |
| std::string ft = FPR(copy(ft_value)); |
| |
| return img::format("CMP.SNE.D %s, %s, %s", fd, fs, ft); |
| } |
| |
| |
| /* |
| * |
| * |
| * 3 2 1 |
| * 10987654321098765432109876543210 |
| * 001000 x1110000101 |
| * rt ----- |
| * rs ----- |
| * rd ----- |
| */ |
| std::string NMD::CMP_SNE_S(uint64 instruction) |
| { |
| uint64 ft_value = extract_ft_25_24_23_22_21(instruction); |
| uint64 fs_value = extract_fs_20_19_18_17_16(instruction); |
| uint64 fd_value = extract_fd_15_14_13_12_11(instruction); |
| |
| std::string fd = FPR(copy(fd_value)); |
| std::string fs = FPR(copy(fs_value)); |
| std::string ft = FPR(copy(ft_value)); |
| |
| return img::format("CMP.SNE.S %s, %s, %s", fd, fs, ft); |
| } |
| |
| |
| /* |
| * |
| * |
| * 3 2 1 |
| * 10987654321098765432109876543210 |
| * 001000 x1110000101 |
| * rt ----- |
| * rs ----- |
| * rd ----- |
| */ |
| std::string NMD::CMP_SOR_D(uint64 instruction) |
| { |
| uint64 ft_value = extract_ft_25_24_23_22_21(instruction); |
| uint64 fs_value = extract_fs_20_19_18_17_16(instruction); |
| uint64 fd_value = extract_fd_15_14_13_12_11(instruction); |
| |
| std::string fd = FPR(copy(fd_value)); |
| std::string fs = FPR(copy(fs_value)); |
| std::string ft = FPR(copy(ft_value)); |
| |
| return img::format("CMP.SOR.D %s, %s, %s", fd, fs, ft); |
| } |
| |
| |
| /* |
| * |
| * |
| * 3 2 1 |
| * 10987654321098765432109876543210 |
| * 001000 x1110000101 |
| * rt ----- |
| * rs ----- |
| * rd ----- |
| */ |
| std::string NMD::CMP_SOR_S(uint64 instruction) |
| { |
| uint64 ft_value = extract_ft_25_24_23_22_21(instruction); |
| uint64 fs_value = extract_fs_20_19_18_17_16(instruction); |
| uint64 fd_value = extract_fd_15_14_13_12_11(instruction); |
| |
| std::string fd = FPR(copy(fd_value)); |
| std::string fs = FPR(copy(fs_value)); |
| std::string ft = FPR(copy(ft_value)); |
| |
| return img::format("CMP.SOR.S %s, %s, %s", fd, fs, ft); |
| } |
| |
| |
| /* |
| * |
| * |
| * 3 2 1 |
| * 10987654321098765432109876543210 |
| * 001000 x1110000101 |
| * rt ----- |
| * rs ----- |
| * rd ----- |
| */ |
| std::string NMD::CMP_SUEQ_D(uint64 instruction) |
| { |
| uint64 ft_value = extract_ft_25_24_23_22_21(instruction); |
| uint64 fs_value = extract_fs_20_19_18_17_16(instruction); |
| uint64 fd_value = extract_fd_15_14_13_12_11(instruction); |
| |
| std::string fd = FPR(copy(fd_value)); |
| std::string fs = FPR(copy(fs_value)); |
| std::string ft = FPR(copy(ft_value)); |
| |
| return img::format("CMP.SUEQ.D %s, %s, %s", fd, fs, ft); |
| } |
| |
| |
| /* |
| * |
| * |
| * 3 2 1 |
| * 10987654321098765432109876543210 |
| * 001000 x1110000101 |
| * rt ----- |
| * rs ----- |
| * rd ----- |
| */ |
| std::string NMD::CMP_SUEQ_S(uint64 instruction) |
| { |
| uint64 ft_value = extract_ft_25_24_23_22_21(instruction); |
| uint64 fs_value = extract_fs_20_19_18_17_16(instruction); |
| uint64 fd_value = extract_fd_15_14_13_12_11(instruction); |
| |
| std::string fd = FPR(copy(fd_value)); |
| std::string fs = FPR(copy(fs_value)); |
| std::string ft = FPR(copy(ft_value)); |
| |
| return img::format("CMP.SUEQ.S %s, %s, %s", fd, fs, ft); |
| } |
| |
| |
| /* |
| * |
| * |
| * 3 2 1 |
| * 10987654321098765432109876543210 |
| * 001000 x1110000101 |
| * rt ----- |
| * rs ----- |
| * rd ----- |
| */ |
| std::string NMD::CMP_SULE_D(uint64 instruction) |
| { |
| uint64 ft_value = extract_ft_25_24_23_22_21(instruction); |
| uint64 fs_value = extract_fs_20_19_18_17_16(instruction); |
| uint64 fd_value = extract_fd_15_14_13_12_11(instruction); |
| |
| std::string fd = FPR(copy(fd_value)); |
| std::string fs = FPR(copy(fs_value)); |
| std::string ft = FPR(copy(ft_value)); |
| |
| return img::format("CMP.SULE.D %s, %s, %s", fd, fs, ft); |
| } |
| |
| |
| /* |
| * |
| * |
| * 3 2 1 |
| * 10987654321098765432109876543210 |
| * 001000 x1110000101 |
| * rt ----- |
| * rs ----- |
| * rd ----- |
| */ |
| std::string NMD::CMP_SULE_S(uint64 instruction) |
| { |
| uint64 ft_value = extract_ft_25_24_23_22_21(instruction); |
| uint64 fs_value = extract_fs_20_19_18_17_16(instruction); |
| uint64 fd_value = extract_fd_15_14_13_12_11(instruction); |
| |
| std::string fd = FPR(copy(fd_value)); |
| std::string fs = FPR(copy(fs_value)); |
| std::string ft = FPR(copy(ft_value)); |
| |
| return img::format("CMP.SULE.S %s, %s, %s", fd, fs, ft); |
| } |
| |
| |
| /* |
| * |
| * |
| * 3 2 1 |
| * 10987654321098765432109876543210 |
| * 001000 x1110000101 |
| * rt ----- |
| * rs ----- |
| * rd ----- |
| */ |
| std::string NMD::CMP_SULT_D(uint64 instruction) |
| { |
| uint64 ft_value = extract_ft_25_24_23_22_21(instruction); |
| uint64 fs_value = extract_fs_20_19_18_17_16(instruction); |
| uint64 fd_value = extract_fd_15_14_13_12_11(instruction); |
| |
| std::string fd = FPR(copy(fd_value)); |
| std::string fs = FPR(copy(fs_value)); |
| std::string ft = FPR(copy(ft_value)); |
| |
| return img::format("CMP.SULT.D %s, %s, %s", fd, fs, ft); |
| } |
| |
| |
| /* |
| * |
| * |
| * 3 2 1 |
| * 10987654321098765432109876543210 |
| * 001000 x1110000101 |
| * rt ----- |
| * rs ----- |
| * rd ----- |
| */ |
| std::string NMD::CMP_SULT_S(uint64 instruction) |
| { |
| uint64 ft_value = extract_ft_25_24_23_22_21(instruction); |
| uint64 fs_value = extract_fs_20_19_18_17_16(instruction); |
| uint64 fd_value = extract_fd_15_14_13_12_11(instruction); |
| |
| std::string fd = FPR(copy(fd_value)); |
| std::string fs = FPR(copy(fs_value)); |
| std::string ft = FPR(copy(ft_value)); |
| |
| return img::format("CMP.SULT.S %s, %s, %s", fd, fs, ft); |
| } |
| |
| |
| /* |
| * |
| * |
| * 3 2 1 |
| * 10987654321098765432109876543210 |
| * 001000 x1110000101 |
| * rt ----- |
| * rs ----- |
| * rd ----- |
| */ |
| std::string NMD::CMP_SUN_D(uint64 instruction) |
| { |
| uint64 ft_value = extract_ft_25_24_23_22_21(instruction); |
| uint64 fs_value = extract_fs_20_19_18_17_16(instruction); |
| uint64 fd_value = extract_fd_15_14_13_12_11(instruction); |
| |
| std::string fd = FPR(copy(fd_value)); |
| std::string fs = FPR(copy(fs_value)); |
| std::string ft = FPR(copy(ft_value)); |
| |
| return img::format("CMP.SUN.D %s, %s, %s", fd, fs, ft); |
| } |
| |
| |
| /* |
| * |
| * |
| * 3 2 1 |
| * 10987654321098765432109876543210 |
| * 001000 x1110000101 |
| * rt ----- |
| * rs ----- |
| * rd ----- |
| */ |
| std::string NMD::CMP_SUNE_D(uint64 instruction) |
| { |
| uint64 ft_value = extract_ft_25_24_23_22_21(instruction); |
| uint64 fs_value = extract_fs_20_19_18_17_16(instruction); |
| uint64 fd_value = extract_fd_15_14_13_12_11(instruction); |
| |
| std::string fd = FPR(copy(fd_value)); |
| std::string fs = FPR(copy(fs_value)); |
| std::string ft = FPR(copy(ft_value)); |
| |
| return img::format("CMP.SUNE.D %s, %s, %s", fd, fs, ft); |
| } |
| |
| |
| /* |
| * |
| * |
| * 3 2 1 |
| * 10987654321098765432109876543210 |
| * 001000 x1110000101 |
| * rt ----- |
| * rs ----- |
| * rd ----- |
| */ |
| std::string NMD::CMP_SUNE_S(uint64 instruction) |
| { |
| uint64 ft_value = extract_ft_25_24_23_22_21(instruction); |
| uint64 fs_value = extract_fs_20_19_18_17_16(instruction); |
| uint64 fd_value = extract_fd_15_14_13_12_11(instruction); |
| |
| std::string fd = FPR(copy(fd_value)); |
| std::string fs = FPR(copy(fs_value)); |
| std::string ft = FPR(copy(ft_value)); |
| |
| return img::format("CMP.SUNE.S %s, %s, %s", fd, fs, ft); |
| } |
| |
| |
| /* |
| * |
| * |
| * 3 2 1 |
| * 10987654321098765432109876543210 |
| * 001000 x1110000101 |
| * rt ----- |
| * rs ----- |
| * rd ----- |
| */ |
| std::string NMD::CMP_SUN_S(uint64 instruction) |
| { |
| uint64 ft_value = extract_ft_25_24_23_22_21(instruction); |
| uint64 fs_value = extract_fs_20_19_18_17_16(instruction); |
| uint64 fd_value = extract_fd_15_14_13_12_11(instruction); |
| |
| std::string fd = FPR(copy(fd_value)); |
| std::string fs = FPR(copy(fs_value)); |
| std::string ft = FPR(copy(ft_value)); |
| |
| return img::format("CMP.SUN.S %s, %s, %s", fd, fs, ft); |
| } |
| |
| |
| /* |
| * |
| * |
| * 3 2 1 |
| * 10987654321098765432109876543210 |
| * 001000 x1110000101 |
| * rt ----- |
| * rs ----- |
| * rd ----- |
| */ |
| std::string NMD::CMP_UEQ_D(uint64 instruction) |
| { |
| uint64 ft_value = extract_ft_25_24_23_22_21(instruction); |
| uint64 fs_value = extract_fs_20_19_18_17_16(instruction); |
| uint64 fd_value = extract_fd_15_14_13_12_11(instruction); |
| |
| std::string fd = FPR(copy(fd_value)); |
| std::string fs = FPR(copy(fs_value)); |
| std::string ft = FPR(copy(ft_value)); |
| |
| return img::format("CMP.UEQ.D %s, %s, %s", fd, fs, ft); |
| } |
| |
| |
| /* |
| * |
| * |
| * 3 2 1 |
| * 10987654321098765432109876543210 |
| * 001000 x1110000101 |
| * rt ----- |
| * rs ----- |
| * rd ----- |
| */ |
| std::string NMD::CMP_UEQ_S(uint64 instruction) |
| { |
| uint64 ft_value = extract_ft_25_24_23_22_21(instruction); |
| uint64 fs_value = extract_fs_20_19_18_17_16(instruction); |
| uint64 fd_value = extract_fd_15_14_13_12_11(instruction); |
| |
| std::string fd = FPR(copy(fd_value)); |
| std::string fs = FPR(copy(fs_value)); |
| std::string ft = FPR(copy(ft_value)); |
| |
| return img::format("CMP.UEQ.S %s, %s, %s", fd, fs, ft); |
| } |
| |
| |
| /* |
| * |
| * |
| * 3 2 1 |
| * 10987654321098765432109876543210 |
| * 001000 x1110000101 |
| * rt ----- |
| * rs ----- |
| * rd ----- |
| */ |
| std::string NMD::CMP_ULE_D(uint64 instruction) |
| { |
| uint64 ft_value = extract_ft_25_24_23_22_21(instruction); |
| uint64 fs_value = extract_fs_20_19_18_17_16(instruction); |
| uint64 fd_value = extract_fd_15_14_13_12_11(instruction); |
| |
| std::string fd = FPR(copy(fd_value)); |
| std::string fs = FPR(copy(fs_value)); |
| std::string ft = FPR(copy(ft_value)); |
| |
| return img::format("CMP.ULE.D %s, %s, %s", fd, fs, ft); |
| } |
| |
| |
| /* |
| * |
| * |
| * 3 2 1 |
| * 10987654321098765432109876543210 |
| * 001000 x1110000101 |
| * rt ----- |
| * rs ----- |
| * rd ----- |
| */ |
| std::string NMD::CMP_ULE_S(uint64 instruction) |
| { |
| uint64 ft_value = extract_ft_25_24_23_22_21(instruction); |
| uint64 fs_value = extract_fs_20_19_18_17_16(instruction); |
| uint64 fd_value = extract_fd_15_14_13_12_11(instruction); |
| |
| std::string fd = FPR(copy(fd_value)); |
| std::string fs = FPR(copy(fs_value)); |
| std::string ft = FPR(copy(ft_value)); |
| |
| return img::format("CMP.ULE.S %s, %s, %s", fd, fs, ft); |
| } |
| |
| |
| /* |
| * |
| * |
| * 3 2 1 |
| * 10987654321098765432109876543210 |
| * 001000 x1110000101 |
| * rt ----- |
| * rs ----- |
| * rd ----- |
| */ |
| std::string NMD::CMP_ULT_D(uint64 instruction) |
| { |
| uint64 ft_value = extract_ft_25_24_23_22_21(instruction); |
| uint64 fs_value = extract_fs_20_19_18_17_16(instruction); |
| uint64 fd_value = extract_fd_15_14_13_12_11(instruction); |
| |
| std::string fd = FPR(copy(fd_value)); |
| std::string fs = FPR(copy(fs_value)); |
| std::string ft = FPR(copy(ft_value)); |
| |
| return img::format("CMP.ULT.D %s, %s, %s", fd, fs, ft); |
| } |
| |
| |
| /* |
| * |
| * |
| * 3 2 1 |
| * 10987654321098765432109876543210 |
| * 001000 x1110000101 |
| * rt ----- |
| * rs ----- |
| * rd ----- |
| */ |
| std::string NMD::CMP_ULT_S(uint64 instruction) |
| { |
| uint64 ft_value = extract_ft_25_24_23_22_21(instruction); |
| uint64 fs_value = extract_fs_20_19_18_17_16(instruction); |
| uint64 fd_value = extract_fd_15_14_13_12_11(instruction); |
| |
| std::string fd = FPR(copy(fd_value)); |
| std::string fs = FPR(copy(fs_value)); |
| std::string ft = FPR(copy(ft_value)); |
| |
| return img::format("CMP.ULT.S %s, %s, %s", fd, fs, ft); |
| } |
| |
| |
| /* |
| * |
| * |
| * 3 2 1 |
| * 10987654321098765432109876543210 |
| * 001000 x1110000101 |
| * rt ----- |
| * rs ----- |
| * rd ----- |
| */ |
| std::string NMD::CMP_UN_D(uint64 instruction) |
| { |
| uint64 ft_value = extract_ft_25_24_23_22_21(instruction); |
| uint64 fs_value = extract_fs_20_19_18_17_16(instruction); |
| uint64 fd_value = extract_fd_15_14_13_12_11(instruction); |
| |
| std::string fd = FPR(copy(fd_value)); |
| std::string fs = FPR(copy(fs_value)); |
| std::string ft = FPR(copy(ft_value)); |
| |
| return img::format("CMP.UN.D %s, %s, %s", fd, fs, ft); |
| } |
| |
| |
| /* |
| * |
| * |
| * 3 2 1 |
| * 10987654321098765432109876543210 |
| * 001000 x1110000101 |
| * rt ----- |
| * rs ----- |
| * rd ----- |
| */ |
| std::string NMD::CMP_UNE_D(uint64 instruction) |
| { |
| uint64 ft_value = extract_ft_25_24_23_22_21(instruction); |
| uint64 fs_value = extract_fs_20_19_18_17_16(instruction); |
| uint64 fd_value = extract_fd_15_14_13_12_11(instruction); |
| |
| std::string fd = FPR(copy(fd_value)); |
| std::string fs = FPR(copy(fs_value)); |
| std::string ft = FPR(copy(ft_value)); |
| |
| return img::format("CMP.UNE.D %s, %s, %s", fd, fs, ft); |
| } |
| |
| |
| /* |
| * |
| * |
| * 3 2 1 |
| * 10987654321098765432109876543210 |
| * 001000 x1110000101 |
| * rt ----- |
| * rs ----- |
| * rd ----- |
| */ |
| std::string NMD::CMP_UNE_S(uint64 instruction) |
| { |
| uint64 ft_value = extract_ft_25_24_23_22_21(instruction); |
| uint64 fs_value = extract_fs_20_19_18_17_16(instruction); |
| uint64 fd_value = extract_fd_15_14_13_12_11(instruction); |
| |
| std::string fd = FPR(copy(fd_value)); |
| std::string fs = FPR(copy(fs_value)); |
| std::string ft = FPR(copy(ft_value)); |
| |
| return img::format("CMP.UNE.S %s, %s, %s", fd, fs, ft); |
| } |
| |
| |
| /* |
| * |
| * |
| * 3 2 1 |
| * 10987654321098765432109876543210 |
| * 001000 x1110000101 |
| * rt ----- |
| * rs ----- |
| * rd ----- |
| */ |
| std::string NMD::CMP_UN_S(uint64 instruction) |
| { |
| uint64 ft_value = extract_ft_25_24_23_22_21(instruction); |
| uint64 fs_value = extract_fs_20_19_18_17_16(instruction); |
| uint64 fd_value = extract_fd_15_14_13_12_11(instruction); |
| |
| std::string fd = FPR(copy(fd_value)); |
| std::string fs = FPR(copy(fs_value)); |
| std::string ft = FPR(copy(ft_value)); |
| |
| return img::format("CMP.UN.S %s, %s, %s", fd, fs, ft); |
| } |
| |
| |
| /* |
| * [DSP] CMPGDU.EQ.QB rd, rs, rt - Compare unsigned vector of |
| * four bytes and write result to GPR and DSPControl |
| * |
| * 3 2 1 |
| * 10987654321098765432109876543210 |
| * 001000 x0110000101 |
| * rt ----- |
| * rs ----- |
| * rd ----- |
| */ |
| std::string NMD::CMPGDU_EQ_QB(uint64 instruction) |
| { |
| uint64 rt_value = extract_rt_25_24_23_22_21(instruction); |
| uint64 rs_value = extract_rs_20_19_18_17_16(instruction); |
| uint64 rd_value = extract_rd_15_14_13_12_11(instruction); |
| |
| std::string rd = GPR(copy(rd_value)); |
| std::string rs = GPR(copy(rs_value)); |
| std::string rt = GPR(copy(rt_value)); |
| |
| return img::format("CMPGDU.EQ.QB %s, %s, %s", rd, rs, rt); |
| } |
| |
| |
| /* |
| * [DSP] CMPGDU.LE.QB rd, rs, rt - Compare unsigned vector of |
| * four bytes and write result to GPR and DSPControl |
| * |
| * 3 2 1 |
| * 10987654321098765432109876543210 |
| * 001000 x1000000101 |
| * rt ----- |
| * rs ----- |
| * rd ----- |
| */ |
| std::string NMD::CMPGDU_LE_QB(uint64 instruction) |
| { |
| uint64 rt_value = extract_rt_25_24_23_22_21(instruction); |
| uint64 rs_value = extract_rs_20_19_18_17_16(instruction); |
| uint64 rd_value = extract_rd_15_14_13_12_11(instruction); |
| |
| std::string rd = GPR(copy(rd_value)); |
| std::string rs = GPR(copy(rs_value)); |
| std::string rt = GPR(copy(rt_value)); |
| |
| return img::format("CMPGDU.LE.QB %s, %s, %s", rd, rs, rt); |
| } |
| |
| |
| /* |
| * [DSP] CMPGDU.EQ.QB rd, rs, rt - Compare unsigned vector of |
| * four bytes and write result to GPR and DSPControl |
| * |
| * 3 2 1 |
| * 10987654321098765432109876543210 |
| * 001000 x0111000101 |
| * rt ----- |
| * rs ----- |
| * rd ----- |
| */ |
| std::string NMD::CMPGDU_LT_QB(uint64 instruction) |
| { |
| uint64 rt_value = extract_rt_25_24_23_22_21(instruction); |
| uint64 rs_value = extract_rs_20_19_18_17_16(instruction); |
| uint64 rd_value = extract_rd_15_14_13_12_11(instruction); |
| |
| std::string rd = GPR(copy(rd_value)); |
| std::string rs = GPR(copy(rs_value)); |
| std::string rt = GPR(copy(rt_value)); |
| |
| return img::format("CMPGDU.LT.QB %s, %s, %s", rd, rs, rt); |
| } |
| |
| |
| /* |
| * [DSP] CMPGU.EQ.QB rd, rs, rt - Compare vectors of unsigned |
| * byte values and write result to a GPR |
| * |
| * 3 2 1 |
| * 10987654321098765432109876543210 |
| * 001000 x0011000101 |
| * rt ----- |
| * rs ----- |
| * rd ----- |
| */ |
| std::string NMD::CMPGU_EQ_QB(uint64 instruction) |
| { |
| uint64 rt_value = extract_rt_25_24_23_22_21(instruction); |
| uint64 rs_value = extract_rs_20_19_18_17_16(instruction); |
| uint64 rd_value = extract_rd_15_14_13_12_11(instruction); |
| |
| std::string rd = GPR(copy(rd_value)); |
| std::string rs = GPR(copy(rs_value)); |
| std::string rt = GPR(copy(rt_value)); |
| |
| return img::format("CMPGU.EQ.QB %s, %s, %s", rd, rs, rt); |
| } |
| |
| |
| /* |
| * [DSP] CMPGU.LE.QB rd, rs, rt - Compare vectors of unsigned |
| * byte values and write result to a GPR |
| * |
| * 3 2 1 |
| * 10987654321098765432109876543210 |
| * 001000 x0101000101 |
| * rt ----- |
| * rs ----- |
| * rd ----- |
| */ |
| std::string NMD::CMPGU_LE_QB(uint64 instruction) |
| { |
| uint64 rt_value = extract_rt_25_24_23_22_21(instruction); |
| uint64 rs_value = extract_rs_20_19_18_17_16(instruction); |
| uint64 rd_value = extract_rd_15_14_13_12_11(instruction); |
| |
| std::string rd = GPR(copy(rd_value)); |
| std::string rs = GPR(copy(rs_value)); |
| std::string rt = GPR(copy(rt_value)); |
| |
| return img::format("CMPGU.LE.QB %s, %s, %s", rd, rs, rt); |
| } |
| |
| |
| /* |
| * [DSP] CMPGU.LT.QB rd, rs, rt - Compare vectors of unsigned |
| * byte values and write result to a GPR |
| * |
| * 3 2 1 |
| * 10987654321098765432109876543210 |
| * 001000 x0100000101 |
| * rt ----- |
| * rs ----- |
| * rd ----- |
| */ |
| std::string NMD::CMPGU_LT_QB(uint64 instruction) |
| { |
| uint64 rt_value = extract_rt_25_24_23_22_21(instruction); |
| uint64 rs_value = extract_rs_20_19_18_17_16(instruction); |
| uint64 rd_value = extract_rd_15_14_13_12_11(instruction); |
| |
| std::string rd = GPR(copy(rd_value)); |
| std::string rs = GPR(copy(rs_value)); |
| std::string rt = GPR(copy(rt_value)); |
| |
| return img::format("CMPGU.LT.QB %s, %s, %s", rd, rs, rt); |
| } |
| |
| |
| /* |
| * [DSP] CMPU.EQ.QB rd, rs, rt - Compare vectors of unsigned |
| * byte values |
| * |
| * 3 2 1 |
| * 10987654321098765432109876543210 |
| * 001000 xxxxxx1001000101 |
| * rt ----- |
| * rs ----- |
| */ |
| std::string NMD::CMPU_EQ_QB(uint64 instruction) |
| { |
| uint64 rt_value = extract_rt_25_24_23_22_21(instruction); |
| uint64 rs_value = extract_rs_20_19_18_17_16(instruction); |
| |
| std::string rs = GPR(copy(rs_value)); |
| std::string rt = GPR(copy(rt_value)); |
| |
| return img::format("CMPU.EQ.QB %s, %s", rs, rt); |
| } |
| |
| |
| /* |
| * [DSP] CMPU.LE.QB rd, rs, rt - Compare vectors of unsigned |
| * byte values |
| * |
| * 3 2 1 |
| * 10987654321098765432109876543210 |
| * 001000 xxxxxx1011000101 |
| * rt ----- |
| * rs ----- |
| */ |
| std::string NMD::CMPU_LE_QB(uint64 instruction) |
| { |
| uint64 rt_value = extract_rt_25_24_23_22_21(instruction); |
| uint64 rs_value = extract_rs_20_19_18_17_16(instruction); |
| |
| std::string rs = GPR(copy(rs_value)); |
| std::string rt = GPR(copy(rt_value)); |
| |
| return img::format("CMPU.LE.QB %s, %s", rs, rt); |
| } |
| |
| |
| /* |
| * [DSP] CMPU.LT.QB rd, rs, rt - Compare vectors of unsigned |
| * byte values |
| * |
| * 3 2 1 |
| * 10987654321098765432109876543210 |
| * 001000 xxxxxx1010000101 |
| * rt ----- |
| * rs ----- |
| */ |
| std::string NMD::CMPU_LT_QB(uint64 instruction) |
| { |
| uint64 rt_value = extract_rt_25_24_23_22_21(instruction); |
| uint64 rs_value = extract_rs_20_19_18_17_16(instruction); |
| |
| std::string rs = GPR(copy(rs_value)); |
| std::string rt = GPR(copy(rt_value)); |
| |
| return img::format("CMPU.LT.QB %s, %s", rs, rt); |
| } |
| |
| |
| /* |
| * |
| * |
| * 3 2 1 |
| * 10987654321098765432109876543210 |
| * 001000 x1110000101 |
| * rt ----- |
| * rs ----- |
| * rd ----- |
| */ |
| std::string NMD::COP2_1(uint64 instruction) |
| { |
| uint64 cofun_value = extract_cofun_25_24_23(instruction); |
| |
| std::string cofun = IMMEDIATE(copy(cofun_value)); |
| |
| return img::format("COP2_1 %s", cofun); |
| } |
| |
| |
| /* |
| * |
| * |
| * 3 2 1 |
| * 10987654321098765432109876543210 |
| * 001000 x1110000101 |
| * rt ----- |
| * rs ----- |
| * rd ----- |
| */ |
| std::string NMD::CTC1(uint64 instruction) |
| { |
| uint64 rt_value = extract_rt_25_24_23_22_21(instruction); |
| uint64 cs_value = extract_cs_20_19_18_17_16(instruction); |
| |
| std::string rt = GPR(copy(rt_value)); |
| std::string cs = CPR(copy(cs_value)); |
| |
| return img::format("CTC1 %s, %s", rt, cs); |
| } |
| |
| |
| /* |
| * |
| * |
| * 3 2 1 |
| * 10987654321098765432109876543210 |
| * 001000 x1110000101 |
| * rt ----- |
| * rs ----- |
| * rd ----- |
| */ |
| std::string NMD::CTC2(uint64 instruction) |
| { |
| uint64 rt_value = extract_rt_25_24_23_22_21(instruction); |
| uint64 cs_value = extract_cs_20_19_18_17_16(instruction); |
| |
| std::string rt = GPR(copy(rt_value)); |
| std::string cs = CPR(copy(cs_value)); |
| |
| return img::format("CTC2 %s, %s", rt, cs); |
| } |
| |
| |
| /* |
| * |
| * |
| * 3 2 1 |
| * 10987654321098765432109876543210 |
| * 001000 x1110000101 |
| * rt ----- |
| * rs ----- |
| * rd ----- |
| */ |
| std::string NMD::CVT_D_L(uint64 instruction) |
| { |
| uint64 ft_value = extract_ft_25_24_23_22_21(instruction); |
| uint64 fs_value = extract_fs_20_19_18_17_16(instruction); |
| |
| std::string ft = FPR(copy(ft_value)); |
| std::string fs = FPR(copy(fs_value)); |
| |
| return img::format("CVT.D.L %s, %s", ft, fs); |
| } |
| |
| |
| /* |
| * |
| * |
| * 3 2 1 |
| * 10987654321098765432109876543210 |
| * 001000 x1110000101 |
| * rt ----- |
| * rs ----- |
| * rd ----- |
| */ |
| std::string NMD::CVT_D_S(uint64 instruction) |
| { |
| uint64 ft_value = extract_ft_25_24_23_22_21(instruction); |
| uint64 fs_value = extract_fs_20_19_18_17_16(instruction); |
| |
| std::string ft = FPR(copy(ft_value)); |
| std::string fs = FPR(copy(fs_value)); |
| |
| return img::format("CVT.D.S %s, %s", ft, fs); |
| } |
| |
| |
| /* |
| * |
| * |
| * 3 2 1 |
| * 10987654321098765432109876543210 |
| * 001000 x1110000101 |
| * rt ----- |
| * rs ----- |
| * rd ----- |
| */ |
| std::string NMD::CVT_D_W(uint64 instruction) |
| { |
| uint64 ft_value = extract_ft_25_24_23_22_21(instruction); |
| uint64 fs_value = extract_fs_20_19_18_17_16(instruction); |
| |
| std::string ft = FPR(copy(ft_value)); |
| std::string fs = FPR(copy(fs_value)); |
| |
| return img::format("CVT.D.W %s, %s", ft, fs); |
| } |
| |
| |
| /* |
| * |
| * |
| * 3 2 1 |
| * 10987654321098765432109876543210 |
| * 001000 x1110000101 |
| * rt ----- |
| * rs ----- |
| * rd ----- |
| */ |
| std::string NMD::CVT_L_D(uint64 instruction) |
| { |
| uint64 ft_value = extract_ft_25_24_23_22_21(instruction); |
| uint64 fs_value = extract_fs_20_19_18_17_16(instruction); |
| |
| std::string ft = FPR(copy(ft_value)); |
| std::string fs = FPR(copy(fs_value)); |
| |
| return img::format("CVT.L.D %s, %s", ft, fs); |
| } |
| |
| |
| /* |
| * |
| * |
| * 3 2 1 |
| * 10987654321098765432109876543210 |
| * 001000 x1110000101 |
| * rt ----- |
| * rs ----- |
| * rd ----- |
| */ |
| std::string NMD::CVT_L_S(uint64 instruction) |
| { |
| uint64 ft_value = extract_ft_25_24_23_22_21(instruction); |
| uint64 fs_value = extract_fs_20_19_18_17_16(instruction); |
| |
| std::string ft = FPR(copy(ft_value)); |
| std::string fs = FPR(copy(fs_value)); |
| |
| return img::format("CVT.L.S %s, %s", ft, fs); |
| } |
| |
| |
| /* |
| * |
| * |
| * 3 2 1 |
| * 10987654321098765432109876543210 |
| * 001000 x1110000101 |
| * rt ----- |
| * rs ----- |
| * rd ----- |
| */ |
| std::string NMD::CVT_S_D(uint64 instruction) |
| { |
| uint64 ft_value = extract_ft_25_24_23_22_21(instruction); |
| uint64 fs_value = extract_fs_20_19_18_17_16(instruction); |
| |
| std::string ft = FPR(copy(ft_value)); |
| std::string fs = FPR(copy(fs_value)); |
| |
| return img::format("CVT.S.D %s, %s", ft, fs); |
| } |
| |
| |
| /* |
| * |
| * |
| * 3 2 1 |
| * 10987654321098765432109876543210 |
| * 001000 x1110000101 |
| * rt ----- |
| * rs ----- |
| * rd ----- |
| */ |
| std::string NMD::CVT_S_L(uint64 instruction) |
| { |
| uint64 ft_value = extract_ft_25_24_23_22_21(instruction); |
| uint64 fs_value = extract_fs_20_19_18_17_16(instruction); |
| |
| std::string ft = FPR(copy(ft_value)); |
| std::string fs = FPR(copy(fs_value)); |
| |
| return img::format("CVT.S.L %s, %s", ft, fs); |
| } |
| |
| |
| /* |
| * |
| * |
| * 3 2 1 |
| * 10987654321098765432109876543210 |
| * 001000 x1110000101 |
| * rt ----- |
| * rs ----- |
| * rd ----- |
| */ |
| std::string NMD::CVT_S_PL(uint64 instruction) |
| { |
| uint64 ft_value = extract_ft_25_24_23_22_21(instruction); |
| uint64 fs_value = extract_fs_20_19_18_17_16(instruction); |
| |
| std::string ft = FPR(copy(ft_value)); |
| std::string fs = FPR(copy(fs_value)); |
| |
| return img::format("CVT.S.PL %s, %s", ft, fs); |
| } |
| |
| |
| /* |
| * |
| * |
| * 3 2 1 |
| * 10987654321098765432109876543210 |
| * 001000 x1110000101 |
| * rt ----- |
| * rs ----- |
| * rd ----- |
| */ |
| std::string NMD::CVT_S_PU(uint64 instruction) |
| { |
| uint64 ft_value = extract_ft_25_24_23_22_21(instruction); |
| uint64 fs_value = extract_fs_20_19_18_17_16(instruction); |
| |
| std::string ft = FPR(copy(ft_value)); |
| std::string fs = FPR(copy(fs_value)); |
| |
| return img::format("CVT.S.PU %s, %s", ft, fs); |
| } |
| |
| |
| /* |
| * |
| * |
| * 3 2 1 |
| * 10987654321098765432109876543210 |
| * 001000 x1110000101 |
| * rt ----- |
| * rs ----- |
| * rd ----- |
| */ |
| std::string NMD::CVT_S_W(uint64 instruction) |
| { |
| uint64 ft_value = extract_ft_25_24_23_22_21(instruction); |
| uint64 fs_value = extract_fs_20_19_18_17_16(instruction); |
| |
| std::string ft = FPR(copy(ft_value)); |
| std::string fs = FPR(copy(fs_value)); |
| |
| return img::format("CVT.S.W %s, %s", ft, fs); |
| } |
| |
| |
| /* |
| * |
| * |
| * 3 2 1 |
| * 10987654321098765432109876543210 |
| * 001000 x1110000101 |
| * rt ----- |
| * rs ----- |
| * rd ----- |
| */ |
| std::string NMD::CVT_W_D(uint64 instruction) |
| { |
| uint64 ft_value = extract_ft_25_24_23_22_21(instruction); |
| uint64 fs_value = extract_fs_20_19_18_17_16(instruction); |
| |
| std::string ft = FPR(copy(ft_value)); |
| std::string fs = FPR(copy(fs_value)); |
| |
| return img::format("CVT.W.D %s, %s", ft, fs); |
| } |
| |
| |
| /* |
| * |
| * |
| * 3 2 1 |
| * 10987654321098765432109876543210 |
| * 001000 x1110000101 |
| * rt ----- |
| * rs ----- |
| * rd ----- |
| */ |
| std::string NMD::CVT_W_S(uint64 instruction) |
| { |
| uint64 ft_value = extract_ft_25_24_23_22_21(instruction); |
| uint64 fs_value = extract_fs_20_19_18_17_16(instruction); |
| |
| std::string ft = FPR(copy(ft_value)); |
| std::string fs = FPR(copy(fs_value)); |
| |
| return img::format("CVT.W.S %s, %s", ft, fs); |
| } |
| |
| |
| /* |
| * |
| * |
| * 3 2 1 |
| * 10987654321098765432109876543210 |
| * 001000 x1110000101 |
| * rt ----- |
| * rs ----- |
| * rd ----- |
| */ |
| std::string NMD::DADDIU_48_(uint64 instruction) |
| { |
| uint64 rt_value = extract_rt_41_40_39_38_37(instruction); |
| int64 s_value = extract_s__se31_15_to_0_31_to_16(instruction); |
| |
| std::string rt = GPR(copy(rt_value)); |
| std::string s = IMMEDIATE(copy(s_value)); |
| |
| return img::format("DADDIU %s, %s", rt, s); |
| } |
| |
| |
| /* |
| * |
| * |
| * 3 2 1 |
| * 10987654321098765432109876543210 |
| * 001000 x1110000101 |
| * rt ----- |
| * rs ----- |
| * rd ----- |
| */ |
| std::string NMD::DADDIU_NEG_(uint64 instruction) |
| { |
| uint64 rt_value = extract_rt_25_24_23_22_21(instruction); |
| uint64 rs_value = extract_rs_20_19_18_17_16(instruction); |
| uint64 u_value = extract_u_11_10_9_8_7_6_5_4_3_2_1_0(instruction); |
| |
| std::string rt = GPR(copy(rt_value)); |
| std::string rs = GPR(copy(rs_value)); |
| std::string u = IMMEDIATE(neg_copy(u_value)); |
| |
| return img::format("DADDIU %s, %s, %s", rt, rs, u); |
| } |
| |
| |
| /* |
| * |
| * |
| * 3 2 1 |
| * 10987654321098765432109876543210 |
| * 001000 x1110000101 |
| * rt ----- |
| * rs ----- |
| * rd ----- |
| */ |
| std::string NMD::DADDIU_U12_(uint64 instruction) |
| { |
| uint64 rt_value = extract_rt_25_24_23_22_21(instruction); |
| uint64 rs_value = extract_rs_20_19_18_17_16(instruction); |
| uint64 u_value = extract_u_11_10_9_8_7_6_5_4_3_2_1_0(instruction); |
| |
| std::string rt = GPR(copy(rt_value)); |
| std::string rs = GPR(copy(rs_value)); |
| std::string u = IMMEDIATE(copy(u_value)); |
| |
| return img::format("DADDIU %s, %s, %s", rt, rs, u); |
| } |
| |
| |
| /* |
| * |
| * |
| * 3 2 1 |
| * 10987654321098765432109876543210 |
| * 001000 x1110000101 |
| * rt ----- |
| * rs ----- |
| * rd ----- |
| */ |
| std::string NMD::DADD(uint64 instruction) |
| { |
| uint64 rt_value = extract_rt_25_24_23_22_21(instruction); |
| uint64 rs_value = extract_rs_20_19_18_17_16(instruction); |
| uint64 rd_value = extract_rd_15_14_13_12_11(instruction); |
| |
| std::string rd = GPR(copy(rd_value)); |
| std::string rs = GPR(copy(rs_value)); |
| std::string rt = GPR(copy(rt_value)); |
| |
| return img::format("DADD %s, %s, %s", rd, rs, rt); |
| } |
| |
| |
| /* |
| * |
| * |
| * 3 2 1 |
| * 10987654321098765432109876543210 |
| * 001000 x1110000101 |
| * rt ----- |
| * rs ----- |
| * rd ----- |
| */ |
| std::string NMD::DADDU(uint64 instruction) |
| { |
| uint64 rt_value = extract_rt_25_24_23_22_21(instruction); |
| uint64 rs_value = extract_rs_20_19_18_17_16(instruction); |
| uint64 rd_value = extract_rd_15_14_13_12_11(instruction); |
| |
| std::string rd = GPR(copy(rd_value)); |
| std::string rs = GPR(copy(rs_value)); |
| std::string rt = GPR(copy(rt_value)); |
| |
| return img::format("DADDU %s, %s, %s", rd, rs, rt); |
| } |
| |
| |
| /* |
| * |
| * |
| * 3 2 1 |
| * 10987654321098765432109876543210 |
| * 001000 x1110000101 |
| * rt ----- |
| * rs ----- |
| * rd ----- |
| */ |
| std::string NMD::DCLO(uint64 instruction) |
| { |
| uint64 rt_value = extract_rt_25_24_23_22_21(instruction); |
| uint64 rs_value = extract_rs_20_19_18_17_16(instruction); |
| |
| std::string rt = GPR(copy(rt_value)); |
| std::string rs = GPR(copy(rs_value)); |
| |
| return img::format("DCLO %s, %s", rt, rs); |
| } |
| |
| |
| /* |
| * |
| * |
| * 3 2 1 |
| * 10987654321098765432109876543210 |
| * 001000 x1110000101 |
| * rt ----- |
| * rs ----- |
| * rd ----- |
| */ |
| std::string NMD::DCLZ(uint64 instruction) |
| { |
| uint64 rt_value = extract_rt_25_24_23_22_21(instruction); |
| uint64 rs_value = extract_rs_20_19_18_17_16(instruction); |
| |
| std::string rt = GPR(copy(rt_value)); |
| std::string rs = GPR(copy(rs_value)); |
| |
| return img::format("DCLZ %s, %s", rt, rs); |
| } |
| |
| |
| /* |
| * |
| * |
| * 3 2 1 |
| * 10987654321098765432109876543210 |
| * 001000 x1110000101 |
| * rt ----- |
| * rs ----- |
| * rd ----- |
| */ |
| std::string NMD::DDIV(uint64 instruction) |
| { |
| uint64 rt_value = extract_rt_25_24_23_22_21(instruction); |
| uint64 rs_value = extract_rs_20_19_18_17_16(instruction); |
| uint64 rd_value = extract_rd_15_14_13_12_11(instruction); |
| |
| std::string rd = GPR(copy(rd_value)); |
| std::string rs = GPR(copy(rs_value)); |
| std::string rt = GPR(copy(rt_value)); |
| |
| return img::format("DDIV %s, %s, %s", rd, rs, rt); |
| } |
| |
| |
| /* |
| * |
| * |
| * 3 2 1 |
| * 10987654321098765432109876543210 |
| * 001000 x1110000101 |
| * rt ----- |
| * rs ----- |
| * rd ----- |
| */ |
| std::string NMD::DDIVU(uint64 instruction) |
| { |
| uint64 rt_value = extract_rt_25_24_23_22_21(instruction); |
| uint64 rs_value = extract_rs_20_19_18_17_16(instruction); |
| uint64 rd_value = extract_rd_15_14_13_12_11(instruction); |
| |
| std::string rd = GPR(copy(rd_value)); |
| std::string rs = GPR(copy(rs_value)); |
| std::string rt = GPR(copy(rt_value)); |
| |
| return img::format("DDIVU %s, %s, %s", rd, rs, rt); |
| } |
| |
| |
| /* |
| * |
| * |
| * 3 2 1 |
| * 10987654321098765432109876543210 |
| * 001000 x1110000101 |
| * rt ----- |
| * rs ----- |
| * rd ----- |
| */ |
| std::string NMD::DERET(uint64 instruction) |
| { |
| (void)instruction; |
| |
| return "DERET "; |
| } |
| |
| |
| /* |
| * |
| * |
| * 3 2 1 |
| * 10987654321098765432109876543210 |
| * 001000 x1110000101 |
| * rt ----- |
| * rs ----- |
| * rd ----- |
| */ |
| std::string NMD::DEXTM(uint64 instruction) |
| { |
| uint64 rt_value = extract_rt_25_24_23_22_21(instruction); |
| uint64 rs_value = extract_rs_20_19_18_17_16(instruction); |
| uint64 msbd_value = extract_msbt_10_9_8_7_6(instruction); |
| uint64 lsb_value = extract_lsb_4_3_2_1_0(instruction); |
| |
| std::string rt = GPR(copy(rt_value)); |
| std::string rs = GPR(copy(rs_value)); |
| std::string lsb = IMMEDIATE(copy(lsb_value)); |
| std::string msbd = IMMEDIATE(encode_msbd_from_size(msbd_value)); |
| |
| return img::format("DEXTM %s, %s, %s, %s", rt, rs, lsb, msbd); |
| } |
| |
| |
| /* |
| * |
| * |
| * 3 2 1 |
| * 10987654321098765432109876543210 |
| * 001000 x1110000101 |
| * rt ----- |
| * rs ----- |
| * rd ----- |
| */ |
| std::string NMD::DEXT(uint64 instruction) |
| { |
| uint64 rt_value = extract_rt_25_24_23_22_21(instruction); |
| uint64 rs_value = extract_rs_20_19_18_17_16(instruction); |
| uint64 msbd_value = extract_msbt_10_9_8_7_6(instruction); |
| uint64 lsb_value = extract_lsb_4_3_2_1_0(instruction); |
| |
| std::string rt = GPR(copy(rt_value)); |
| std::string rs = GPR(copy(rs_value)); |
| std::string lsb = IMMEDIATE(copy(lsb_value)); |
| std::string msbd = IMMEDIATE(encode_msbd_from_size(msbd_value)); |
| |
| return img::format("DEXT %s, %s, %s, %s", rt, rs, lsb, msbd); |
| } |
| |
| |
| /* |
| * |
| * |
| * 3 2 1 |
| * 10987654321098765432109876543210 |
| * 001000 x1110000101 |
| * rt ----- |
| * rs ----- |
| * rd ----- |
| */ |
| std::string NMD::DEXTU(uint64 instruction) |
| { |
| uint64 rt_value = extract_rt_25_24_23_22_21(instruction); |
| uint64 rs_value = extract_rs_20_19_18_17_16(instruction); |
| uint64 msbd_value = extract_msbt_10_9_8_7_6(instruction); |
| uint64 lsb_value = extract_lsb_4_3_2_1_0(instruction); |
| |
| std::string rt = GPR(copy(rt_value)); |
| std::string rs = GPR(copy(rs_value)); |
| std::string lsb = IMMEDIATE(copy(lsb_value)); |
| std::string msbd = IMMEDIATE(encode_msbd_from_size(msbd_value)); |
| |
| return img::format("DEXTU %s, %s, %s, %s", rt, rs, lsb, msbd); |
| } |
| |
| |
| /* |
| * |
| * |
| * 3 2 1 |
| * 10987654321098765432109876543210 |
| * 001000 x1110000101 |
| * rt ----- |
| * rs ----- |
| * rd ----- |
| */ |
| std::string NMD::DINSM(uint64 instruction) |
| { |
| uint64 rt_value = extract_rt_25_24_23_22_21(instruction); |
| uint64 rs_value = extract_rs_20_19_18_17_16(instruction); |
| uint64 msbd_value = extract_msbt_10_9_8_7_6(instruction); |
| uint64 lsb_value = extract_lsb_4_3_2_1_0(instruction); |
| |
| std::string rt = GPR(copy(rt_value)); |
| std::string rs = GPR(copy(rs_value)); |
| std::string pos = IMMEDIATE(encode_lsb_from_pos_and_size(lsb_value)); |
| std::string size = IMMEDIATE(encode_lsb_from_pos_and_size(msbd_value)); |
| /* !!!!!!!!!! - no conversion function */ |
| |
| return img::format("DINSM %s, %s, %s, %s", rt, rs, pos, size); |
| /* hand edited */ |
| } |
| |
| |
| /* |
| * |
| * |
| * 3 2 1 |
| * 10987654321098765432109876543210 |
| * 001000 x1110000101 |
| * rt ----- |
| * rs ----- |
| * rd ----- |
| */ |
| std::string NMD::DINS(uint64 instruction) |
| { |
| uint64 rt_value = extract_rt_25_24_23_22_21(instruction); |
| uint64 rs_value = extract_rs_20_19_18_17_16(instruction); |
| uint64 msbd_value = extract_msbt_10_9_8_7_6(instruction); |
| uint64 lsb_value = extract_lsb_4_3_2_1_0(instruction); |
| |
| std::string rt = GPR(copy(rt_value)); |
| std::string rs = GPR(copy(rs_value)); |
| std::string pos = IMMEDIATE(encode_lsb_from_pos_and_size(lsb_value)); |
| std::string size = IMMEDIATE(encode_lsb_from_pos_and_size(msbd_value)); |
| /* !!!!!!!!!! - no conversion function */ |
| |
| return img::format("DINS %s, %s, %s, %s", rt, rs, pos, size); |
| /* hand edited */ |
| } |
| |
| |
| /* |
| * |
| * |
| * 3 2 1 |
| * 10987654321098765432109876543210 |
| * 001000 x1110000101 |
| * rt ----- |
| * rs ----- |
| * rd ----- |
| */ |
| std::string NMD::DINSU(uint64 instruction) |
| { |
| uint64 rt_value = extract_rt_25_24_23_22_21(instruction); |
| uint64 rs_value = extract_rs_20_19_18_17_16(instruction); |
| uint64 msbd_value = extract_msbt_10_9_8_7_6(instruction); |
| uint64 lsb_value = extract_lsb_4_3_2_1_0(instruction); |
| |
| std::string rt = GPR(copy(rt_value)); |
| std::string rs = GPR(copy(rs_value)); |
| std::string pos = IMMEDIATE(encode_lsb_from_pos_and_size(lsb_value)); |
| std::string size = IMMEDIATE(encode_lsb_from_pos_and_size(msbd_value)); |
| /* !!!!!!!!!! - no conversion function */ |
| |
| return img::format("DINSU %s, %s, %s, %s", rt, rs, pos, size); |
| /* hand edited */ |
| } |
| |
| |
| /* |
| * |
| * |
| * 3 2 1 |
| * 10987654321098765432109876543210 |
| * 001000 x1110000101 |
| * rt ----- |
| * rs ----- |
| * rd ----- |
| */ |
| std::string NMD::DI(uint64 instruction) |
| { |
| uint64 rt_value = extract_rt_25_24_23_22_21(instruction); |
| |
| std::string rt = GPR(copy(rt_value)); |
| |
| return img::format("DI %s", rt); |
| } |
| |
| |
| /* |
| * |
| * |
| * 3 2 1 |
| * 10987654321098765432109876543210 |
| * 001000 x1110000101 |
| * rt ----- |
| * rs ----- |
| * rd ----- |
| */ |
| std::string NMD::DIV(uint64 instruction) |
| { |
| uint64 rt_value = extract_rt_25_24_23_22_21(instruction); |
| uint64 rs_value = extract_rs_20_19_18_17_16(instruction); |
| uint64 rd_value = extract_rd_15_14_13_12_11(instruction); |
| |
| std::string rd = GPR(copy(rd_value)); |
| std::string rs = GPR(copy(rs_value)); |
| std::string rt = GPR(copy(rt_value)); |
| |
| return img::format("DIV %s, %s, %s", rd, rs, rt); |
| } |
| |
| |
| /* |
| * |
| * |
| * 3 2 1 |
| * 10987654321098765432109876543210 |
| * 001000 x1110000101 |
| * rt ----- |
| * rs ----- |
| * rd ----- |
| */ |
| std::string NMD::DIV_D(uint64 instruction) |
| { |
| uint64 ft_value = extract_ft_25_24_23_22_21(instruction); |
| uint64 fs_value = extract_fs_20_19_18_17_16(instruction); |
| uint64 fd_value = extract_fd_15_14_13_12_11(instruction); |
| |
| std::string fd = FPR(copy(fd_value)); |
| std::string fs = FPR(copy(fs_value)); |
| std::string ft = FPR(copy(ft_value)); |
| |
| return img::format("DIV.D %s, %s, %s", fd, fs, ft); |
| } |
| |
| |
| /* |
| * |
| * |
| * 3 2 1 |
| * 10987654321098765432109876543210 |
| * 001000 x1110000101 |
| * rt ----- |
| * rs ----- |
| * rd ----- |
| */ |
| std::string NMD::DIV_S(uint64 instruction) |
| { |
| uint64 ft_value = extract_ft_25_24_23_22_21(instruction); |
| uint64 fs_value = extract_fs_20_19_18_17_16(instruction); |
| uint64 fd_value = extract_fd_15_14_13_12_11(instruction); |
| |
| std::string fd = FPR(copy(fd_value)); |
| std::string fs = FPR(copy(fs_value)); |
| std::string ft = FPR(copy(ft_value)); |
| |
| return img::format("DIV.S %s, %s, %s", fd, fs, ft); |
| } |
| |
| |
| /* |
| * |
| * |
| * 3 2 1 |
| * 10987654321098765432109876543210 |
| * 001000 x1110000101 |
| * rt ----- |
| * rs ----- |
| * rd ----- |
| */ |
| std::string NMD::DIVU(uint64 instruction) |
| { |
| uint64 rt_value = extract_rt_25_24_23_22_21(instruction); |
| uint64 rs_value = extract_rs_20_19_18_17_16(instruction); |
| uint64 rd_value = extract_rd_15_14_13_12_11(instruction); |
| |
| std::string rd = GPR(copy(rd_value)); |
| std::string rs = GPR(copy(rs_value)); |
| std::string rt = GPR(copy(rt_value)); |
| |
| return img::format("DIVU %s, %s, %s", rd, rs, rt); |
| } |
| |
| |
| /* |
| * |
| * |
| * 3 2 1 |
| * 10987654321098765432109876543210 |
| * 001000 x1110000101 |
| * rt ----- |
| * rs ----- |
| * rd ----- |
| */ |
| std::string NMD::DLSA(uint64 instruction) |
| { |
| uint64 rt_value = extract_rt_25_24_23_22_21(instruction); |
| uint64 rs_value = extract_rs_20_19_18_17_16(instruction); |
| uint64 rd_value = extract_rd_15_14_13_12_11(instruction); |
| uint64 u2_value = extract_u2_10_9(instruction); |
| |
| std::string rd = GPR(copy(rd_value)); |
| std::string rs = GPR(copy(rs_value)); |
| std::string rt = GPR(copy(rt_value)); |
| std::string u2 = IMMEDIATE(copy(u2_value)); |
| |
| return img::format("DLSA %s, %s, %s, %s", rd, rs, rt, u2); |
| } |
| |
| |
| /* |
| * |
| * |
| * 3 2 1 |
| * 10987654321098765432109876543210 |
| * 001000 x1110000101 |
| * rt ----- |
| * rs ----- |
| * rd ----- |
| */ |
| std::string NMD::DLUI_48_(uint64 instruction) |
| { |
| uint64 rt_value = extract_rt_41_40_39_38_37(instruction); |
| uint64 u_value = extract_u_31_to_0__s32(instruction); |
| |
| std::string rt = GPR(copy(rt_value)); |
| std::string u = IMMEDIATE(copy(u_value)); |
| |
| return img::format("DLUI %s, %s", rt, u); |
| } |
| |
| |
| /* |
| * |
| * |
| * 3 2 1 |
| * 10987654321098765432109876543210 |
| * 001000 x1110000101 |
| * rt ----- |
| * rs ----- |
| * rd ----- |
| */ |
| std::string NMD::DMFC0(uint64 instruction) |
| { |
| uint64 rt_value = extract_rt_25_24_23_22_21(instruction); |
| uint64 c0s_value = extract_c0s_20_19_18_17_16(instruction); |
| uint64 sel_value = extract_sel_15_14_13_12_11(instruction); |
| |
| std::string rt = GPR(copy(rt_value)); |
| std::string c0s = CPR(copy(c0s_value)); |
| std::string sel = IMMEDIATE(copy(sel_value)); |
| |
| return img::format("DMFC0 %s, %s, %s", rt, c0s, sel); |
| } |
| |
| |
| /* |
| * |
| * |
| * 3 2 1 |
| * 10987654321098765432109876543210 |
| * 001000 x1110000101 |
| * rt ----- |
| * rs ----- |
| * rd ----- |
| */ |
| std::string NMD::DMFC1(uint64 instruction) |
| { |
| uint64 rt_value = extract_rt_25_24_23_22_21(instruction); |
| uint64 fs_value = extract_fs_20_19_18_17_16(instruction); |
| |
| std::string rt = GPR(copy(rt_value)); |
| std::string fs = FPR(copy(fs_value)); |
| |
| return img::format("DMFC1 %s, %s", rt, fs); |
| } |
| |
| |
| /* |
| * |
| * |
| * 3 2 1 |
| * 10987654321098765432109876543210 |
| * 001000 x1110000101 |
| * rt ----- |
| * rs ----- |
| * rd ----- |
| */ |
| std::string NMD::DMFC2(uint64 instruction) |
| { |
| uint64 rt_value = extract_rt_25_24_23_22_21(instruction); |
| uint64 cs_value = extract_cs_20_19_18_17_16(instruction); |
| |
| std::string rt = GPR(copy(rt_value)); |
| std::string cs = CPR(copy(cs_value)); |
| |
| return img::format("DMFC2 %s, %s", rt, cs); |
| } |
| |
| |
| /* |
| * |
| * |
| * 3 2 1 |
| * 10987654321098765432109876543210 |
| * 001000 x1110000101 |
| * rt ----- |
| * rs ----- |
| * rd ----- |
| */ |
| std::string NMD::DMFGC0(uint64 instruction) |
| { |
| uint64 rt_value = extract_rt_25_24_23_22_21(instruction); |
| uint64 c0s_value = extract_c0s_20_19_18_17_16(instruction); |
| uint64 sel_value = extract_sel_15_14_13_12_11(instruction); |
| |
| std::string rt = GPR(copy(rt_value)); |
| std::string c0s = CPR(copy(c0s_value)); |
| std::string sel = IMMEDIATE(copy(sel_value)); |
| |
| return img::format("DMFGC0 %s, %s, %s", rt, c0s, sel); |
| } |
| |
| |
| /* |
| * |
| * |
| * 3 2 1 |
| * 10987654321098765432109876543210 |
| * 001000 x1110000101 |
| * rt ----- |
| * rs ----- |
| * rd ----- |
| */ |
| std::string NMD::DMOD(uint64 instruction) |
| { |
| uint64 rt_value = extract_rt_25_24_23_22_21(instruction); |
| uint64 rs_value = extract_rs_20_19_18_17_16(instruction); |
| uint64 rd_value = extract_rd_15_14_13_12_11(instruction); |
| |
| std::string rd = GPR(copy(rd_value)); |
| std::string rs = GPR(copy(rs_value)); |
| std::string rt = GPR(copy(rt_value)); |
| |
| return img::format("DMOD %s, %s, %s", rd, rs, rt); |
| } |
| |
| |
| /* |
| * |
| * |
| * 3 2 1 |
| * 10987654321098765432109876543210 |
| * 001000 x1110000101 |
| * rt ----- |
| * rs ----- |
| * rd ----- |
| */ |
| std::string NMD::DMODU(uint64 instruction) |
| { |
| uint64 rt_value = extract_rt_25_24_23_22_21(instruction); |
| uint64 rs_value = extract_rs_20_19_18_17_16(instruction); |
| uint64 rd_value = extract_rd_15_14_13_12_11(instruction); |
| |
| std::string rd = GPR(copy(rd_value)); |
| std::string rs = GPR(copy(rs_value)); |
| std::string rt = GPR(copy(rt_value)); |
| |
| return img::format("DMODU %s, %s, %s", rd, rs, rt); |
| } |
| |
| |
| /* |
| * |
| * |
| * 3 2 1 |
| * 10987654321098765432109876543210 |
| * 001000 x1110000101 |
| * rt ----- |
| * rs ----- |
| * rd ----- |
| */ |
| std::string NMD::DMTC0(uint64 instruction) |
| { |
| uint64 rt_value = extract_rt_25_24_23_22_21(instruction); |
| uint64 c0s_value = extract_c0s_20_19_18_17_16(instruction); |
| uint64 sel_value = extract_sel_15_14_13_12_11(instruction); |
| |
| std::string rt = GPR(copy(rt_value)); |
| std::string c0s = CPR(copy(c0s_value)); |
| std::string sel = IMMEDIATE(copy(sel_value)); |
| |
| return img::format("DMTC0 %s, %s, %s", rt, c0s, sel); |
| } |
| |
| |
| /* |
| * |
| * |
| * 3 2 1 |
| * 10987654321098765432109876543210 |
| * 001000 x1110000101 |
| * rt ----- |
| * rs ----- |
| * rd ----- |
| */ |
| std::string NMD::DMTC1(uint64 instruction) |
| { |
| uint64 rt_value = extract_rt_25_24_23_22_21(instruction); |
| uint64 fs_value = extract_fs_20_19_18_17_16(instruction); |
| |
| std::string rt = GPR(copy(rt_value)); |
| std::string fs = FPR(copy(fs_value)); |
| |
| return img::format("DMTC1 %s, %s", rt, fs); |
| } |
| |
| |
| /* |
| * |
| * |
| * 3 2 1 |
| * 10987654321098765432109876543210 |
| * 001000 x1110000101 |
| * rt ----- |
| * rs ----- |
| * rd ----- |
| */ |
| std::string NMD::DMTC2(uint64 instruction) |
| { |
| uint64 rt_value = extract_rt_25_24_23_22_21(instruction); |
| uint64 cs_value = extract_cs_20_19_18_17_16(instruction); |
| |
| std::string rt = GPR(copy(rt_value)); |
| std::string cs = CPR(copy(cs_value)); |
| |
| return img::format("DMTC2 %s, %s", rt, cs); |
| } |
| |
| |
| /* |
| * |
| * |
| * 3 2 1 |
| * 10987654321098765432109876543210 |
| * 001000 x1110000101 |
| * rt ----- |
| * rs ----- |
| * rd ----- |
| */ |
| std::string NMD::DMTGC0(uint64 instruction) |
| { |
| uint64 rt_value = extract_rt_25_24_23_22_21(instruction); |
| uint64 c0s_value = extract_c0s_20_19_18_17_16(instruction); |
| uint64 sel_value = extract_sel_15_14_13_12_11(instruction); |
| |
| std::string rt = GPR(copy(rt_value)); |
| std::string c0s = CPR(copy(c0s_value)); |
| std::string sel = IMMEDIATE(copy(sel_value)); |
| |
| return img::format("DMTGC0 %s, %s, %s", rt, c0s, sel); |
| } |
| |
| |
| /* |
| * |
| * |
| * 3 2 1 |
| * 10987654321098765432109876543210 |
| * 001000 x1110000101 |
| * rt ----- |
| * rs ----- |
| * rd ----- |
| */ |
| std::string NMD::DMT(uint64 instruction) |
| { |
| uint64 rt_value = extract_rt_25_24_23_22_21(instruction); |
| |
| std::string rt = GPR(copy(rt_value)); |
| |
| return img::format("DMT %s", rt); |
| } |
| |
| |
| /* |
| * |
| * |
| * 3 2 1 |
| * 10987654321098765432109876543210 |
| * 001000 x1110000101 |
| * rt ----- |
| * rs ----- |
| * rd ----- |
| */ |
| std::string NMD::DMUH(uint64 instruction) |
| { |
| uint64 rt_value = extract_rt_25_24_23_22_21(instruction); |
| uint64 rs_value = extract_rs_20_19_18_17_16(instruction); |
| uint64 rd_value = extract_rd_15_14_13_12_11(instruction); |
| |
| std::string rd = GPR(copy(rd_value)); |
| std::string rs = GPR(copy(rs_value)); |
| std::string rt = GPR(copy(rt_value)); |
| |
| return img::format("DMUH %s, %s, %s", rd, rs, rt); |
| } |
| |
| |
| /* |
| * |
| * |
| * 3 2 1 |
| * 10987654321098765432109876543210 |
| * 001000 x1110000101 |
| * rt ----- |
| * rs ----- |
| * rd ----- |
| */ |
| std::string NMD::DMUHU(uint64 instruction) |
| { |
| uint64 rt_value = extract_rt_25_24_23_22_21(instruction); |
| uint64 rs_value = extract_rs_20_19_18_17_16(instruction); |
| uint64 rd_value = extract_rd_15_14_13_12_11(instruction); |
| |
| std::string rd = GPR(copy(rd_value)); |
| std::string rs = GPR(copy(rs_value)); |
| std::string rt = GPR(copy(rt_value)); |
| |
| return img::format("DMUHU %s, %s, %s", rd, rs, rt); |
| } |
| |
| |
| /* |
| * |
| * |
| * 3 2 1 |
| * 10987654321098765432109876543210 |
| * 001000 x1110000101 |
| * rt ----- |
| * rs ----- |
| * rd ----- |
| */ |
| std::string NMD::DMUL(uint64 instruction) |
| { |
| uint64 rt_value = extract_rt_25_24_23_22_21(instruction); |
| uint64 rs_value = extract_rs_20_19_18_17_16(instruction); |
| uint64 rd_value = extract_rd_15_14_13_12_11(instruction); |
| |
| std::string rd = GPR(copy(rd_value)); |
| std::string rs = GPR(copy(rs_value)); |
| std::string rt = GPR(copy(rt_value)); |
| |
| return img::format("DMUL %s, %s, %s", rd, rs, rt); |
| } |
| |
| |
| /* |
| * |
| * |
| * 3 2 1 |
| * 10987654321098765432109876543210 |
| * 001000 x1110000101 |
| * rt ----- |
| * rs ----- |
| * rd ----- |
| */ |
| std::string NMD::DMULU(uint64 instruction) |
| { |
| uint64 rt_value = extract_rt_25_24_23_22_21(instruction); |
| uint64 rs_value = extract_rs_20_19_18_17_16(instruction); |
| uint64 rd_value = extract_rd_15_14_13_12_11(instruction); |
| |
| std::string rd = GPR(copy(rd_value)); |
| std::string rs = GPR(copy(rs_value)); |
| std::string rt = GPR(copy(rt_value)); |
| |
| return img::format("DMULU %s, %s, %s", rd, rs, rt); |
| } |
| |
| |
| /* |
| * [DSP] DPA.W.PH ac, rs, rt - Dot product with accumulate on |
| * vector integer halfword elements |
| * |
| * 3 2 1 |
| * 10987654321098765432109876543210 |
| * 001000 00000010111111 |
| * rt ----- |
| * rs ----- |
| * ac -- |
| */ |
| std::string NMD::DPA_W_PH(uint64 instruction) |
| { |
| uint64 rt_value = extract_rt_25_24_23_22_21(instruction); |
| uint64 rs_value = extract_rs_20_19_18_17_16(instruction); |
| uint64 ac_value = extract_ac_15_14(instruction); |
| |
| std::string ac = AC(copy(ac_value)); |
| std::string rs = GPR(copy(rs_value)); |
| std::string rt = GPR(copy(rt_value)); |
| |
| return img::format("DPA.W.PH %s, %s, %s", ac, rs, rt); |
| } |
| |
| |
| /* |
| * |
| * |
| * 3 2 1 |
| * 10987654321098765432109876543210 |
| * 001000 x1110000101 |
| * rt ----- |
| * rs ----- |
| * rd ----- |
| */ |
| std::string NMD::DPAQ_SA_L_W(uint64 instruction) |
| { |
| uint64 rt_value = extract_rt_25_24_23_22_21(instruction); |
| uint64 rs_value = extract_rs_20_19_18_17_16(instruction); |
| uint64 ac_value = extract_ac_15_14(instruction); |
| |
| std::string ac = AC(copy(ac_value)); |
| std::string rs = GPR(copy(rs_value)); |
| std::string rt = GPR(copy(rt_value)); |
| |
| return img::format("DPAQ_SA.L.W %s, %s, %s", ac, rs, rt); |
| } |
| |
| |
| /* |
| * |
| * |
| * 3 2 1 |
| * 10987654321098765432109876543210 |
| * 001000 x1110000101 |
| * rt ----- |
| * rs ----- |
| * rd ----- |
| */ |
| std::string NMD::DPAQ_S_W_PH(uint64 instruction) |
| { |
| uint64 rt_value = extract_rt_25_24_23_22_21(instruction); |
| uint64 rs_value = extract_rs_20_19_18_17_16(instruction); |
| uint64 ac_value = extract_ac_15_14(instruction); |
| |
| std::string ac = AC(copy(ac_value)); |
| std::string rs = GPR(copy(rs_value)); |
| std::string rt = GPR(copy(rt_value)); |
| |
| return img::format("DPAQ_S.W.PH %s, %s, %s", ac, rs, rt); |
| } |
| |
| |
| /* |
| * |
| * |
| * 3 2 1 |
| * 10987654321098765432109876543210 |
| * 001000 x1110000101 |
| * rt ----- |
| * rs ----- |
| * rd ----- |
| */ |
| std::string NMD::DPAQX_SA_W_PH(uint64 instruction) |
| { |
| uint64 rt_value = extract_rt_25_24_23_22_21(instruction); |
| uint64 rs_value = extract_rs_20_19_18_17_16(instruction); |
| uint64 ac_value = extract_ac_15_14(instruction); |
| |
| std::string ac = AC(copy(ac_value)); |
| std::string rs = GPR(copy(rs_value)); |
| std::string rt = GPR(copy(rt_value)); |
| |
| return img::format("DPAQX_SA.W.PH %s, %s, %s", ac, rs, rt); |
| } |
| |
| |
| /* |
| * |
| * |
| * 3 2 1 |
| * 10987654321098765432109876543210 |
| * 001000 x1110000101 |
| * rt ----- |
| * rs ----- |
| * rd ----- |
| */ |
| std::string NMD::DPAQX_S_W_PH(uint64 instruction) |
| { |
| uint64 rt_value = extract_rt_25_24_23_22_21(instruction); |
| uint64 rs_value = extract_rs_20_19_18_17_16(instruction); |
| uint64 ac_value = extract_ac_15_14(instruction); |
| |
| std::string ac = AC(copy(ac_value)); |
| std::string rs = GPR(copy(rs_value)); |
| std::string rt = GPR(copy(rt_value)); |
| |
| return img::format("DPAQX_S.W.PH %s, %s, %s", ac, rs, rt); |
| } |
| |
| |
| /* |
| * |
| * |
| * 3 2 1 |
| * 10987654321098765432109876543210 |
| * 001000 x1110000101 |
| * rt ----- |
| * rs ----- |
| * rd ----- |
| */ |
| std::string NMD::DPAU_H_QBL(uint64 instruction) |
| { |
| uint64 rt_value = extract_rt_25_24_23_22_21(instruction); |
| uint64 rs_value = extract_rs_20_19_18_17_16(instruction); |
| uint64 ac_value = extract_ac_15_14(instruction); |
| |
| std::string ac = AC(copy(ac_value)); |
| std::string rs = GPR(copy(rs_value)); |
| std::string rt = GPR(copy(rt_value)); |
| |
| return img::format("DPAU.H.QBL %s, %s, %s", ac, rs, rt); |
| } |
| |
| |
| /* |
| * |
| * |
| * 3 2 1 |
| * 10987654321098765432109876543210 |
| * 001000 x1110000101 |
| * rt ----- |
| * rs ----- |
| * rd ----- |
| */ |
| std::string NMD::DPAU_H_QBR(uint64 instruction) |
| { |
| uint64 rt_value = extract_rt_25_24_23_22_21(instruction); |
| uint64 rs_value = extract_rs_20_19_18_17_16(instruction); |
| uint64 ac_value = extract_ac_15_14(instruction); |
| |
| std::string ac = AC(copy(ac_value)); |
| std::string rs = GPR(copy(rs_value)); |
| std::string rt = GPR(copy(rt_value)); |
| |
| return img::format("DPAU.H.QBR %s, %s, %s", ac, rs, rt); |
| } |
| |
| |
| /* |
| * |
| * |
| * 3 2 1 |
| * 10987654321098765432109876543210 |
| * 001000 x1110000101 |
| * rt ----- |
| * rs ----- |
| * rd ----- |
| */ |
| std::string NMD::DPAX_W_PH(uint64 instruction) |
| { |
| uint64 rt_value = extract_rt_25_24_23_22_21(instruction); |
| uint64 rs_value = extract_rs_20_19_18_17_16(instruction); |
| uint64 ac_value = extract_ac_15_14(instruction); |
| |
| std::string ac = AC(copy(ac_value)); |
| std::string rs = GPR(copy(rs_value)); |
| std::string rt = GPR(copy(rt_value)); |
| |
| return img::format("DPAX.W.PH %s, %s, %s", ac, rs, rt); |
| } |
| |
| |
| /* |
| * |
| * |
| * 3 2 1 |
| * 10987654321098765432109876543210 |
| * 001000 x1110000101 |
| * rt ----- |
| * rs ----- |
| * rd ----- |
| */ |
| std::string NMD::DPS_W_PH(uint64 instruction) |
| { |
| uint64 rt_value = extract_rt_25_24_23_22_21(instruction); |
| uint64 rs_value = extract_rs_20_19_18_17_16(instruction); |
| uint64 ac_value = extract_ac_15_14(instruction); |
| |
| std::string ac = AC(copy(ac_value)); |
| std::string rs = GPR(copy(rs_value)); |
| std::string rt = GPR(copy(rt_value)); |
| |
| return img::format("DPS.W.PH %s, %s, %s", ac, rs, rt); |
| } |
| |
| |
| /* |
| * |
| * |
| * 3 2 1 |
| * 10987654321098765432109876543210 |
| * 001000 x1110000101 |
| * rt ----- |
| * rs ----- |
| * rd ----- |
| */ |
| std::string NMD::DPSQ_SA_L_W(uint64 instruction) |
| { |
| uint64 rt_value = extract_rt_25_24_23_22_21(instruction); |
| uint64 rs_value = extract_rs_20_19_18_17_16(instruction); |
| uint64 ac_value = extract_ac_15_14(instruction); |
| |
| std::string ac = AC(copy(ac_value)); |
| std::string rs = GPR(copy(rs_value)); |
| std::string rt = GPR(copy(rt_value)); |
| |
| return img::format("DPSQ_SA.L.W %s, %s, %s", ac, rs, rt); |
| } |
| |
| |
| /* |
| * |
| * |
| * 3 2 1 |
| * 10987654321098765432109876543210 |
| * 001000 x1110000101 |
| * rt ----- |
| * rs ----- |
| * rd ----- |
| */ |
| std::string NMD::DPSQ_S_W_PH(uint64 instruction) |
| { |
| uint64 rt_value = extract_rt_25_24_23_22_21(instruction); |
| uint64 rs_value = extract_rs_20_19_18_17_16(instruction); |
| uint64 ac_value = extract_ac_15_14(instruction); |
| |
| std::string ac = AC(copy(ac_value)); |
| std::string rs = GPR(copy(rs_value)); |
| std::string rt = GPR(copy(rt_value)); |
| |
| return img::format("DPSQ_S.W.PH %s, %s, %s", ac, rs, rt); |
| } |
| |
| |
| /* |
| * |
| * |
| * 3 2 1 |
| * 10987654321098765432109876543210 |
| * 001000 x1110000101 |
| * rt ----- |
| * rs ----- |
| * rd ----- |
| */ |
| std::string NMD::DPSQX_SA_W_PH(uint64 instruction) |
| { |
| uint64 rt_value = extract_rt_25_24_23_22_21(instruction); |
| uint64 rs_value = extract_rs_20_19_18_17_16(instruction); |
| uint64 ac_value = extract_ac_15_14(instruction); |
| |
| std::string ac = AC(copy(ac_value)); |
| std::string rs = GPR(copy(rs_value)); |
| std::string rt = GPR(copy(rt_value)); |
| |
| return img::format("DPSQX_SA.W.PH %s, %s, %s", ac, rs, rt); |
| } |
| |
| |
| /* |
| * |
| * |
| * 3 2 1 |
| * 10987654321098765432109876543210 |
| * 001000 x1110000101 |
| * rt ----- |
| * rs ----- |
| * rd ----- |
| */ |
| std::string NMD::DPSQX_S_W_PH(uint64 instruction) |
| { |
| uint64 rt_value = extract_rt_25_24_23_22_21(instruction); |
| uint64 rs_value = extract_rs_20_19_18_17_16(instruction); |
| uint64 ac_value = extract_ac_15_14(instruction); |
| |
| std::string ac = AC(copy(ac_value)); |
| std::string rs = GPR(copy(rs_value)); |
| std::string rt = GPR(copy(rt_value)); |
| |
| return img::format("DPSQX_S.W.PH %s, %s, %s", ac, rs, rt); |
| } |
| |
| |
| /* |
| * |
| * |
| * 3 2 1 |
| * 10987654321098765432109876543210 |
| * 001000 x1110000101 |
| * rt ----- |
| * rs ----- |
| * rd ----- |
| */ |
| std::string NMD::DPSU_H_QBL(uint64 instruction) |
| { |
| uint64 rt_value = extract_rt_25_24_23_22_21(instruction); |
| uint64 rs_value = extract_rs_20_19_18_17_16(instruction); |
| uint64 ac_value = extract_ac_15_14(instruction); |
| |
| std::string ac = AC(copy(ac_value)); |
| std::string rs = GPR(copy(rs_value)); |
| std::string rt = GPR(copy(rt_value)); |
| |
| return img::format("DPSU.H.QBL %s, %s, %s", ac, rs, rt); |
| } |
| |
| |
| /* |
| * |
| * |
| * 3 2 1 |
| * 10987654321098765432109876543210 |
| * 001000 x1110000101 |
| * rt ----- |
| * rs ----- |
| * rd ----- |
| */ |
| std::string NMD::DPSU_H_QBR(uint64 instruction) |
| { |
| uint64 rt_value = extract_rt_25_24_23_22_21(instruction); |
| uint64 rs_value = extract_rs_20_19_18_17_16(instruction); |
| uint64 ac_value = extract_ac_15_14(instruction); |
| |
| std::string ac = AC(copy(ac_value)); |
| std::string rs = GPR(copy(rs_value)); |
| std::string rt = GPR(copy(rt_value)); |
| |
| return img::format("DPSU.H.QBR %s, %s, %s", ac, rs, rt); |
| } |
| |
| |
| /* |
| * |
| * |
| * 3 2 1 |
| * 10987654321098765432109876543210 |
| * 001000 x1110000101 |
| * rt ----- |
| * rs ----- |
| * rd ----- |
| */ |
| std::string NMD::DPSX_W_PH(uint64 instruction) |
| { |
| uint64 rt_value = extract_rt_25_24_23_22_21(instruction); |
| uint64 rs_value = extract_rs_20_19_18_17_16(instruction); |
| uint64 ac_value = extract_ac_15_14(instruction); |
| |
| std::string ac = AC(copy(ac_value)); |
| std::string rs = GPR(copy(rs_value)); |
| std::string rt = GPR(copy(rt_value)); |
| |
| return img::format("DPSX.W.PH %s, %s, %s", ac, rs, rt); |
| } |
| |
| |
| /* |
| * DROTR - |
| * |
| * 3 2 1 |
| * 10987654321098765432109876543210 |
| * 001000 x1110000101 |
| * rt ----- |
| * rs ----- |
| * rd ----- |
| */ |
| std::string NMD::DROTR(uint64 instruction) |
| { |
| uint64 rt_value = extract_rt_25_24_23_22_21(instruction); |
| uint64 rs_value = extract_rs_20_19_18_17_16(instruction); |
| uint64 shift_value = extract_shift_4_3_2_1_0(instruction); |
| |
| std::string rt = GPR(copy(rt_value)); |
| std::string rs = GPR(copy(rs_value)); |
| std::string shift = IMMEDIATE(copy(shift_value)); |
| |
| return img::format("DROTR %s, %s, %s", rt, rs, shift); |
| } |
| |
| |
| /* |
| * DROTR[32] - |
| * |
| * 3 2 1 |
| * 10987654321098765432109876543210 |
| * 10o000 1100xxx0110 |
| * rt ----- |
| * rs ----- |
| * shift ----- |
| */ |
| std::string NMD::DROTR32(uint64 instruction) |
| { |
| uint64 rt_value = extract_rt_25_24_23_22_21(instruction); |
| uint64 rs_value = extract_rs_20_19_18_17_16(instruction); |
| uint64 shift_value = extract_shift_4_3_2_1_0(instruction); |
| |
| std::string rt = GPR(copy(rt_value)); |
| std::string rs = GPR(copy(rs_value)); |
| std::string shift = IMMEDIATE(copy(shift_value)); |
| |
| return img::format("DROTR32 %s, %s, %s", rt, rs, shift); |
| } |
| |
| |
| /* |
| * |
| * |
| * 3 2 1 |
| * 10987654321098765432109876543210 |
| * 001000 x1110000101 |
| * rt ----- |
| * rs ----- |
| * rd ----- |
| */ |
| std::string NMD::DROTRV(uint64 instruction) |
| { |
| uint64 rt_value = extract_rt_25_24_23_22_21(instruction); |
| uint64 rs_value = extract_rs_20_19_18_17_16(instruction); |
| uint64 rd_value = extract_rd_15_14_13_12_11(instruction); |
| |
| std::string rd = GPR(copy(rd_value)); |
| std::string rs = GPR(copy(rs_value)); |
| std::string rt = GPR(copy(rt_value)); |
| |
| return img::format("DROTRV %s, %s, %s", rd, rs, rt); |
| } |
| |
| |
| /* |
| * |
| * |
| * 3 2 1 |
| * 10987654321098765432109876543210 |
| * 001000 x1110000101 |
| * rt ----- |
| * rs ----- |
| * rd ----- |
| */ |
| std::string NMD::DROTX(uint64 instruction) |
| { |
| uint64 rt_value = extract_rt_25_24_23_22_21(instruction); |
| uint64 rs_value = extract_rs_20_19_18_17_16(instruction); |
| uint64 shiftx_value = extract_shiftx_11_10_9_8_7_6(instruction); |
| uint64 shift_value = extract_shift_5_4_3_2_1_0(instruction); |
| |
| std::string rt = GPR(copy(rt_value)); |
| std::string rs = GPR(copy(rs_value)); |
| std::string shift = IMMEDIATE(copy(shift_value)); |
| std::string shiftx = IMMEDIATE(copy(shiftx_value)); |
| |
| return img::format("DROTX %s, %s, %s, %s", rt, rs, shift, shiftx); |
| } |
| |
| |
| /* |
| * DSLL - |
| * |
| * 3 2 1 |
| * 10987654321098765432109876543210 |
| * 10o000 1100xxx0000 |
| * rt ----- |
| * rs ----- |
| * shift ----- |
| */ |
| std::string NMD::DSLL(uint64 instruction) |
| { |
| uint64 rt_value = extract_rt_25_24_23_22_21(instruction); |
| uint64 rs_value = extract_rs_20_19_18_17_16(instruction); |
| uint64 shift_value = extract_shift_4_3_2_1_0(instruction); |
| |
| std::string rt = GPR(copy(rt_value)); |
| std::string rs = GPR(copy(rs_value)); |
| std::string shift = IMMEDIATE(copy(shift_value)); |
| |
| return img::format("DSLL %s, %s, %s", rt, rs, shift); |
| } |
| |
| |
| /* |
| * DSLL[32] - |
| * |
| * 3 2 1 |
| * 10987654321098765432109876543210 |
| * 10o000 1100xxx0000 |
| * rt ----- |
| * rs ----- |
| * shift ----- |
| */ |
| std::string NMD::DSLL32(uint64 instruction) |
| { |
| uint64 rt_value = extract_rt_25_24_23_22_21(instruction); |
| uint64 rs_value = extract_rs_20_19_18_17_16(instruction); |
| uint64 shift_value = extract_shift_4_3_2_1_0(instruction); |
| |
| std::string rt = GPR(copy(rt_value)); |
| std::string rs = GPR(copy(rs_value)); |
| std::string shift = IMMEDIATE(copy(shift_value)); |
| |
| return img::format("DSLL32 %s, %s, %s", rt, rs, shift); |
| } |
| |
| |
| /* |
| * |
| * |
| * 3 2 1 |
| * 10987654321098765432109876543210 |
| * 001000 x1110000101 |
| * rt ----- |
| * rs ----- |
| * rd ----- |
| */ |
| std::string NMD::DSLLV(uint64 instruction) |
| { |
| uint64 rt_value = extract_rt_25_24_23_22_21(instruction); |
| uint64 rs_value = extract_rs_20_19_18_17_16(instruction); |
| uint64 rd_value = extract_rd_15_14_13_12_11(instruction); |
| |
| std::string rd = GPR(copy(rd_value)); |
| std::string rs = GPR(copy(rs_value)); |
| std::string rt = GPR(copy(rt_value)); |
| |
| return img::format("DSLLV %s, %s, %s", rd, rs, rt); |
| } |
| |
| |
| /* |
| * DSRA - |
| * |
| * 3 2 1 |
| * 10987654321098765432109876543210 |
| * 10o000 1100xxx0100 |
| * rt ----- |
| * rs ----- |
| * shift ----- |
| */ |
| std::string NMD::DSRA(uint64 instruction) |
| { |
| uint64 rt_value = extract_rt_25_24_23_22_21(instruction); |
| uint64 rs_value = extract_rs_20_19_18_17_16(instruction); |
| uint64 shift_value = extract_shift_4_3_2_1_0(instruction); |
| |
| std::string rt = GPR(copy(rt_value)); |
| std::string rs = GPR(copy(rs_value)); |
| std::string shift = IMMEDIATE(copy(shift_value)); |
| |
| return img::format("DSRA %s, %s, %s", rt, rs, shift); |
| } |
| |
| |
| /* |
| * DSRA[32] - |
| * |
| * 3 2 1 |
| * 10987654321098765432109876543210 |
| * 10o000 1100xxx0100 |
| * rt ----- |
| * rs ----- |
| * shift ----- |
| */ |
| std::string NMD::DSRA32(uint64 instruction) |
| { |
| uint64 rt_value = extract_rt_25_24_23_22_21(instruction); |
| uint64 rs_value = extract_rs_20_19_18_17_16(instruction); |
| uint64 shift_value = extract_shift_4_3_2_1_0(instruction); |
| |
| std::string rt = GPR(copy(rt_value)); |
| std::string rs = GPR(copy(rs_value)); |
| std::string shift = IMMEDIATE(copy(shift_value)); |
| |
| return img::format("DSRA32 %s, %s, %s", rt, rs, shift); |
| } |
| |
| |
| /* |
| * |
| * |
| * 3 2 1 |
| * 10987654321098765432109876543210 |
| * 001000 x1110000101 |
| * rt ----- |
| * rs ----- |
| * rd ----- |
| */ |
| std::string NMD::DSRAV(uint64 instruction) |
| { |
| uint64 rt_value = extract_rt_25_24_23_22_21(instruction); |
| uint64 rs_value = extract_rs_20_19_18_17_16(instruction); |
| uint64 rd_value = extract_rd_15_14_13_12_11(instruction); |
| |
| std::string rd = GPR(copy(rd_value)); |
| std::string rs = GPR(copy(rs_value)); |
| std::string rt = GPR(copy(rt_value)); |
| |
| return img::format("DSRAV %s, %s, %s", rd, rs, rt); |
| } |
| |
| |
| /* |
| * DSRL - |
| * |
| * 3 2 1 |
| * 10987654321098765432109876543210 |
| * 10o000 1100xxx0100 |
| * rt ----- |
| * rs ----- |
| * shift ----- |
| */ |
| std::string NMD::DSRL(uint64 instruction) |
| { |
| uint64 rt_value = extract_rt_25_24_23_22_21(instruction); |
| uint64 rs_value = extract_rs_20_19_18_17_16(instruction); |
| uint64 shift_value = extract_shift_4_3_2_1_0(instruction); |
| |
| std::string rt = GPR(copy(rt_value)); |
| std::string rs = GPR(copy(rs_value)); |
| std::string shift = IMMEDIATE(copy(shift_value)); |
| |
| return img::format("DSRL %s, %s, %s", rt, rs, shift); |
| } |
| |
| |
| /* |
| * DSRL[32] - |
| * |
| * 3 2 1 |
| * 10987654321098765432109876543210 |
| * 10o000 1100xxx0010 |
| * rt ----- |
| * rs ----- |
| * shift ----- |
| */ |
| std::string NMD::DSRL32(uint64 instruction) |
| { |
| uint64 rt_value = extract_rt_25_24_23_22_21(instruction); |
| uint64 rs_value = extract_rs_20_19_18_17_16(instruction); |
| uint64 shift_value = extract_shift_4_3_2_1_0(instruction); |
| |
| std::string rt = GPR(copy(rt_value)); |
| std::string rs = GPR(copy(rs_value)); |
| std::string shift = IMMEDIATE(copy(shift_value)); |
| |
| return img::format("DSRL32 %s, %s, %s", rt, rs, shift); |
| } |
| |
| |
| /* |
| * |
| * |
| * 3 2 1 |
| * 10987654321098765432109876543210 |
| * 001000 x1110000101 |
| * rt ----- |
| * rs ----- |
| * rd ----- |
| */ |
| std::string NMD::DSRLV(uint64 instruction) |
| { |
| uint64 rt_value = extract_rt_25_24_23_22_21(instruction); |
| uint64 rs_value = extract_rs_20_19_18_17_16(instruction); |
| uint64 rd_value = extract_rd_15_14_13_12_11(instruction); |
| |
| std::string rd = GPR(copy(rd_value)); |
| std::string rs = GPR(copy(rs_value)); |
| std::string rt = GPR(copy(rt_value)); |
| |
| return img::format("DSRLV %s, %s, %s", rd, rs, rt); |
| } |
| |
| |
| /* |
| * |
| * |
| * 3 2 1 |
| * 10987654321098765432109876543210 |
| * 001000 x1110000101 |
| * rt ----- |
| * rs ----- |
| * rd ----- |
| */ |
| std::string NMD::DSUB(uint64 instruction) |
| { |
| uint64 rt_value = extract_rt_25_24_23_22_21(instruction); |
| uint64 rs_value = extract_rs_20_19_18_17_16(instruction); |
| uint64 rd_value = extract_rd_15_14_13_12_11(instruction); |
| |
| std::string rd = GPR(copy(rd_value)); |
| std::string rs = GPR(copy(rs_value)); |
| std::string rt = GPR(copy(rt_value)); |
| |
| return img::format("DSUB %s, %s, %s", rd, rs, rt); |
| } |
| |
| |
| /* |
| * |
| * |
| * 3 2 1 |
| * 10987654321098765432109876543210 |
| * 001000 x1110000101 |
| * rt ----- |
| * rs ----- |
| * rd ----- |
| */ |
| std::string NMD::DSUBU(uint64 instruction) |
| { |
| uint64 rt_value = extract_rt_25_24_23_22_21(instruction); |
| uint64 rs_value = extract_rs_20_19_18_17_16(instruction); |
| uint64 rd_value = extract_rd_15_14_13_12_11(instruction); |
| |
| std::string rd = GPR(copy(rd_value)); |
| std::string rs = GPR(copy(rs_value)); |
| std::string rt = GPR(copy(rt_value)); |
| |
| return img::format("DSUBU %s, %s, %s", rd, rs, rt); |
| } |
| |
| |
| /* |
| * |
| * |
| * 3 2 1 |
| * 10987654321098765432109876543210 |
| * 001000 x1110000101 |
| * rt ----- |
| * rs ----- |
| * rd ----- |
| */ |
| std::string NMD::DVPE(uint64 instruction) |
| { |
| uint64 rt_value = extract_rt_25_24_23_22_21(instruction); |
| |
| std::string rt = GPR(copy(rt_value)); |
| |
| return img::format("DVPE %s", rt); |
| } |
| |
| |
| /* |
| * |
| * |
| * 3 2 1 |
| * 10987654321098765432109876543210 |
| * 001000 x1110000101 |
| * rt ----- |
| * rs ----- |
| * rd ----- |
| */ |
| std::string NMD::DVP(uint64 instruction) |
| { |
| uint64 rt_value = extract_rt_25_24_23_22_21(instruction); |
| |
| std::string rt = GPR(copy(rt_value)); |
| |
| return img::format("DVP %s", rt); |
| } |
| |
| |
| /* |
| * |
| * |
| * 3 2 1 |
| * 10987654321098765432109876543210 |
| * 001000 x1110000101 |
| * rt ----- |
| * rs ----- |
| * rd ----- |
| */ |
| std::string NMD::EHB(uint64 instruction) |
| { |
| (void)instruction; |
| |
| return "EHB "; |
| } |
| |
| |
| /* |
| * |
| * |
| * 3 2 1 |
| * 10987654321098765432109876543210 |
| * 001000 x1110000101 |
| * rt ----- |
| * rs ----- |
| * rd ----- |
| */ |
| std::string NMD::EI(uint64 instruction) |
| { |
| uint64 rt_value = extract_rt_25_24_23_22_21(instruction); |
| |
| std::string rt = GPR(copy(rt_value)); |
| |
| return img::format("EI %s", rt); |
| } |
| |
| |
| /* |
| * |
| * |
| * 3 2 1 |
| * 10987654321098765432109876543210 |
| * 001000 x1110000101 |
| * rt ----- |
| * rs ----- |
| * rd ----- |
| */ |
| std::string NMD::EMT(uint64 instruction) |
| { |
| uint64 rt_value = extract_rt_25_24_23_22_21(instruction); |
| |
| std::string rt = GPR(copy(rt_value)); |
| |
| return img::format("EMT %s", rt); |
| } |
| |
| |
| /* |
| * |
| * |
| * 3 2 1 |
| * 10987654321098765432109876543210 |
| * 001000 x1110000101 |
| * rt ----- |
| * rs ----- |
| * rd ----- |
| */ |
| std::string NMD::ERET(uint64 instruction) |
| { |
| (void)instruction; |
| |
| return "ERET "; |
| } |
| |
| |
| /* |
| * |
| * |
| * 3 2 1 |
| * 10987654321098765432109876543210 |
| * 001000 x1110000101 |
| * rt ----- |
| * rs ----- |
| * rd ----- |
| */ |
| std::string NMD::ERETNC(uint64 instruction) |
| { |
| (void)instruction; |
| |
| return "ERETNC "; |
| } |
| |
| |
| /* |
| * |
| * |
| * 3 2 1 |
| * 10987654321098765432109876543210 |
| * 001000 x1110000101 |
| * rt ----- |
| * rs ----- |
| * rd ----- |
| */ |
| std::string NMD::EVP(uint64 instruction) |
| { |
| uint64 rt_value = extract_rt_25_24_23_22_21(instruction); |
| |
| std::string rt = GPR(copy(rt_value)); |
| |
| return img::format("EVP %s", rt); |
| } |
| |
| |
| /* |
| * |
| * |
| * 3 2 1 |
| * 10987654321098765432109876543210 |
| * 001000 x1110000101 |
| * rt ----- |
| * rs ----- |
| * rd ----- |
| */ |
| std::string NMD::EVPE(uint64 instruction) |
| { |
| uint64 rt_value = extract_rt_25_24_23_22_21(instruction); |
| |
| std::string rt = GPR(copy(rt_value)); |
| |
| return img::format("EVPE %s", rt); |
| } |
| |
| |
| /* |
| * |
| * |
| * 3 2 1 |
| * 10987654321098765432109876543210 |
| * 001000 x1110000101 |
| * rt ----- |
| * rs ----- |
| * rd ----- |
| */ |
| std::string NMD::EXT(uint64 instruction) |
| { |
| uint64 rt_value = extract_rt_25_24_23_22_21(instruction); |
| uint64 rs_value = extract_rs_20_19_18_17_16(instruction); |
| uint64 msbd_value = extract_msbt_10_9_8_7_6(instruction); |
| uint64 lsb_value = extract_lsb_4_3_2_1_0(instruction); |
| |
| std::string rt = GPR(copy(rt_value)); |
| std::string rs = GPR(copy(rs_value)); |
| std::string lsb = IMMEDIATE(copy(lsb_value)); |
| std::string msbd = IMMEDIATE(encode_msbd_from_size(msbd_value)); |
| |
| return img::format("EXT %s, %s, %s, %s", rt, rs, lsb, msbd); |
| } |
| |
| |
| /* |
| * |
| * |
| * 3 2 1 |
| * 10987654321098765432109876543210 |
| * 001000 x1110000101 |
| * rt ----- |
| * rs ----- |
| * rd ----- |
| */ |
| std::string NMD::EXTD(uint64 instruction) |
| { |
| uint64 rt_value = extract_rt_25_24_23_22_21(instruction); |
| uint64 rs_value = extract_rs_20_19_18_17_16(instruction); |
| uint64 rd_value = extract_rd_15_14_13_12_11(instruction); |
| uint64 shift_value = extract_shift_10_9_8_7_6(instruction); |
| |
| std::string rd = GPR(copy(rd_value)); |
| std::string rs = GPR(copy(rs_value)); |
| std::string rt = GPR(copy(rt_value)); |
| std::string shift = IMMEDIATE(copy(shift_value)); |
| |
| return img::format("EXTD %s, %s, %s, %s", rd, rs, rt, shift); |
| } |
| |
| |
| /* |
| * |
| * |
| * 3 2 1 |
| * 10987654321098765432109876543210 |
| * 001000 x1110000101 |
| * rt ----- |
| * rs ----- |
| * rd ----- |
| */ |
| std::string NMD::EXTD32(uint64 instruction) |
| { |
| uint64 rt_value = extract_rt_25_24_23_22_21(instruction); |
| uint64 rs_value = extract_rs_20_19_18_17_16(instruction); |
| uint64 rd_value = extract_rd_15_14_13_12_11(instruction); |
| uint64 shift_value = extract_shift_10_9_8_7_6(instruction); |
| |
| std::string rd = GPR(copy(rd_value)); |
| std::string rs = GPR(copy(rs_value)); |
| std::string rt = GPR(copy(rt_value)); |
| std::string shift = IMMEDIATE(copy(shift_value)); |
| |
| return img::format("EXTD32 %s, %s, %s, %s", rd, rs, rt, shift); |
| } |
| |
| |
| /* |
| * |
| * |
| * 3 2 1 |
| * 10987654321098765432109876543210 |
| * 001000 x1110000101 |
| * rt ----- |
| * rs ----- |
| * rd ----- |
| */ |
| std::string NMD::EXTPDP(uint64 instruction) |
| { |
| uint64 rt_value = extract_rt_25_24_23_22_21(instruction); |
| uint64 size_value = extract_size_20_19_18_17_16(instruction); |
| uint64 ac_value = extract_ac_15_14(instruction); |
| |
| std::string rt = GPR(copy(rt_value)); |
| std::string ac = AC(copy(ac_value)); |
| std::string size = IMMEDIATE(copy(size_value)); |
| |
| return img::format("EXTPDP %s, %s, %s", rt, ac, size); |
| } |
| |
| |
| /* |
| * |
| * |
| * 3 2 1 |
| * 10987654321098765432109876543210 |
| * 001000 x1110000101 |
| * rt ----- |
| * rs ----- |
| * rd ----- |
| */ |
| std::string NMD::EXTPDPV(uint64 instruction) |
| { |
| uint64 rt_value = extract_rt_25_24_23_22_21(instruction); |
| uint64 rs_value = extract_rs_20_19_18_17_16(instruction); |
| uint64 ac_value = extract_ac_15_14(instruction); |
| |
| std::string rt = GPR(copy(rt_value)); |
| std::string ac = AC(copy(ac_value)); |
| std::string rs = GPR(copy(rs_value)); |
| |
| return img::format("EXTPDPV %s, %s, %s", rt, ac, rs); |
| } |
| |
| |
| /* |
| * |
| * |
| * 3 2 1 |
| * 10987654321098765432109876543210 |
| * 001000 x1110000101 |
| * rt ----- |
| * rs ----- |
| * rd ----- |
| */ |
| std::string NMD::EXTP(uint64 instruction) |
| { |
| uint64 rt_value = extract_rt_25_24_23_22_21(instruction); |
| uint64 size_value = extract_size_20_19_18_17_16(instruction); |
| uint64 ac_value = extract_ac_15_14(instruction); |
| |
| std::string rt = GPR(copy(rt_value)); |
| std::string ac = AC(copy(ac_value)); |
| std::string size = IMMEDIATE(copy(size_value)); |
| |
| return img::format("EXTP %s, %s, %s", rt, ac, size); |
| } |
| |
| |
| /* |
| * |
| * |
| * 3 2 1 |
| * 10987654321098765432109876543210 |
| * 001000 x1110000101 |
| * rt ----- |
| * rs ----- |
| * rd ----- |
| */ |
| std::string NMD::EXTPV(uint64 instruction) |
| { |
| uint64 rt_value = extract_rt_25_24_23_22_21(instruction); |
| uint64 rs_value = extract_rs_20_19_18_17_16(instruction); |
| uint64 ac_value = extract_ac_15_14(instruction); |
| |
| std::string rt = GPR(copy(rt_value)); |
| std::string ac = AC(copy(ac_value)); |
| std::string rs = GPR(copy(rs_value)); |
| |
| return img::format("EXTPV %s, %s, %s", rt, ac, rs); |
| } |
| |
| |
| /* |
| * [DSP] EXTR_RS.W rt, ac, shift - Extract word value from accumulator to GPR |
| * with right shift |
| * |
| * 3 2 1 |
| * 10987654321098765432109876543210 |
| * 001000 10111001111111 |
| * rt ----- |
| * shift ----- |
| * ac -- |
| */ |
| std::string NMD::EXTR_RS_W(uint64 instruction) |
| { |
| uint64 rt_value = extract_rt_25_24_23_22_21(instruction); |
| uint64 shift_value = extract_shift_20_19_18_17_16(instruction); |
| uint64 ac_value = extract_ac_15_14(instruction); |
| |
| std::string rt = GPR(copy(rt_value)); |
| std::string ac = AC(copy(ac_value)); |
| std::string shift = IMMEDIATE(copy(shift_value)); |
| |
| return img::format("EXTR_RS.W %s, %s, %s", rt, ac, shift); |
| } |
| |
| |
| /* |
| * [DSP] EXTR_R.W rt, ac, shift - Extract word value from accumulator to GPR |
| * with right shift |
| * |
| * 3 2 1 |
| * 10987654321098765432109876543210 |
| * 001000 01111001111111 |
| * rt ----- |
| * shift ----- |
| * ac -- |
| */ |
| std::string NMD::EXTR_R_W(uint64 instruction) |
| { |
| uint64 rt_value = extract_rt_25_24_23_22_21(instruction); |
| uint64 shift_value = extract_shift_20_19_18_17_16(instruction); |
| uint64 ac_value = extract_ac_15_14(instruction); |
| |
| std::string rt = GPR(copy(rt_value)); |
| std::string ac = AC(copy(ac_value)); |
| std::string shift = IMMEDIATE(copy(shift_value)); |
| |
| return img::format("EXTR_R.W %s, %s, %s", rt, ac, shift); |
| } |
| |
| |
| /* |
| * [DSP] EXTR_S.H rt, ac, shift - Extract halfword value from accumulator |
| * to GPR with right shift and saturate |
| * |
| * 3 2 1 |
| * 10987654321098765432109876543210 |
| * 001000 11111001111111 |
| * rt ----- |
| * shift ----- |
| * ac -- |
| */ |
| std::string NMD::EXTR_S_H(uint64 instruction) |
| { |
| uint64 rt_value = extract_rt_25_24_23_22_21(instruction); |
| uint64 shift_value = extract_shift_20_19_18_17_16(instruction); |
| uint64 ac_value = extract_ac_15_14(instruction); |
| |
| std::string rt = GPR(copy(rt_value)); |
| std::string ac = AC(copy(ac_value)); |
| std::string shift = IMMEDIATE(copy(shift_value)); |
| |
| return img::format("EXTR_S.H %s, %s, %s", rt, ac, shift); |
| } |
| |
| |
| /* |
| * [DSP] EXTR.W rt, ac, shift - Extract word value from accumulator to GPR |
| * with right shift |
| * |
| * 3 2 1 |
| * 10987654321098765432109876543210 |
| * 001000 00111001111111 |
| * rt ----- |
| * shift ----- |
| * ac -- |
| */ |
| std::string NMD::EXTR_W(uint64 instruction) |
| { |
| uint64 rt_value = extract_rt_25_24_23_22_21(instruction); |
| uint64 shift_value = extract_shift_20_19_18_17_16(instruction); |
| uint64 ac_value = extract_ac_15_14(instruction); |
| |
| std::string rt = GPR(copy(rt_value)); |
| std::string ac = AC(copy(ac_value)); |
| std::string shift = IMMEDIATE(copy(shift_value)); |
| |
| return img::format("EXTR.W %s, %s, %s", rt, ac, shift); |
| } |
| |
| |
| /* |
| * [DSP] EXTRV_RS.W rt, ac, rs - Extract word value with variable |
| * right shift from accumulator to GPR |
| * |
| * 3 2 1 |
| * 10987654321098765432109876543210 |
| * 001000 10111010111111 |
| * rt ----- |
| * rs ----- |
| * ac -- |
| */ |
| std::string NMD::EXTRV_RS_W(uint64 instruction) |
| { |
| uint64 rt_value = extract_rt_25_24_23_22_21(instruction); |
| uint64 rs_value = extract_rs_20_19_18_17_16(instruction); |
| uint64 ac_value = extract_ac_15_14(instruction); |
| |
| std::string rt = GPR(copy(rt_value)); |
| std::string ac = AC(copy(ac_value)); |
| std::string rs = GPR(copy(rs_value)); |
| |
| return img::format("EXTRV_RS.W %s, %s, %s", rt, ac, rs); |
| } |
| |
| |
| /* |
| * [DSP] EXTRV_R.W rt, ac, rs - Extract word value with variable |
| * right shift from accumulator to GPR |
| * |
| * 3 2 1 |
| * 10987654321098765432109876543210 |
| * 001000 01111010111111 |
| * rt ----- |
| * rs ----- |
| * ac -- |
| */ |
| std::string NMD::EXTRV_R_W(uint64 instruction) |
| { |
| uint64 rt_value = extract_rt_25_24_23_22_21(instruction); |
| uint64 rs_value = extract_rs_20_19_18_17_16(instruction); |
| uint64 ac_value = extract_ac_15_14(instruction); |
| |
| std::string rt = GPR(copy(rt_value)); |
| std::string ac = AC(copy(ac_value)); |
| std::string rs = GPR(copy(rs_value)); |
| |
| return img::format("EXTRV_R.W %s, %s, %s", rt, ac, rs); |
| } |
| |
| |
| /* |
| * [DSP] EXTRV_S.H rt, ac, rs - Extract halfword value variable from |
| * accumulator to GPR with right shift and saturate |
| * |
| * 3 2 1 |
| * 10987654321098765432109876543210 |
| * 001000 11111010111111 |
| * rt ----- |
| * rs ----- |
| * ac -- |
| */ |
| std::string NMD::EXTRV_S_H(uint64 instruction) |
| { |
| uint64 rt_value = extract_rt_25_24_23_22_21(instruction); |
| uint64 rs_value = extract_rs_20_19_18_17_16(instruction); |
| uint64 ac_value = extract_ac_15_14(instruction); |
| |
| std::string rt = GPR(copy(rt_value)); |
| std::string ac = AC(copy(ac_value)); |
| std::string rs = GPR(copy(rs_value)); |
| |
| return img::format("EXTRV_S.H %s, %s, %s", rt, ac, rs); |
| } |
| |
| |
| /* |
| * [DSP] EXTRV.W rt, ac, rs - Extract word value with variable |
| * right shift from accumulator to GPR |
| * |
| * 3 2 1 |
| * 10987654321098765432109876543210 |
| * 001000 00111010111111 |
| * rt ----- |
| * rs ----- |
| * ac -- |
| */ |
| std::string NMD::EXTRV_W(uint64 instruction) |
| { |
| uint64 rt_value = extract_rt_25_24_23_22_21(instruction); |
| uint64 rs_value = extract_rs_20_19_18_17_16(instruction); |
| uint64 ac_value = extract_ac_15_14(instruction); |
| |
| std::string rt = GPR(copy(rt_value)); |
| std::string ac = AC(copy(ac_value)); |
| std::string rs = GPR(copy(rs_value)); |
| |
| return img::format("EXTRV.W %s, %s, %s", rt, ac, rs); |
| } |
| |
| |
| /* |
| * EXTW - Extract Word |
| * |
| * 3 2 1 |
| * 10987654321098765432109876543210 |
| * 001000 011111 |
| * rt ----- |
| * rs ----- |
| * rd ----- |
| * shift ----- |
| */ |
| std::string NMD::EXTW(uint64 instruction) |
| { |
| uint64 rt_value = extract_rt_25_24_23_22_21(instruction); |
| uint64 rs_value = extract_rs_20_19_18_17_16(instruction); |
| uint64 rd_value = extract_rd_15_14_13_12_11(instruction); |
| uint64 shift_value = extract_shift_10_9_8_7_6(instruction); |
| |
| std::string rd = GPR(copy(rd_value)); |
| std::string rs = GPR(copy(rs_value)); |
| std::string rt = GPR(copy(rt_value)); |
| std::string shift = IMMEDIATE(copy(shift_value)); |
| |
| return img::format("EXTW %s, %s, %s, %s", rd, rs, rt, shift); |
| } |
| |
| |
| /* |
| * |
| * |
| * 3 2 1 |
| * 10987654321098765432109876543210 |
| * 001000 x1110000101 |
| * rt ----- |
| * rs ----- |
| * rd ----- |
| */ |
| std::string NMD::FLOOR_L_D(uint64 instruction) |
| { |
| uint64 ft_value = extract_ft_25_24_23_22_21(instruction); |
| uint64 fs_value = extract_fs_20_19_18_17_16(instruction); |
| |
| std::string ft = FPR(copy(ft_value)); |
| std::string fs = FPR(copy(fs_value)); |
| |
| return img::format("FLOOR.L.D %s, %s", ft, fs); |
| } |
| |
| |
| /* |
| * |
| * |
| * 3 2 1 |
| * 10987654321098765432109876543210 |
| * 001000 x1110000101 |
| * rt ----- |
| * rs ----- |
| * rd ----- |
| */ |
| std::string NMD::FLOOR_L_S(uint64 instruction) |
| { |
| uint64 ft_value = extract_ft_25_24_23_22_21(instruction); |
| uint64 fs_value = extract_fs_20_19_18_17_16(instruction); |
| |
| std::string ft = FPR(copy(ft_value)); |
| std::string fs = FPR(copy(fs_value)); |
| |
| return img::format("FLOOR.L.S %s, %s", ft, fs); |
| } |
| |
| |
| /* |
| * |
| * |
| * 3 2 1 |
| * 10987654321098765432109876543210 |
| * 001000 x1110000101 |
| * rt ----- |
| * rs ----- |
| * rd ----- |
| */ |
| std::string NMD::FLOOR_W_D(uint64 instruction) |
| { |
| uint64 ft_value = extract_ft_25_24_23_22_21(instruction); |
| uint64 fs_value = extract_fs_20_19_18_17_16(instruction); |
| |
| std::string ft = FPR(copy(ft_value)); |
| std::string fs = FPR(copy(fs_value)); |
| |
| return img::format("FLOOR.W.D %s, %s", ft, fs); |
| } |
| |
| |
| /* |
| * |
| * |
| * 3 2 1 |
| * 10987654321098765432109876543210 |
| * 001000 x1110000101 |
| * rt ----- |
| * rs ----- |
| * rd ----- |
| */ |
| std::string NMD::FLOOR_W_S(uint64 instruction) |
| { |
| uint64 ft_value = extract_ft_25_24_23_22_21(instruction); |
| uint64 fs_value = extract_fs_20_19_18_17_16(instruction); |
| |
| std::string ft = FPR(copy(ft_value)); |
| std::string fs = FPR(copy(fs_value)); |
| |
| return img::format("FLOOR.W.S %s, %s", ft, fs); |
| } |
| |
| |
| /* |
| * |
| * |
| * 3 2 1 |
| * 10987654321098765432109876543210 |
| * 001000 x1110000101 |
| * rt ----- |
| * rs ----- |
| * rd ----- |
| */ |
| std::string NMD::FORK(uint64 instruction) |
| { |
| uint64 rt_value = extract_rt_25_24_23_22_21(instruction); |
| uint64 rs_value = extract_rs_20_19_18_17_16(instruction); |
| uint64 rd_value = extract_rd_15_14_13_12_11(instruction); |
| |
| std::string rd = GPR(copy(rd_value)); |
| std::string rs = GPR(copy(rs_value)); |
| std::string rt = GPR(copy(rt_value)); |
| |
| return img::format("FORK %s, %s, %s", rd, rs, rt); |
| } |
| |
| |
| /* |
| * |
| * |
| * 3 2 1 |
| * 10987654321098765432109876543210 |
| * 001000 x1110000101 |
| * rt ----- |
| * rs ----- |
| * rd ----- |
| */ |
| std::string NMD::HYPCALL(uint64 instruction) |
| { |
| uint64 code_value = extract_code_17_to_0(instruction); |
| |
| std::string code = IMMEDIATE(copy(code_value)); |
| |
| return img::format("HYPCALL %s", code); |
| } |
| |
| |
| /* |
| * |
| * |
| * 3 2 1 |
| * 10987654321098765432109876543210 |
| * 001000 x1110000101 |
| * rt ----- |
| * rs ----- |
| * rd ----- |
| */ |
| std::string NMD::HYPCALL_16_(uint64 instruction) |
| { |
| uint64 code_value = extract_code_1_0(instruction); |
| |
| std::string code = IMMEDIATE(copy(code_value)); |
| |
| return img::format("HYPCALL %s", code); |
| } |
| |
| |
| /* |
| * |
| * |
| * 3 2 1 |
| * 10987654321098765432109876543210 |
| * 001000 x1110000101 |
| * rt ----- |
| * rs ----- |
| * rd ----- |
| */ |
| std::string NMD::INS(uint64 instruction) |
| { |
| uint64 rt_value = extract_rt_25_24_23_22_21(instruction); |
| uint64 rs_value = extract_rs_20_19_18_17_16(instruction); |
| uint64 msbd_value = extract_msbt_10_9_8_7_6(instruction); |
| uint64 lsb_value = extract_lsb_4_3_2_1_0(instruction); |
| |
| std::string rt = GPR(copy(rt_value)); |
| std::string rs = GPR(copy(rs_value)); |
| std::string pos = IMMEDIATE(encode_lsb_from_pos_and_size(lsb_value)); |
| std::string size = IMMEDIATE(encode_lsb_from_pos_and_size(msbd_value)); |
| /* !!!!!!!!!! - no conversion function */ |
| |
| return img::format("INS %s, %s, %s, %s", rt, rs, pos, size); |
| /* hand edited */ |
| } |
| |
| |
| /* |
| * [DSP] INSV rt, rs - Insert bit field variable |
| * |
| * 3 2 1 |
| * 10987654321098765432109876543210 |
| * 001000 0100000100111111 |
| * rt ----- |
| * rs ----- |
| */ |
| std::string NMD::INSV(uint64 instruction) |
| { |
| uint64 rt_value = extract_rt_25_24_23_22_21(instruction); |
| uint64 rs_value = extract_rs_20_19_18_17_16(instruction); |
| |
| std::string rt = GPR(copy(rt_value)); |
| std::string rs = GPR(copy(rs_value)); |
| |
| return img::format("INSV %s, %s", rt, rs); |
| } |
| |
| |
| /* |
| * |
| * |
| * 3 2 1 |
| * 10987654321098765432109876543210 |
| * 001000 x1110000101 |
| * rt ----- |
| * rs ----- |
| * rd ----- |
| */ |
| std::string NMD::IRET(uint64 instruction) |
| { |
| (void)instruction; |
| |
| return "IRET "; |
| } |
| |
| |
| /* |
| * |
| * |
| * 3 2 1 |
| * 10987654321098765432109876543210 |
| * 001000 x1110000101 |
| * rt ----- |
| * rs ----- |
| * rd ----- |
| */ |
| std::string NMD::JALRC_16_(uint64 instruction) |
| { |
| uint64 rt_value = extract_rt_9_8_7_6_5(instruction); |
| |
| std::string rt = GPR(copy(rt_value)); |
| |
| return img::format("JALRC $%d, %s", 31, rt); |
| } |
| |
| |
| /* |
| * |
| * |
| * 3 2 1 |
| * 10987654321098765432109876543210 |
| * 001000 x1110000101 |
| * rt ----- |
| * rs ----- |
| * rd ----- |
| */ |
| std::string NMD::JALRC_32_(uint64 instruction) |
| { |
| uint64 rt_value = extract_rt_25_24_23_22_21(instruction); |
| uint64 rs_value = extract_rs_20_19_18_17_16(instruction); |
| |
| std::string rt = GPR(copy(rt_value)); |
| std::string rs = GPR(copy(rs_value)); |
| |
| return img::format("JALRC %s, %s", rt, rs); |
| } |
| |
| |
| /* |
| * |
| * |
| * 3 2 1 |
| * 10987654321098765432109876543210 |
| * 001000 x1110000101 |
| * rt ----- |
| * rs ----- |
| * rd ----- |
| */ |
| std::string NMD::JALRC_HB(uint64 instruction) |
| { |
| uint64 rt_value = extract_rt_25_24_23_22_21(instruction); |
| uint64 rs_value = extract_rs_20_19_18_17_16(instruction); |
| |
| std::string rt = GPR(copy(rt_value)); |
| std::string rs = GPR(copy(rs_value)); |
| |
| return img::format("JALRC.HB %s, %s", rt, rs); |
| } |
| |
| |
| /* |
| * |
| * |
| * 3 2 1 |
| * 10987654321098765432109876543210 |
| * 001000 x1110000101 |
| * rt ----- |
| * rs ----- |
| * rd ----- |
| */ |
| std::string NMD::JRC(uint64 instruction) |
| { |
| uint64 rt_value = extract_rt_9_8_7_6_5(instruction); |
| |
| std::string rt = GPR(copy(rt_value)); |
| |
| return img::format("JRC %s", rt); |
| } |
| |
| |
| /* |
| * |
| * |
| * 3 2 1 |
| * 10987654321098765432109876543210 |
| * 001000 x1110000101 |
| * rt ----- |
| * rs ----- |
| * rd ----- |
| */ |
| std::string NMD::LB_16_(uint64 instruction) |
| { |
| uint64 rt3_value = extract_rt3_9_8_7(instruction); |
| uint64 rs3_value = extract_rs3_6_5_4(instruction); |
| uint64 u_value = extract_u_1_0(instruction); |
| |
| std::string rt3 = GPR(decode_gpr_gpr3(rt3_value)); |
| std::string u = IMMEDIATE(copy(u_value)); |
| std::string rs3 = GPR(decode_gpr_gpr3(rs3_value)); |
| |
| return img::format("LB %s, %s(%s)", rt3, u, rs3); |
| } |
| |
| |
| /* |
| * |
| * |
| * 3 2 1 |
| * 10987654321098765432109876543210 |
| * 001000 x1110000101 |
| * rt ----- |
| * rs ----- |
| * rd ----- |
| */ |
| std::string NMD::LB_GP_(uint64 instruction) |
| { |
| uint64 rt_value = extract_rt_25_24_23_22_21(instruction); |
| uint64 u_value = extract_u_17_to_0(instruction); |
| |
| std::string rt = GPR(copy(rt_value)); |
| std::string u = IMMEDIATE(copy(u_value)); |
| |
| return img::format("LB %s, %s($%d)", rt, u, 28); |
| } |
| |
| |
| /* |
| * |
| * |
| * 3 2 1 |
| * 10987654321098765432109876543210 |
| * 001000 x1110000101 |
| * rt ----- |
| * rs ----- |
| * rd ----- |
| */ |
| std::string NMD::LB_S9_(uint64 instruction) |
| { |
| uint64 rt_value = extract_rt_25_24_23_22_21(instruction); |
| uint64 rs_value = extract_rs_20_19_18_17_16(instruction); |
| int64 s_value = extract_s__se8_15_7_6_5_4_3_2_1_0(instruction); |
| |
| std::string rt = GPR(copy(rt_value)); |
| std::string s = IMMEDIATE(copy(s_value)); |
| std::string rs = GPR(copy(rs_value)); |
| |
| return img::format("LB %s, %s(%s)", rt, s, rs); |
| } |
| |
| |
| /* |
| * |
| * |
| * 3 2 1 |
| * 10987654321098765432109876543210 |
| * 001000 x1110000101 |
| * rt ----- |
| * rs ----- |
| * rd ----- |
| */ |
| std::string NMD::LB_U12_(uint64 instruction) |
| { |
| uint64 rt_value = extract_rt_25_24_23_22_21(instruction); |
| uint64 rs_value = extract_rs_20_19_18_17_16(instruction); |
| uint64 u_value = extract_u_11_10_9_8_7_6_5_4_3_2_1_0(instruction); |
| |
| std::string rt = GPR(copy(rt_value)); |
| std::string u = IMMEDIATE(copy(u_value)); |
| std::string rs = GPR(copy(rs_value)); |
| |
| return img::format("LB %s, %s(%s)", rt, u, rs); |
| } |
| |
| |
| /* |
| * |
| * |
| * 3 2 1 |
| * 10987654321098765432109876543210 |
| * 001000 x1110000101 |
| * rt ----- |
| * rs ----- |
| * rd ----- |
| */ |
| std::string NMD::LBE(uint64 instruction) |
| { |
| uint64 rt_value = extract_rt_25_24_23_22_21(instruction); |
| uint64 rs_value = extract_rs_20_19_18_17_16(instruction); |
| int64 s_value = extract_s__se8_15_7_6_5_4_3_2_1_0(instruction); |
| |
| std::string rt = GPR(copy(rt_value)); |
| std::string s = IMMEDIATE(copy(s_value)); |
| std::string rs = GPR(copy(rs_value)); |
| |
| return img::format("LBE %s, %s(%s)", rt, s, rs); |
| } |
| |
| |
| /* |
| * |
| * |
| * 3 2 1 |
| * 10987654321098765432109876543210 |
| * 001000 x1110000101 |
| * rt ----- |
| * rs ----- |
| * rd ----- |
| */ |
| std::string NMD::LBU_16_(uint64 instruction) |
| { |
| uint64 rt3_value = extract_rt3_9_8_7(instruction); |
| uint64 rs3_value = extract_rs3_6_5_4(instruction); |
| uint64 u_value = extract_u_1_0(instruction); |
| |
| std::string rt3 = GPR(decode_gpr_gpr3(rt3_value)); |
| std::string u = IMMEDIATE(copy(u_value)); |
| std::string rs3 = GPR(decode_gpr_gpr3(rs3_value)); |
| |
| return img::format("LBU %s, %s(%s)", rt3, u, rs3); |
| } |
| |
| |
| /* |
| * |
| * |
| * 3 2 1 |
| * 10987654321098765432109876543210 |
| * 001000 x1110000101 |
| * rt ----- |
| * rs ----- |
| * rd ----- |
| */ |
| std::string NMD::LBU_GP_(uint64 instruction) |
| { |
| uint64 rt_value = extract_rt_25_24_23_22_21(instruction); |
| uint64 u_value = extract_u_17_to_0(instruction); |
| |
| std::string rt = GPR(copy(rt_value)); |
| std::string u = IMMEDIATE(copy(u_value)); |
| |
| return img::format("LBU %s, %s($%d)", rt, u, 28); |
| } |
| |
| |
| /* |
| * |
| * |
| * 3 2 1 |
| * 10987654321098765432109876543210 |
| * 001000 x1110000101 |
| * rt ----- |
| * rs ----- |
| * rd ----- |
| */ |
| std::string NMD::LBU_S9_(uint64 instruction) |
| { |
| uint64 rt_value = extract_rt_25_24_23_22_21(instruction); |
| uint64 rs_value = extract_rs_20_19_18_17_16(instruction); |
| int64 s_value = extract_s__se8_15_7_6_5_4_3_2_1_0(instruction); |
| |
| std::string rt = GPR(copy(rt_value)); |
| std::string s = IMMEDIATE(copy(s_value)); |
| std::string rs = GPR(copy(rs_value)); |
| |
| return img::format("LBU %s, %s(%s)", rt, s, rs); |
| } |
| |
| |
| /* |
| * |
| * |
| * 3 2 1 |
| * 10987654321098765432109876543210 |
| * 001000 x1110000101 |
| * rt ----- |
| * rs ----- |
| * rd ----- |
| */ |
| std::string NMD::LBU_U12_(uint64 instruction) |
| { |
| uint64 rt_value = extract_rt_25_24_23_22_21(instruction); |
| uint64 rs_value = extract_rs_20_19_18_17_16(instruction); |
| uint64 u_value = extract_u_11_10_9_8_7_6_5_4_3_2_1_0(instruction); |
| |
| std::string rt = GPR(copy(rt_value)); |
| std::string u = IMMEDIATE(copy(u_value)); |
| std::string rs = GPR(copy(rs_value)); |
| |
| return img::format("LBU %s, %s(%s)", rt, u, rs); |
| } |
| |
| |
| /* |
| * |
| * |
| * 3 2 1 |
| * 10987654321098765432109876543210 |
| * 001000 x1110000101 |
| * rt ----- |
| * rs ----- |
| * rd ----- |
| */ |
| std::string NMD::LBUE(uint64 instruction) |
| { |
| uint64 rt_value = extract_rt_25_24_23_22_21(instruction); |
| uint64 rs_value = extract_rs_20_19_18_17_16(instruction); |
| int64 s_value = extract_s__se8_15_7_6_5_4_3_2_1_0(instruction); |
| |
| std::string rt = GPR(copy(rt_value)); |
| std::string s = IMMEDIATE(copy(s_value)); |
| std::string rs = GPR(copy(rs_value)); |
| |
| return img::format("LBUE %s, %s(%s)", rt, s, rs); |
| } |
| |
| |
| /* |
| * |
| * |
| * 3 2 1 |
| * 10987654321098765432109876543210 |
| * 001000 x1110000101 |
| * rt ----- |
| * rs ----- |
| * rd ----- |
| */ |
| std::string NMD::LBUX(uint64 instruction) |
| { |
| uint64 rt_value = extract_rt_25_24_23_22_21(instruction); |
| uint64 rs_value = extract_rs_20_19_18_17_16(instruction); |
| uint64 rd_value = extract_rd_15_14_13_12_11(instruction); |
| |
| std::string rd = GPR(copy(rd_value)); |
| std::string rs = GPR(copy(rs_value)); |
| std::string rt = GPR(copy(rt_value)); |
| |
| return img::format("LBUX %s, %s(%s)", rd, rs, rt); |
| } |
| |
| |
| /* |
| * |
| * |
| * 3 2 1 |
| * 10987654321098765432109876543210 |
| * 001000 x1110000101 |
| * rt ----- |
| * rs ----- |
| * rd ----- |
| */ |
| std::string NMD::LBX(uint64 instruction) |
| { |
| uint64 rt_value = extract_rt_25_24_23_22_21(instruction); |
| uint64 rs_value = extract_rs_20_19_18_17_16(instruction); |
| uint64 rd_value = extract_rd_15_14_13_12_11(instruction); |
| |
| std::string rd = GPR(copy(rd_value)); |
| std::string rs = GPR(copy(rs_value)); |
| std::string rt = GPR(copy(rt_value)); |
| |
| return img::format("LBX %s, %s(%s)", rd, rs, rt); |
| } |
| |
| |
| /* |
| * |
| * |
| * 3 2 1 |
| * 10987654321098765432109876543210 |
| * 001000 x1110000101 |
| * rt ----- |
| * rs ----- |
| * rd ----- |
| */ |
| std::string NMD::LD_GP_(uint64 instruction) |
| { |
| uint64 rt_value = extract_rt_25_24_23_22_21(instruction); |
| uint64 u_value = extract_u_20_to_3__s3(instruction); |
| |
| std::string rt = GPR(copy(rt_value)); |
| std::string u = IMMEDIATE(copy(u_value)); |
| |
| return img::format("LD %s, %s($%d)", rt, u, 28); |
| } |
| |
| |
| /* |
| * |
| * |
| * 3 2 1 |
| * 10987654321098765432109876543210 |
| * 001000 x1110000101 |
| * rt ----- |
| * rs ----- |
| * rd ----- |
| */ |
| std::string NMD::LD_S9_(uint64 instruction) |
| { |
| uint64 rt_value = extract_rt_25_24_23_22_21(instruction); |
| uint64 rs_value = extract_rs_20_19_18_17_16(instruction); |
| int64 s_value = extract_s__se8_15_7_6_5_4_3_2_1_0(instruction); |
| |
| std::string rt = GPR(copy(rt_value)); |
| std::string s = IMMEDIATE(copy(s_value)); |
| std::string rs = GPR(copy(rs_value)); |
| |
| return img::format("LD %s, %s(%s)", rt, s, rs); |
| } |
| |
| |
| /* |
| * |
| * |
| * 3 2 1 |
| * 10987654321098765432109876543210 |
| * 001000 x1110000101 |
| * rt ----- |
| * rs ----- |
| * rd ----- |
| */ |
| std::string NMD::LD_U12_(uint64 instruction) |
| { |
| uint64 rt_value = extract_rt_25_24_23_22_21(instruction); |
| uint64 rs_value = extract_rs_20_19_18_17_16(instruction); |
| uint64 u_value = extract_u_11_10_9_8_7_6_5_4_3_2_1_0(instruction); |
| |
| std::string rt = GPR(copy(rt_value)); |
| std::string u = IMMEDIATE(copy(u_value)); |
| std::string rs = GPR(copy(rs_value)); |
| |
| return img::format("LD %s, %s(%s)", rt, u, rs); |
| } |
| |
| |
| /* |
| * |
| * |
| * 3 2 1 |
| * 10987654321098765432109876543210 |
| * 001000 x1110000101 |
| * rt ----- |
| * rs ----- |
| * rd ----- |
| */ |
| std::string NMD::LDC1_GP_(uint64 instruction) |
| { |
| uint64 ft_value = extract_ft_25_24_23_22_21(instruction); |
| uint64 u_value = extract_u_17_to_2__s2(instruction); |
| |
| std::string ft = FPR(copy(ft_value)); |
| std::string u = IMMEDIATE(copy(u_value)); |
| |
| return img::format("LDC1 %s, %s($%d)", ft, u, 28); |
| } |
| |
| |
| /* |
| * |
| * |
| * 3 2 1 |
| * 10987654321098765432109876543210 |
| * 001000 x1110000101 |
| * rt ----- |
| * rs ----- |
| * rd ----- |
| */ |
| std::string NMD::LDC1_S9_(uint64 instruction) |
| { |
| uint64 ft_value = extract_ft_25_24_23_22_21(instruction); |
| uint64 rs_value = extract_rs_20_19_18_17_16(instruction); |
| int64 s_value = extract_s__se8_15_7_6_5_4_3_2_1_0(instruction); |
| |
| std::string ft = FPR(copy(ft_value)); |
| std::string s = IMMEDIATE(copy(s_value)); |
| std::string rs = GPR(copy(rs_value)); |
| |
| return img::format("LDC1 %s, %s(%s)", ft, s, rs); |
| } |
| |
| |
| /* |
| * |
| * |
| * 3 2 1 |
| * 10987654321098765432109876543210 |
| * 001000 x1110000101 |
| * rt ----- |
| * rs ----- |
| * rd ----- |
| */ |
| std::string NMD::LDC1_U12_(uint64 instruction) |
| { |
| uint64 ft_value = extract_ft_25_24_23_22_21(instruction); |
| uint64 rs_value = extract_rs_20_19_18_17_16(instruction); |
| uint64 u_value = extract_u_11_10_9_8_7_6_5_4_3_2_1_0(instruction); |
| |
| std::string ft = FPR(copy(ft_value)); |
| std::string u = IMMEDIATE(copy(u_value)); |
| std::string rs = GPR(copy(rs_value)); |
| |
| return img::format("LDC1 %s, %s(%s)", ft, u, rs); |
| } |
| |
| |
| /* |
| * |
| * |
| * 3 2 1 |
| * 10987654321098765432109876543210 |
| * 001000 x1110000101 |
| * rt ----- |
| * rs ----- |
| * rd ----- |
| */ |
| std::string NMD::LDC1XS(uint64 instruction) |
| { |
| uint64 rt_value = extract_rt_25_24_23_22_21(instruction); |
| uint64 rs_value = extract_rs_20_19_18_17_16(instruction); |
| uint64 ft_value = extract_ft_15_14_13_12_11(instruction); |
| |
| std::string ft = FPR(copy(ft_value)); |
| std::string rs = GPR(copy(rs_value)); |
| std::string rt = GPR(copy(rt_value)); |
| |
| return img::format("LDC1XS %s, %s(%s)", ft, rs, rt); |
| } |
| |
| |
| /* |
| * |
| * |
| * 3 2 1 |
| * 10987654321098765432109876543210 |
| * 001000 x1110000101 |
| * rt ----- |
| * rs ----- |
| * rd ----- |
| */ |
| std::string NMD::LDC1X(uint64 instruction) |
| { |
| uint64 rt_value = extract_rt_25_24_23_22_21(instruction); |
| uint64 rs_value = extract_rs_20_19_18_17_16(instruction); |
| uint64 ft_value = extract_ft_15_14_13_12_11(instruction); |
| |
| std::string ft = FPR(copy(ft_value)); |
| std::string rs = GPR(copy(rs_value)); |
| std::string rt = GPR(copy(rt_value)); |
| |
| return img::format("LDC1X %s, %s(%s)", ft, rs, rt); |
| } |
| |
| |
| /* |
| * |
| * |
| * 3 2 1 |
| * 10987654321098765432109876543210 |
| * 001000 x1110000101 |
| * rt ----- |
| * rs ----- |
| * rd ----- |
| */ |
| std::string NMD::LDC2(uint64 instruction) |
| { |
| uint64 ct_value = extract_ct_25_24_23_22_21(instruction); |
| uint64 rs_value = extract_rs_20_19_18_17_16(instruction); |
| int64 s_value = extract_s__se8_15_7_6_5_4_3_2_1_0(instruction); |
| |
| std::string ct = CPR(copy(ct_value)); |
| std::string s = IMMEDIATE(copy(s_value)); |
| std::string rs = GPR(copy(rs_value)); |
| |
| return img::format("LDC2 %s, %s(%s)", ct, s, rs); |
| } |
| |
| |
| /* |
| * |
| * |
| * 3 2 1 |
| * 10987654321098765432109876543210 |
| * 001000 x1110000101 |
| * rt ----- |
| * rs ----- |
| * rd ----- |
| */ |
| std::string NMD::LDM(uint64 instruction) |
| { |
| uint64 rt_value = extract_rt_25_24_23_22_21(instruction); |
| uint64 rs_value = extract_rs_20_19_18_17_16(instruction); |
| int64 s_value = extract_s__se8_15_7_6_5_4_3_2_1_0(instruction); |
| uint64 count3_value = extract_count3_14_13_12(instruction); |
| |
| std::string rt = GPR(copy(rt_value)); |
| std::string s = IMMEDIATE(copy(s_value)); |
| std::string rs = GPR(copy(rs_value)); |
| std::string count3 = IMMEDIATE(encode_count3_from_count(count3_value)); |
| |
| return img::format("LDM %s, %s(%s), %s", rt, s, rs, count3); |
| } |
| |
| |
| /* |
| * |
| * |
| * 3 2 1 |
| * 10987654321098765432109876543210 |
| * 001000 x1110000101 |
| * rt ----- |
| * rs ----- |
| * rd ----- |
| */ |
| std::string NMD::LDPC_48_(uint64 instruction) |
| { |
| uint64 rt_value = extract_rt_41_40_39_38_37(instruction); |
| int64 s_value = extract_s__se31_15_to_0_31_to_16(instruction); |
| |
| std::string rt = GPR(copy(rt_value)); |
| std::string s = ADDRESS(encode_s_from_address(s_value), 6); |
| |
| return img::format("LDPC %s, %s", rt, s); |
| } |
| |
| |
| /* |
| * |
| * |
| * 3 2 1 |
| * 10987654321098765432109876543210 |
| * 001000 x1110000101 |
| * rt ----- |
| * rs ----- |
| * rd ----- |
| */ |
| std::string NMD::LDX(uint64 instruction) |
| { |
| uint64 rt_value = extract_rt_25_24_23_22_21(instruction); |
| uint64 rs_value = extract_rs_20_19_18_17_16(instruction); |
| uint64 rd_value = extract_rd_15_14_13_12_11(instruction); |
| |
| std::string rd = GPR(copy(rd_value)); |
| std::string rs = GPR(copy(rs_value)); |
| std::string rt = GPR(copy(rt_value)); |
| |
| return img::format("LDX %s, %s(%s)", rd, rs, rt); |
| } |
| |
| |
| /* |
| * |
| * |
| * 3 2 1 |
| * 10987654321098765432109876543210 |
| * 001000 x1110000101 |
| * rt ----- |
| * rs ----- |
| * rd ----- |
| */ |
| std::string NMD::LDXS(uint64 instruction) |
| { |
| uint64 rt_value = extract_rt_25_24_23_22_21(instruction); |
| uint64 rs_value = extract_rs_20_19_18_17_16(instruction); |
| uint64 rd_value = extract_rd_15_14_13_12_11(instruction); |
| |
| std::string rd = GPR(copy(rd_value)); |
| std::string rs = GPR(copy(rs_value)); |
| std::string rt = GPR(copy(rt_value)); |
| |
| return img::format("LDXS %s, %s(%s)", rd, rs, rt); |
| } |
| |
| |
| /* |
| * |
| * |
| * 3 2 1 |
| * 10987654321098765432109876543210 |
| * 001000 x1110000101 |
| * rt ----- |
| * rs ----- |
| * rd ----- |
| */ |
| std::string NMD::LH_16_(uint64 instruction) |
| { |
| uint64 rt3_value = extract_rt3_9_8_7(instruction); |
| uint64 rs3_value = extract_rs3_6_5_4(instruction); |
| uint64 u_value = extract_u_2_1__s1(instruction); |
| |
| std::string rt3 = GPR(decode_gpr_gpr3(rt3_value)); |
| std::string u = IMMEDIATE(copy(u_value)); |
| std::string rs3 = GPR(decode_gpr_gpr3(rs3_value)); |
| |
| return img::format("LH %s, %s(%s)", rt3, u, rs3); |
| } |
| |
| |
| /* |
| * |
| * |
| * 3 2 1 |
| * 10987654321098765432109876543210 |
| * 001000 x1110000101 |
| * rt ----- |
| * rs ----- |
| * rd ----- |
| */ |
| std::string NMD::LH_GP_(uint64 instruction) |
| { |
| uint64 rt_value = extract_rt_25_24_23_22_21(instruction); |
| uint64 u_value = extract_u_17_to_1__s1(instruction); |
| |
| std::string rt = GPR(copy(rt_value)); |
| std::string u = IMMEDIATE(copy(u_value)); |
| |
| return img::format("LH %s, %s($%d)", rt, u, 28); |
| } |
| |
| |
| /* |
| * |
| * |
| * 3 2 1 |
| * 10987654321098765432109876543210 |
| * 001000 x1110000101 |
| * rt ----- |
| * rs ----- |
| * rd ----- |
| */ |
| std::string NMD::LH_S9_(uint64 instruction) |
| { |
| uint64 rt_value = extract_rt_25_24_23_22_21(instruction); |
| uint64 rs_value = extract_rs_20_19_18_17_16(instruction); |
| int64 s_value = extract_s__se8_15_7_6_5_4_3_2_1_0(instruction); |
| |
| std::string rt = GPR(copy(rt_value)); |
| std::string s = IMMEDIATE(copy(s_value)); |
| std::string rs = GPR(copy(rs_value)); |
| |
| return img::format("LH %s, %s(%s)", rt, s, rs); |
| } |
| |
| |
| /* |
| * |
| * |
| * 3 2 1 |
| * 10987654321098765432109876543210 |
| * 001000 x1110000101 |
| * rt ----- |
| * rs ----- |
| * rd ----- |
| */ |
| std::string NMD::LH_U12_(uint64 instruction) |
| { |
| uint64 rt_value = extract_rt_25_24_23_22_21(instruction); |
| uint64 rs_value = extract_rs_20_19_18_17_16(instruction); |
| uint64 u_value = extract_u_11_10_9_8_7_6_5_4_3_2_1_0(instruction); |
| |
| std::string rt = GPR(copy(rt_value)); |
| std::string u = IMMEDIATE(copy(u_value)); |
| std::string rs = GPR(copy(rs_value)); |
| |
| return img::format("LH %s, %s(%s)", rt, u, rs); |
| } |
| |
| |
| /* |
| * |
| * |
| * 3 2 1 |
| * 10987654321098765432109876543210 |
| * 001000 x1110000101 |
| * rt ----- |
| * rs ----- |
| * rd ----- |
| */ |
| std::string NMD::LHE(uint64 instruction) |
| { |
| uint64 rt_value = extract_rt_25_24_23_22_21(instruction); |
| uint64 rs_value = extract_rs_20_19_18_17_16(instruction); |
| int64 s_value = extract_s__se8_15_7_6_5_4_3_2_1_0(instruction); |
| |
| std::string rt = GPR(copy(rt_value)); |
| std::string s = IMMEDIATE(copy(s_value)); |
| std::string rs = GPR(copy(rs_value)); |
| |
| return img::format("LHE %s, %s(%s)", rt, s, rs); |
| } |
| |
| |
| /* |
| * |
| * |
| * 3 2 1 |
| * 10987654321098765432109876543210 |
| * 001000 x1110000101 |
| * rt ----- |
| * rs ----- |
| * rd ----- |
| */ |
| std::string NMD::LHU_16_(uint64 instruction) |
| { |
| uint64 rt3_value = extract_rt3_9_8_7(instruction); |
| uint64 rs3_value = extract_rs3_6_5_4(instruction); |
| uint64 u_value = extract_u_2_1__s1(instruction); |
| |
| std::string rt3 = GPR(decode_gpr_gpr3(rt3_value)); |
| std::string u = IMMEDIATE(copy(u_value)); |
| std::string rs3 = GPR(decode_gpr_gpr3(rs3_value)); |
| |
| return img::format("LHU %s, %s(%s)", rt3, u, rs3); |
| } |
| |
| |
| /* |
| * |
| * |
| * 3 2 1 |
| * 10987654321098765432109876543210 |
| * 001000 x1110000101 |
| * rt ----- |
| * rs ----- |
| * rd ----- |
| */ |
| std::string NMD::LHU_GP_(uint64 instruction) |
| { |
| uint64 rt_value = extract_rt_25_24_23_22_21(instruction); |
| uint64 u_value = extract_u_17_to_1__s1(instruction); |
| |
| std::string rt = GPR(copy(rt_value)); |
| std::string u = IMMEDIATE(copy(u_value)); |
| |
| return img::format("LHU %s, %s($%d)", rt, u, 28); |
| } |
| |
| |
| /* |
| * |
| * |
| * 3 2 1 |
| * 10987654321098765432109876543210 |
| * 001000 x1110000101 |
| * rt ----- |
| * rs ----- |
| * rd ----- |
| */ |
| std::string NMD::LHU_S9_(uint64 instruction) |
| { |
| uint64 rt_value = extract_rt_25_24_23_22_21(instruction); |
| uint64 rs_value = extract_rs_20_19_18_17_16(instruction); |
| int64 s_value = extract_s__se8_15_7_6_5_4_3_2_1_0(instruction); |
| |
| std::string rt = GPR(copy(rt_value)); |
| std::string s = IMMEDIATE(copy(s_value)); |
| std::string rs = GPR(copy(rs_value)); |
| |
| return img::format("LHU %s, %s(%s)", rt, s, rs); |
| } |
| |
| |
| /* |
| * |
| * |
| * 3 2 1 |
| * 10987654321098765432109876543210 |
| * 001000 x1110000101 |
| * rt ----- |
| * rs ----- |
| * rd ----- |
| */ |
| std::string NMD::LHU_U12_(uint64 instruction) |
| { |
| uint64 rt_value = extract_rt_25_24_23_22_21(instruction); |
| uint64 rs_value = extract_rs_20_19_18_17_16(instruction); |
| uint64 u_value = extract_u_11_10_9_8_7_6_5_4_3_2_1_0(instruction); |
| |
| std::string rt = GPR(copy(rt_value)); |
| std::string u = IMMEDIATE(copy(u_value)); |
| std::string rs = GPR(copy(rs_value)); |
| |
| return img::format("LHU %s, %s(%s)", rt, u, rs); |
| } |
| |
| |
| /* |
| * |
| * |
| * 3 2 1 |
| * 10987654321098765432109876543210 |
| * 001000 x1110000101 |
| * rt ----- |
| * rs ----- |
| * rd ----- |
| */ |
| std::string NMD::LHUE(uint64 instruction) |
| { |
| uint64 rt_value = extract_rt_25_24_23_22_21(instruction); |
| uint64 rs_value = extract_rs_20_19_18_17_16(instruction); |
| int64 s_value = extract_s__se8_15_7_6_5_4_3_2_1_0(instruction); |
| |
| std::string rt = GPR(copy(rt_value)); |
| std::string s = IMMEDIATE(copy(s_value)); |
| std::string rs = GPR(copy(rs_value)); |
| |
| return img::format("LHUE %s, %s(%s)", rt, s, rs); |
| } |
| |
| |
| /* |
| * |
| * |
| * 3 2 1 |
| * 10987654321098765432109876543210 |
| * 001000 x1110000101 |
| * rt ----- |
| * rs ----- |
| * rd ----- |
| */ |
| std::string NMD::LHUX(uint64 instruction) |
| { |
| uint64 rt_value = extract_rt_25_24_23_22_21(instruction); |
| uint64 rs_value = extract_rs_20_19_18_17_16(instruction); |
| uint64 rd_value = extract_rd_15_14_13_12_11(instruction); |
| |
| std::string rd = GPR(copy(rd_value)); |
| std::string rs = GPR(copy(rs_value)); |
| std::string rt = GPR(copy(rt_value)); |
| |
| return img::format("LHUX %s, %s(%s)", rd, rs, rt); |
| } |
| |
| |
| /* |
| * |
| * |
| * 3 2 1 |
| * 10987654321098765432109876543210 |
| * 001000 x1110000101 |
| * rt ----- |
| * rs ----- |
| * rd ----- |
| */ |
| std::string NMD::LHUXS(uint64 instruction) |
| { |
| uint64 rt_value = extract_rt_25_24_23_22_21(instruction); |
| uint64 rs_value = extract_rs_20_19_18_17_16(instruction); |
| uint64 rd_value = extract_rd_15_14_13_12_11(instruction); |
| |
| std::string rd = GPR(copy(rd_value)); |
| std::string rs = GPR(copy(rs_value)); |
| std::string rt = GPR(copy(rt_value)); |
| |
| return img::format("LHUXS %s, %s(%s)", rd, rs, rt); |
| } |
| |
| |
| /* |
| * |
| * |
| * 3 2 1 |
| * 10987654321098765432109876543210 |
| * 001000 x1110000101 |
| * rt ----- |
| * rs ----- |
| * rd ----- |
| */ |
| std::string NMD::LHXS(uint64 instruction) |
| { |
| uint64 rt_value = extract_rt_25_24_23_22_21(instruction); |
| uint64 rs_value = extract_rs_20_19_18_17_16(instruction); |
| uint64 rd_value = extract_rd_15_14_13_12_11(instruction); |
| |
| std::string rd = GPR(copy(rd_value)); |
| std::string rs = GPR(copy(rs_value)); |
| std::string rt = GPR(copy(rt_value)); |
| |
| return img::format("LHXS %s, %s(%s)", rd, rs, rt); |
| } |
| |
| |
| /* |
| * |
| * |
| * 3 2 1 |
| * 10987654321098765432109876543210 |
| * 001000 x1110000101 |
| * rt ----- |
| * rs ----- |
| * rd ----- |
| */ |
| std::string NMD::LHX(uint64 instruction) |
| { |
| uint64 rt_value = extract_rt_25_24_23_22_21(instruction); |
| uint64 rs_value = extract_rs_20_19_18_17_16(instruction); |
| uint64 rd_value = extract_rd_15_14_13_12_11(instruction); |
| |
| std::string rd = GPR(copy(rd_value)); |
| std::string rs = GPR(copy(rs_value)); |
| std::string rt = GPR(copy(rt_value)); |
| |
| return img::format("LHX %s, %s(%s)", rd, rs, rt); |
| } |
| |
| |
| /* |
| * |
| * |
| * 3 2 1 |
| * 10987654321098765432109876543210 |
| * 001000 x1110000101 |
| * rt ----- |
| * rs ----- |
| * rd ----- |
| */ |
| std::string NMD::LI_16_(uint64 instruction) |
| { |
| uint64 rt3_value = extract_rt3_9_8_7(instruction); |
| uint64 eu_value = extract_eu_6_5_4_3_2_1_0(instruction); |
| |
| std::string rt3 = GPR(decode_gpr_gpr3(rt3_value)); |
| std::string eu = IMMEDIATE(encode_eu_from_s_li16(eu_value)); |
| |
| return img::format("LI %s, %s", rt3, eu); |
| } |
| |
| |
| /* |
| * |
| * |
| * 3 2 1 |
| * 10987654321098765432109876543210 |
| * 001000 x1110000101 |
| * rt ----- |
| * rs ----- |
| * rd ----- |
| */ |
| std::string NMD::LI_48_(uint64 instruction) |
| { |
| uint64 rt_value = extract_rt_41_40_39_38_37(instruction); |
| int64 s_value = extract_s__se31_15_to_0_31_to_16(instruction); |
| |
| std::string rt = GPR(copy(rt_value)); |
| std::string s = IMMEDIATE(copy(s_value)); |
| |
| return img::format("LI %s, %s", rt, s); |
| } |
| |
| |
| /* |
| * |
| * |
| * 3 2 1 |
| * 10987654321098765432109876543210 |
| * 001000 x1110000101 |
| * rt ----- |
| * rs ----- |
| * rd ----- |
| */ |
| std::string NMD::LL(uint64 instruction) |
| { |
| uint64 rt_value = extract_rt_25_24_23_22_21(instruction); |
| uint64 rs_value = extract_rs_20_19_18_17_16(instruction); |
| int64 s_value = extract_s__se8_15_7_6_5_4_3_2_s2(instruction); |
| |
| std::string rt = GPR(copy(rt_value)); |
| std::string s = IMMEDIATE(copy(s_value)); |
| std::string rs = GPR(copy(rs_value)); |
| |
| return img::format("LL %s, %s(%s)", rt, s, rs); |
| } |
| |
| |
| /* |
| * |
| * |
| * 3 2 1 |
| * 10987654321098765432109876543210 |
| * 001000 x1110000101 |
| * rt ----- |
| * rs ----- |
| * rd ----- |
| */ |
| std::string NMD::LLD(uint64 instruction) |
| { |
| uint64 rt_value = extract_rt_25_24_23_22_21(instruction); |
| uint64 rs_value = extract_rs_20_19_18_17_16(instruction); |
| int64 s_value = extract_s__se8_15_7_6_5_4_3_s3(instruction); |
| |
| std::string rt = GPR(copy(rt_value)); |
| std::string s = IMMEDIATE(copy(s_value)); |
| std::string rs = GPR(copy(rs_value)); |
| |
| return img::format("LLD %s, %s(%s)", rt, s, rs); |
| } |
| |
| |
| /* |
| * |
| * |
| * 3 2 1 |
| * 10987654321098765432109876543210 |
| * 001000 x1110000101 |
| * rt ----- |
| * rs ----- |
| * rd ----- |
| */ |
| std::string NMD::LLDP(uint64 instruction) |
| { |
| uint64 rt_value = extract_rt_25_24_23_22_21(instruction); |
| uint64 rs_value = extract_rs_20_19_18_17_16(instruction); |
| uint64 ru_value = extract_ru_7_6_5_4_3(instruction); |
| |
| std::string rt = GPR(copy(rt_value)); |
| std::string ru = GPR(copy(ru_value)); |
| std::string rs = GPR(copy(rs_value)); |
| |
| return img::format("LLDP %s, %s, (%s)", rt, ru, rs); |
| } |
| |
| |
| /* |
| * |
| * |
| * 3 2 1 |
| * 10987654321098765432109876543210 |
| * 001000 x1110000101 |
| * rt ----- |
| * rs ----- |
| * rd ----- |
| */ |
| std::string NMD::LLE(uint64 instruction) |
| { |
| uint64 rt_value = extract_rt_25_24_23_22_21(instruction); |
| uint64 rs_value = extract_rs_20_19_18_17_16(instruction); |
| int64 s_value = extract_s__se8_15_7_6_5_4_3_2_s2(instruction); |
| |
| std::string rt = GPR(copy(rt_value)); |
| std::string s = IMMEDIATE(copy(s_value)); |
| std::string rs = GPR(copy(rs_value)); |
| |
| return img::format("LLE %s, %s(%s)", rt, s, rs); |
| } |
| |
| |
| /* |
| * |
| * |
| * 3 2 1 |
| * 10987654321098765432109876543210 |
| * 001000 x1110000101 |
| * rt ----- |
| * rs ----- |
| * rd ----- |
| */ |
| std::string NMD::LLWP(uint64 instruction) |
| { |
| uint64 rt_value = extract_rt_25_24_23_22_21(instruction); |
| uint64 rs_value = extract_rs_20_19_18_17_16(instruction); |
| uint64 ru_value = extract_ru_7_6_5_4_3(instruction); |
| |
| std::string rt = GPR(copy(rt_value)); |
| std::string ru = GPR(copy(ru_value)); |
| std::string rs = GPR(copy(rs_value)); |
| |
| return img::format("LLWP %s, %s, (%s)", rt, ru, rs); |
| } |
| |
| |
| /* |
| * |
| * |
| * 3 2 1 |
| * 10987654321098765432109876543210 |
| * 001000 x1110000101 |
| * rt ----- |
| * rs ----- |
| * rd ----- |
| */ |
| std::string NMD::LLWPE(uint64 instruction) |
| { |
| uint64 rt_value = extract_rt_25_24_23_22_21(instruction); |
| uint64 rs_value = extract_rs_20_19_18_17_16(instruction); |
| uint64 ru_value = extract_ru_7_6_5_4_3(instruction); |
| |
| std::string rt = GPR(copy(rt_value)); |
| std::string ru = GPR(copy(ru_value)); |
| std::string rs = GPR(copy(rs_value)); |
| |
| return img::format("LLWPE %s, %s, (%s)", rt, ru, rs); |
| } |
| |
| |
| /* |
| * |
| * |
| * 3 2 1 |
| * 10987654321098765432109876543210 |
| * 001000 x1110000101 |
| * rt ----- |
| * rs ----- |
| * rd ----- |
| */ |
| std::string NMD::LSA(uint64 instruction) |
| { |
| uint64 rt_value = extract_rt_25_24_23_22_21(instruction); |
| uint64 rs_value = extract_rs_20_19_18_17_16(instruction); |
| uint64 rd_value = extract_rd_15_14_13_12_11(instruction); |
| uint64 u2_value = extract_u2_10_9(instruction); |
| |
| std::string rd = GPR(copy(rd_value)); |
| std::string rs = GPR(copy(rs_value)); |
| std::string rt = GPR(copy(rt_value)); |
| std::string u2 = IMMEDIATE(copy(u2_value)); |
| |
| return img::format("LSA %s, %s, %s, %s", rd, rs, rt, u2); |
| } |
| |
| |
| /* |
| * |
| * |
| * 3 2 1 |
| * 10987654321098765432109876543210 |
| * 001000 x1110000101 |
| * rt ----- |
| * rs ----- |
| * rd ----- |
| */ |
| std::string NMD::LUI(uint64 instruction) |
| { |
| uint64 rt_value = extract_rt_25_24_23_22_21(instruction); |
| int64 s_value = extract_s__se31_0_11_to_2_20_to_12_s12(instruction); |
| |
| std::string rt = GPR(copy(rt_value)); |
| std::string s = IMMEDIATE(copy(s_value)); |
| |
| return img::format("LUI %s, %%hi(%s)", rt, s); |
| } |
| |
| |
| /* |
| * |
| * |
| * 3 2 1 |
| * 10987654321098765432109876543210 |
| * 001000 x1110000101 |
| * rt ----- |
| * rs ----- |
| * rd ----- |
| */ |
| std::string NMD::LW_16_(uint64 instruction) |
| { |
| uint64 rt3_value = extract_rt3_9_8_7(instruction); |
| uint64 rs3_value = extract_rs3_6_5_4(instruction); |
| uint64 u_value = extract_u_3_2_1_0__s2(instruction); |
| |
| std::string rt3 = GPR(decode_gpr_gpr3(rt3_value)); |
| std::string u = IMMEDIATE(copy(u_value)); |
| std::string rs3 = GPR(decode_gpr_gpr3(rs3_value)); |
| |
| return img::format("LW %s, %s(%s)", rt3, u, rs3); |
| } |
| |
| |
| /* |
| * |
| * |
| * 3 2 1 |
| * 10987654321098765432109876543210 |
| * 001000 x1110000101 |
| * rt ----- |
| * rs ----- |
| * rd ----- |
| */ |
| std::string NMD::LW_4X4_(uint64 instruction) |
| { |
| uint64 rt4_value = extract_rt4_9_7_6_5(instruction); |
| uint64 rs4_value = extract_rs4_4_2_1_0(instruction); |
| uint64 u_value = extract_u_3_8__s2(instruction); |
| |
| std::string rt4 = GPR(decode_gpr_gpr4(rt4_value)); |
| std::string u = IMMEDIATE(copy(u_value)); |
| std::string rs4 = GPR(decode_gpr_gpr4(rs4_value)); |
| |
| return img::format("LW %s, %s(%s)", rt4, u, rs4); |
| } |
| |
| |
| /* |
| * |
| * |
| * 3 2 1 |
| * 10987654321098765432109876543210 |
| * 001000 x1110000101 |
| * rt ----- |
| * rs ----- |
| * rd ----- |
| */ |
| std::string NMD::LW_GP_(uint64 instruction) |
| { |
| uint64 rt_value = extract_rt_25_24_23_22_21(instruction); |
| uint64 u_value = extract_u_20_to_2__s2(instruction); |
| |
| std::string rt = GPR(copy(rt_value)); |
| std::string u = IMMEDIATE(copy(u_value)); |
| |
| return img::format("LW %s, %s($%d)", rt, u, 28); |
| } |
| |
| |
| /* |
| * |
| * |
| * 3 2 1 |
| * 10987654321098765432109876543210 |
| * 001000 x1110000101 |
| * rt ----- |
| * rs ----- |
| * rd ----- |
| */ |
| std::string NMD::LW_GP16_(uint64 instruction) |
| { |
| uint64 rt3_value = extract_rt3_9_8_7(instruction); |
| uint64 u_value = extract_u_6_5_4_3_2_1_0__s2(instruction); |
| |
| std::string rt3 = GPR(decode_gpr_gpr3(rt3_value)); |
| std::string u = IMMEDIATE(copy(u_value)); |
| |
| return img::format("LW %s, %s($%d)", rt3, u, 28); |
| } |
| |
| |
| /* |
| * |
| * |
| * 3 2 1 |
| * 10987654321098765432109876543210 |
| * 001000 x1110000101 |
| * rt ----- |
| * rs ----- |
| * rd ----- |
| */ |
| std::string NMD::LW_S9_(uint64 instruction) |
| { |
| uint64 rt_value = extract_rt_25_24_23_22_21(instruction); |
| uint64 rs_value = extract_rs_20_19_18_17_16(instruction); |
| int64 s_value = extract_s__se8_15_7_6_5_4_3_2_1_0(instruction); |
| |
| std::string rt = GPR(copy(rt_value)); |
| std::string s = IMMEDIATE(copy(s_value)); |
| std::string rs = GPR(copy(rs_value)); |
| |
| return img::format("LW %s, %s(%s)", rt, s, rs); |
| } |
| |
| |
| /* |
| * |
| * |
| * 3 2 1 |
| * 10987654321098765432109876543210 |
| * 001000 x1110000101 |
| * rt ----- |
| * rs ----- |
| * rd ----- |
| */ |
| std::string NMD::LW_SP_(uint64 instruction) |
| { |
| uint64 rt_value = extract_rt_9_8_7_6_5(instruction); |
| uint64 u_value = extract_u_4_3_2_1_0__s2(instruction); |
| |
| std::string rt = GPR(copy(rt_value)); |
| std::string u = IMMEDIATE(copy(u_value)); |
| |
| return img::format("LW %s, %s($%d)", rt, u, 29); |
| } |
| |
| |
| /* |
| * |
| * |
| * 3 2 1 |
| * 10987654321098765432109876543210 |
| * 001000 x1110000101 |
| * rt ----- |
| * rs ----- |
| * rd ----- |
| */ |
| std::string NMD::LW_U12_(uint64 instruction) |
| { |
| uint64 rt_value = extract_rt_25_24_23_22_21(instruction); |
| uint64 rs_value = extract_rs_20_19_18_17_16(instruction); |
| uint64 u_value = extract_u_11_10_9_8_7_6_5_4_3_2_1_0(instruction); |
| |
| std::string rt = GPR(copy(rt_value)); |
| std::string u = IMMEDIATE(copy(u_value)); |
| std::string rs = GPR(copy(rs_value)); |
| |
| return img::format("LW %s, %s(%s)", rt, u, rs); |
| } |
| |
| |
| /* |
| * |
| * |
| * 3 2 1 |
| * 10987654321098765432109876543210 |
| * 001000 x1110000101 |
| * rt ----- |
| * rs ----- |
| * rd ----- |
| */ |
| std::string NMD::LWC1_GP_(uint64 instruction) |
| { |
| uint64 ft_value = extract_ft_25_24_23_22_21(instruction); |
| uint64 u_value = extract_u_17_to_2__s2(instruction); |
| |
| std::string ft = FPR(copy(ft_value)); |
| std::string u = IMMEDIATE(copy(u_value)); |
| |
| return img::format("LWC1 %s, %s($%d)", ft, u, 28); |
| } |
| |
| |
| /* |
| * |
| * |
| * 3 2 1 |
| * 10987654321098765432109876543210 |
| * 001000 x1110000101 |
| * rt ----- |
| * rs ----- |
| * rd ----- |
| */ |
| std::string NMD::LWC1_S9_(uint64 instruction) |
| { |
| uint64 ft_value = extract_ft_25_24_23_22_21(instruction); |
| uint64 rs_value = extract_rs_20_19_18_17_16(instruction); |
| int64 s_value = extract_s__se8_15_7_6_5_4_3_2_1_0(instruction); |
| |
| std::string ft = FPR(copy(ft_value)); |
| std::string s = IMMEDIATE(copy(s_value)); |
| std::string rs = GPR(copy(rs_value)); |
| |
| return img::format("LWC1 %s, %s(%s)", ft, s, rs); |
| } |
| |
| |
| /* |
| * |
| * |
| * 3 2 1 |
| * 10987654321098765432109876543210 |
| * 001000 x1110000101 |
| * rt ----- |
| * rs ----- |
| * rd ----- |
| */ |
| std::string NMD::LWC1_U12_(uint64 instruction) |
| { |
| uint64 ft_value = extract_ft_25_24_23_22_21(instruction); |
| uint64 rs_value = extract_rs_20_19_18_17_16(instruction); |
| uint64 u_value = extract_u_11_10_9_8_7_6_5_4_3_2_1_0(instruction); |
| |
| std::string ft = FPR(copy(ft_value)); |
| std::string u = IMMEDIATE(copy(u_value)); |
| std::string rs = GPR(copy(rs_value)); |
| |
| return img::format("LWC1 %s, %s(%s)", ft, u, rs); |
| } |
| |
| |
| /* |
| * |
| * |
| * 3 2 1 |
| * 10987654321098765432109876543210 |
| * 001000 x1110000101 |
| * rt ----- |
| * rs ----- |
| * rd ----- |
| */ |
| std::string NMD::LWC1X(uint64 instruction) |
| { |
| uint64 rt_value = extract_rt_25_24_23_22_21(instruction); |
| uint64 rs_value = extract_rs_20_19_18_17_16(instruction); |
| uint64 ft_value = extract_ft_15_14_13_12_11(instruction); |
| |
| std::string ft = FPR(copy(ft_value)); |
| std::string rs = GPR(copy(rs_value)); |
| std::string rt = GPR(copy(rt_value)); |
| |
| return img::format("LWC1X %s, %s(%s)", ft, rs, rt); |
| } |
| |
| |
| /* |
| * |
| * |
| * 3 2 1 |
| * 10987654321098765432109876543210 |
| * 001000 x1110000101 |
| * rt ----- |
| * rs ----- |
| * rd ----- |
| */ |
| std::string NMD::LWC1XS(uint64 instruction) |
| { |
| uint64 rt_value = extract_rt_25_24_23_22_21(instruction); |
| uint64 rs_value = extract_rs_20_19_18_17_16(instruction); |
| uint64 ft_value = extract_ft_15_14_13_12_11(instruction); |
| |
| std::string ft = FPR(copy(ft_value)); |
| std::string rs = GPR(copy(rs_value)); |
| std::string rt = GPR(copy(rt_value)); |
| |
| return img::format("LWC1XS %s, %s(%s)", ft, rs, rt); |
| } |
| |
| |
| /* |
| * |
| * |
| * 3 2 1 |
| * 10987654321098765432109876543210 |
| * 001000 x1110000101 |
| * rt ----- |
| * rs ----- |
| * rd ----- |
| */ |
| std::string NMD::LWC2(uint64 instruction) |
| { |
| uint64 ct_value = extract_ct_25_24_23_22_21(instruction); |
| uint64 rs_value = extract_rs_20_19_18_17_16(instruction); |
| int64 s_value = extract_s__se8_15_7_6_5_4_3_2_1_0(instruction); |
| |
| std::string ct = CPR(copy(ct_value)); |
| std::string s = IMMEDIATE(copy(s_value)); |
| std::string rs = GPR(copy(rs_value)); |
| |
| return img::format("LWC2 %s, %s(%s)", ct, s, rs); |
| } |
| |
| |
| /* |
| * |
| * |
| * 3 2 1 |
| * 10987654321098765432109876543210 |
| * 001000 x1110000101 |
| * rt ----- |
| * rs ----- |
| * rd ----- |
| */ |
| std::string NMD::LWE(uint64 instruction) |
| { |
| uint64 rt_value = extract_rt_25_24_23_22_21(instruction); |
| uint64 rs_value = extract_rs_20_19_18_17_16(instruction); |
| int64 s_value = extract_s__se8_15_7_6_5_4_3_2_1_0(instruction); |
| |
| std::string rt = GPR(copy(rt_value)); |
| std::string s = IMMEDIATE(copy(s_value)); |
| std::string rs = GPR(copy(rs_value)); |
| |
| return img::format("LWE %s, %s(%s)", rt, s, rs); |
| } |
| |
| |
| /* |
| * |
| * |
| * 3 2 1 |
| * 10987654321098765432109876543210 |
| * 001000 x1110000101 |
| * rt ----- |
| * rs ----- |
| * rd ----- |
| */ |
| std::string NMD::LWM(uint64 instruction) |
| { |
| uint64 rt_value = extract_rt_25_24_23_22_21(instruction); |
| uint64 rs_value = extract_rs_20_19_18_17_16(instruction); |
| int64 s_value = extract_s__se8_15_7_6_5_4_3_2_1_0(instruction); |
| uint64 count3_value = extract_count3_14_13_12(instruction); |
| |
| std::string rt = GPR(copy(rt_value)); |
| std::string s = IMMEDIATE(copy(s_value)); |
| std::string rs = GPR(copy(rs_value)); |
| std::string count3 = IMMEDIATE(encode_count3_from_count(count3_value)); |
| |
| return img::format("LWM %s, %s(%s), %s", rt, s, rs, count3); |
| } |
| |
| |
| /* |
| * |
| * |
| * 3 2 1 |
| * 10987654321098765432109876543210 |
| * 001000 x1110000101 |
| * rt ----- |
| * rs ----- |
| * rd ----- |
| */ |
| std::string NMD::LWPC_48_(uint64 instruction) |
| { |
| uint64 rt_value = extract_rt_41_40_39_38_37(instruction); |
| int64 s_value = extract_s__se31_15_to_0_31_to_16(instruction); |
| |
| std::string rt = GPR(copy(rt_value)); |
| std::string s = ADDRESS(encode_s_from_address(s_value), 6); |
| |
| return img::format("LWPC %s, %s", rt, s); |
| } |
| |
| |
| /* |
| * |
| * |
| * 3 2 1 |
| * 10987654321098765432109876543210 |
| * 001000 x1110000101 |
| * rt ----- |
| * rs ----- |
| * rd ----- |
| */ |
| std::string NMD::LWU_GP_(uint64 instruction) |
| { |
| uint64 rt_value = extract_rt_25_24_23_22_21(instruction); |
| uint64 u_value = extract_u_17_to_2__s2(instruction); |
| |
| std::string rt = GPR(copy(rt_value)); |
| std::string u = IMMEDIATE(copy(u_value)); |
| |
| return img::format("LWU %s, %s($%d)", rt, u, 28); |
| } |
| |
| |
| /* |
| * |
| * |
| * 3 2 1 |
| * 10987654321098765432109876543210 |
| * 001000 x1110000101 |
| * rt ----- |
| * rs ----- |
| * rd ----- |
| */ |
| std::string NMD::LWU_S9_(uint64 instruction) |
| { |
| uint64 rt_value = extract_rt_25_24_23_22_21(instruction); |
| uint64 rs_value = extract_rs_20_19_18_17_16(instruction); |
| int64 s_value = extract_s__se8_15_7_6_5_4_3_2_1_0(instruction); |
| |
| std::string rt = GPR(copy(rt_value)); |
| std::string s = IMMEDIATE(copy(s_value)); |
| std::string rs = GPR(copy(rs_value)); |
| |
| return img::format("LWU %s, %s(%s)", rt, s, rs); |
| } |
| |
| |
| /* |
| * |
| * |
| * 3 2 1 |
| * 10987654321098765432109876543210 |
| * 001000 x1110000101 |
| * rt ----- |
| * rs ----- |
| * rd ----- |
| */ |
| std::string NMD::LWU_U12_(uint64 instruction) |
| { |
| uint64 rt_value = extract_rt_25_24_23_22_21(instruction); |
| uint64 rs_value = extract_rs_20_19_18_17_16(instruction); |
| uint64 u_value = extract_u_11_10_9_8_7_6_5_4_3_2_1_0(instruction); |
| |
| std::string rt = GPR(copy(rt_value)); |
| std::string u = IMMEDIATE(copy(u_value)); |
| std::string rs = GPR(copy(rs_value)); |
| |
| return img::format("LWU %s, %s(%s)", rt, u, rs); |
| } |
| |
| |
| /* |
| * |
| * |
| * 3 2 1 |
| * 10987654321098765432109876543210 |
| * 001000 x1110000101 |
| * rt ----- |
| * rs ----- |
| * rd ----- |
| */ |
| std::string NMD::LWUX(uint64 instruction) |
| { |
| uint64 rt_value = extract_rt_25_24_23_22_21(instruction); |
| uint64 rs_value = extract_rs_20_19_18_17_16(instruction); |
| uint64 rd_value = extract_rd_15_14_13_12_11(instruction); |
| |
| std::string rd = GPR(copy(rd_value)); |
| std::string rs = GPR(copy(rs_value)); |
| std::string rt = GPR(copy(rt_value)); |
| |
| return img::format("LWUX %s, %s(%s)", rd, rs, rt); |
| } |
| |
| |
| /* |
| * |
| * |
| * 3 2 1 |
| * 10987654321098765432109876543210 |
| * 001000 x1110000101 |
| * rt ----- |
| * rs ----- |
| * rd ----- |
| */ |
| std::string NMD::LWUXS(uint64 instruction) |
| { |
| uint64 rt_value = extract_rt_25_24_23_22_21(instruction); |
| uint64 rs_value = extract_rs_20_19_18_17_16(instruction); |
| uint64 rd_value = extract_rd_15_14_13_12_11(instruction); |
| |
| std::string rd = GPR(copy(rd_value)); |
| std::string rs = GPR(copy(rs_value)); |
| std::string rt = GPR(copy(rt_value)); |
| |
| return img::format("LWUXS %s, %s(%s)", rd, rs, rt); |
| } |
| |
| |
| /* |
| * |
| * |
| * 3 2 1 |
| * 10987654321098765432109876543210 |
| * 001000 x1110000101 |
| * rt ----- |
| * rs ----- |
| * rd ----- |
| */ |
| std::string NMD::LWX(uint64 instruction) |
| { |
| uint64 rt_value = extract_rt_25_24_23_22_21(instruction); |
| uint64 rs_value = extract_rs_20_19_18_17_16(instruction); |
| uint64 rd_value = extract_rd_15_14_13_12_11(instruction); |
| |
| std::string rd = GPR(copy(rd_value)); |
| std::string rs = GPR(copy(rs_value)); |
| std::string rt = GPR(copy(rt_value)); |
| |
| return img::format("LWX %s, %s(%s)", rd, rs, rt); |
| } |
| |
| |
| /* |
| * |
| * |
| * 3 2 1 |
| * 10987654321098765432109876543210 |
| * 001000 x1110000101 |
| * rt ----- |
| * rs ----- |
| * rd ----- |
| */ |
| std::string NMD::LWXS_16_(uint64 instruction) |
| { |
| uint64 rt3_value = extract_rt3_9_8_7(instruction); |
| uint64 rs3_value = extract_rs3_6_5_4(instruction); |
| uint64 rd3_value = extract_rd3_3_2_1(instruction); |
| |
| std::string rd3 = GPR(decode_gpr_gpr3(rd3_value)); |
| std::string rs3 = GPR(decode_gpr_gpr3(rs3_value)); |
| std::string rt3 = IMMEDIATE(decode_gpr_gpr3(rt3_value)); |
| |
| return img::format("LWXS %s, %s(%s)", rd3, rs3, rt3); |
| } |
| |
| |
| /* |
| * |
| * |
| * 3 2 1 |
| * 10987654321098765432109876543210 |
| * 001000 x1110000101 |
| * rt ----- |
| * rs ----- |
| * rd ----- |
| */ |
| std::string NMD::LWXS_32_(uint64 instruction) |
| { |
| uint64 rt_value = extract_rt_25_24_23_22_21(instruction); |
| uint64 rs_value = extract_rs_20_19_18_17_16(instruction); |
| uint64 rd_value = extract_rd_15_14_13_12_11(instruction); |
| |
| std::string rd = GPR(copy(rd_value)); |
| std::string rs = GPR(copy(rs_value)); |
| std::string rt = GPR(copy(rt_value)); |
| |
| return img::format("LWXS %s, %s(%s)", rd, rs, rt); |
| } |
| |
| |
| /* |
| * [DSP] MADD ac, rs, rt - Multiply two words and add to the specified |
| * accumulator |
| * |
| * 3 2 1 |
| * 10987654321098765432109876543210 |
| * 001000 x1110000101 |
| * rt ----- |
| * rs ----- |
| * rd ----- |
| */ |
| std::string NMD::MADD_DSP_(uint64 instruction) |
| { |
| uint64 rt_value = extract_rt_25_24_23_22_21(instruction); |
| uint64 rs_value = extract_rs_20_19_18_17_16(instruction); |
| uint64 ac_value = extract_ac_15_14(instruction); |
| |
| std::string ac = AC(copy(ac_value)); |
| std::string rs = GPR(copy(rs_value)); |
| std::string rt = GPR(copy(rt_value)); |
| |
| return img::format("MADD %s, %s, %s", ac, rs, rt); |
| } |
| |
| |
| /* |
| * |
| * |
| * 3 2 1 |
| * 10987654321098765432109876543210 |
| * 001000 x1110000101 |
| * rt ----- |
| * rs ----- |
| * rd ----- |
| */ |
| std::string NMD::MADDF_D(uint64 instruction) |
| { |
| uint64 ft_value = extract_ft_25_24_23_22_21(instruction); |
| uint64 fs_value = extract_fs_20_19_18_17_16(instruction); |
| uint64 fd_value = extract_fd_15_14_13_12_11(instruction); |
| |
| std::string fd = FPR(copy(fd_value)); |
| std::string fs = FPR(copy(fs_value)); |
| std::string ft = FPR(copy(ft_value)); |
| |
| return img::format("MADDF.D %s, %s, %s", fd, fs, ft); |
| } |
| |
| |
| /* |
| * |
| * |
| * 3 2 1 |
| * 10987654321098765432109876543210 |
| * 001000 x1110000101 |
| * rt ----- |
| * rs ----- |
| * rd ----- |
| */ |
| std::string NMD::MADDF_S(uint64 instruction) |
| { |
| uint64 ft_value = extract_ft_25_24_23_22_21(instruction); |
| uint64 fs_value = extract_fs_20_19_18_17_16(instruction); |
| uint64 fd_value = extract_fd_15_14_13_12_11(instruction); |
| |
| std::string fd = FPR(copy(fd_value)); |
| std::string fs = FPR(copy(fs_value)); |
| std::string ft = FPR(copy(ft_value)); |
| |
| return img::format("MADDF.S %s, %s, %s", fd, fs, ft); |
| } |
| |
| |
| /* |
| * [DSP] MADDU ac, rs, rt - Multiply two unsigned words and add to the |
| * specified accumulator |
| * |
| * 3 2 1 |
| * 10987654321098765432109876543210 |
| * 001000 x1110000101 |
| * rt ----- |
| * rs ----- |
| * rd ----- |
| */ |
| std::string NMD::MADDU_DSP_(uint64 instruction) |
| { |
| uint64 rt_value = extract_rt_25_24_23_22_21(instruction); |
| uint64 rs_value = extract_rs_20_19_18_17_16(instruction); |
| uint64 ac_value = extract_ac_15_14(instruction); |
| |
| std::string ac = AC(copy(ac_value)); |
| std::string rs = GPR(copy(rs_value)); |
| std::string rt = GPR(copy(rt_value)); |
| |
| return img::format("MADDU %s, %s, %s", ac, rs, rt); |
| } |
| |
| |
| /* |
| * [DSP] MAQ_S.W.PHL ac, rs, rt - Multiply the left-most single vector |
| * fractional halfword elements with accumulation |
| * |
| * 3 2 1 |
| * 10987654321098765432109876543210 |
| * 001000 x1110000101 |
| * rt ----- |
| * rs ----- |
| * rd ----- |
| */ |
| std::string NMD::MAQ_S_W_PHL(uint64 instruction) |
| { |
| uint64 rt_value = extract_rt_25_24_23_22_21(instruction); |
| uint64 rs_value = extract_rs_20_19_18_17_16(instruction); |
| uint64 ac_value = extract_ac_15_14(instruction); |
| |
| std::string ac = AC(copy(ac_value)); |
| std::string rs = GPR(copy(rs_value)); |
| std::string rt = GPR(copy(rt_value)); |
| |
| return img::format("MAQ_S.W.PHL %s, %s, %s", ac, rs, rt); |
| } |
| |
| |
| /* |
| * [DSP] MAQ_S.W.PHR ac, rs, rt - Multiply the right-most single vector |
| * fractional halfword elements with accumulation |
| * |
| * 3 2 1 |
| * 10987654321098765432109876543210 |
| * 001000 x1110000101 |
| * rt ----- |
| * rs ----- |
| * rd ----- |
| */ |
| std::string NMD::MAQ_S_W_PHR(uint64 instruction) |
| { |
| uint64 rt_value = extract_rt_25_24_23_22_21(instruction); |
| uint64 rs_value = extract_rs_20_19_18_17_16(instruction); |
| uint64 ac_value = extract_ac_15_14(instruction); |
| |
| std::string ac = AC(copy(ac_value)); |
| std::string rs = GPR(copy(rs_value)); |
| std::string rt = GPR(copy(rt_value)); |
| |
| return img::format("MAQ_S.W.PHR %s, %s, %s", ac, rs, rt); |
| } |
| |
| |
| /* |
| * [DSP] MAQ_SA.W.PHL ac, rs, rt - Multiply the left-most single vector |
| * fractional halfword elements with saturating accumulation |
| * |
| * 3 2 1 |
| * 10987654321098765432109876543210 |
| * 001000 x1110000101 |
| * rt ----- |
| * rs ----- |
| * rd ----- |
| */ |
| std::string NMD::MAQ_SA_W_PHL(uint64 instruction) |
| { |
| uint64 rt_value = extract_rt_25_24_23_22_21(instruction); |
| uint64 rs_value = extract_rs_20_19_18_17_16(instruction); |
| uint64 ac_value = extract_ac_15_14(instruction); |
| |
| std::string ac = AC(copy(ac_value)); |
| std::string rs = GPR(copy(rs_value)); |
| std::string rt = GPR(copy(rt_value)); |
| |
| return img::format("MAQ_SA.W.PHL %s, %s, %s", ac, rs, rt); |
| } |
| |
| |
| /* |
| * [DSP] MAQ_SA.W.PHR ac, rs, rt - Multiply the right-most single vector |
| * fractional halfword elements with saturating accumulation |
| * |
| * 3 2 1 |
| * 10987654321098765432109876543210 |
| * 001000 x1110000101 |
| * rt ----- |
| * rs ----- |
| * rd ----- |
| */ |
| std::string NMD::MAQ_SA_W_PHR(uint64 instruction) |
| { |
| uint64 rt_value = extract_rt_25_24_23_22_21(instruction); |
| uint64 rs_value = extract_rs_20_19_18_17_16(instruction); |
| uint64 ac_value = extract_ac_15_14(instruction); |
| |
| std::string ac = AC(copy(ac_value)); |
| std::string rs = GPR(copy(rs_value)); |
| std::string rt = GPR(copy(rt_value)); |
| |
| return img::format("MAQ_SA.W.PHR %s, %s, %s", ac, rs, rt); |
| } |
| |
| |
| /* |
| * |
| * |
| * 3 2 1 |
| * 10987654321098765432109876543210 |
| * 001000 x1110000101 |
| * rt ----- |
| * rs ----- |
| * rd ----- |
| */ |
| std::string NMD::MAX_D(uint64 instruction) |
| { |
| uint64 ft_value = extract_ft_25_24_23_22_21(instruction); |
| uint64 fs_value = extract_fs_20_19_18_17_16(instruction); |
| uint64 fd_value = extract_fd_15_14_13_12_11(instruction); |
| |
| std::string fd = FPR(copy(fd_value)); |
| std::string fs = FPR(copy(fs_value)); |
| std::string ft = FPR(copy(ft_value)); |
| |
| return img::format("MAX.D %s, %s, %s", fd, fs, ft); |
| } |
| |
| |
| /* |
| * |
| * |
| * 3 2 1 |
| * 10987654321098765432109876543210 |
| * 001000 x1110000101 |
| * rt ----- |
| * rs ----- |
| * rd ----- |
| */ |
| std::string NMD::MAX_S(uint64 instruction) |
| { |
| uint64 ft_value = extract_ft_25_24_23_22_21(instruction); |
| uint64 fs_value = extract_fs_20_19_18_17_16(instruction); |
| uint64 fd_value = extract_fd_15_14_13_12_11(instruction); |
| |
| std::string fd = FPR(copy(fd_value)); |
| std::string fs = FPR(copy(fs_value)); |
| std::string ft = FPR(copy(ft_value)); |
| |
| return img::format("MAX.S %s, %s, %s", fd, fs, ft); |
| } |
| |
| |
| /* |
| * |
| * |
| * 3 2 1 |
| * 10987654321098765432109876543210 |
| * 001000 x1110000101 |
| * rt ----- |
| * rs ----- |
| * rd ----- |
| */ |
| std::string NMD::MAXA_D(uint64 instruction) |
| { |
| uint64 ft_value = extract_ft_25_24_23_22_21(instruction); |
| uint64 fs_value = extract_fs_20_19_18_17_16(instruction); |
| uint64 fd_value = extract_fd_15_14_13_12_11(instruction); |
| |
| std::string fd = FPR(copy(fd_value)); |
| std::string fs = FPR(copy(fs_value)); |
| std::string ft = FPR(copy(ft_value)); |
| |
| return img::format("MAXA.D %s, %s, %s", fd, fs, ft); |
| } |
| |
| |
| /* |
| * |
| * |
| * 3 2 1 |
| * 10987654321098765432109876543210 |
| * 001000 x1110000101 |
| * rt ----- |
| * rs ----- |
| * rd ----- |
| */ |
| std::string NMD::MAXA_S(uint64 instruction) |
| { |
| uint64 ft_value = extract_ft_25_24_23_22_21(instruction); |
| uint64 fs_value = extract_fs_20_19_18_17_16(instruction); |
| uint64 fd_value = extract_fd_15_14_13_12_11(instruction); |
| |
| std::string fd = FPR(copy(fd_value)); |
| std::string fs = FPR(copy(fs_value)); |
| std::string ft = FPR(copy(ft_value)); |
| |
| return img::format("MAXA.S %s, %s, %s", fd, fs, ft); |
| } |
| |
| |
| /* |
| * |
| * |
| * 3 2 1 |
| * 10987654321098765432109876543210 |
| * 001000 x1110000101 |
| * rt ----- |
| * rs ----- |
| * rd ----- |
| */ |
| std::string NMD::MFC0(uint64 instruction) |
| { |
| uint64 rt_value = extract_rt_25_24_23_22_21(instruction); |
| uint64 c0s_value = extract_c0s_20_19_18_17_16(instruction); |
| uint64 sel_value = extract_sel_15_14_13_12_11(instruction); |
| |
| std::string rt = GPR(copy(rt_value)); |
| std::string c0s = CPR(copy(c0s_value)); |
| std::string sel = IMMEDIATE(copy(sel_value)); |
| |
| return img::format("MFC0 %s, %s, %s", rt, c0s, sel); |
| } |
| |
| |
| /* |
| * |
| * |
| * 3 2 1 |
| * 10987654321098765432109876543210 |
| * 001000 x1110000101 |
| * rt ----- |
| * rs ----- |
| * rd ----- |
| */ |
| std::string NMD::MFC1(uint64 instruction) |
| { |
| uint64 rt_value = extract_rt_25_24_23_22_21(instruction); |
| uint64 fs_value = extract_fs_20_19_18_17_16(instruction); |
| |
| std::string rt = GPR(copy(rt_value)); |
| std::string fs = FPR(copy(fs_value)); |
| |
| return img::format("MFC1 %s, %s", rt, fs); |
| } |
| |
| |
| /* |
| * |
| * |
| * 3 2 1 |
| * 10987654321098765432109876543210 |
| * 001000 x1110000101 |
| * rt ----- |
| * rs ----- |
| * rd ----- |
| */ |
| std::string NMD::MFC2(uint64 instruction) |
| { |
| uint64 rt_value = extract_rt_25_24_23_22_21(instruction); |
| uint64 cs_value = extract_cs_20_19_18_17_16(instruction); |
| |
| std::string rt = GPR(copy(rt_value)); |
| std::string cs = CPR(copy(cs_value)); |
| |
| return img::format("MFC2 %s, %s", rt, cs); |
| } |
| |
| |
| /* |
| * |
| * |
| * 3 2 1 |
| * 10987654321098765432109876543210 |
| * 001000 x1110000101 |
| * rt ----- |
| * rs ----- |
| * rd ----- |
| */ |
| std::string NMD::MFGC0(uint64 instruction) |
| { |
| uint64 rt_value = extract_rt_25_24_23_22_21(instruction); |
| uint64 c0s_value = extract_c0s_20_19_18_17_16(instruction); |
| uint64 sel_value = extract_sel_15_14_13_12_11(instruction); |
| |
| std::string rt = GPR(copy(rt_value)); |
| std::string c0s = CPR(copy(c0s_value)); |
| std::string sel = IMMEDIATE(copy(sel_value)); |
| |
| return img::format("MFGC0 %s, %s, %s", rt, c0s, sel); |
| } |
| |
| |
| /* |
| * |
| * |
| * 3 2 1 |
| * 10987654321098765432109876543210 |
| * 001000 x1110000101 |
| * rt ----- |
| * rs ----- |
| * rd ----- |
| */ |
| std::string NMD::MFHC0(uint64 instruction) |
| { |
| uint64 rt_value = extract_rt_25_24_23_22_21(instruction); |
| uint64 c0s_value = extract_c0s_20_19_18_17_16(instruction); |
| uint64 sel_value = extract_sel_15_14_13_12_11(instruction); |
| |
| std::string rt = GPR(copy(rt_value)); |
| std::string c0s = CPR(copy(c0s_value)); |
| std::string sel = IMMEDIATE(copy(sel_value)); |
| |
| return img::format("MFHC0 %s, %s, %s", rt, c0s, sel); |
| } |
| |
| |
| /* |
| * |
| * |
| * 3 2 1 |
| * 10987654321098765432109876543210 |
| * 001000 x1110000101 |
| * rt ----- |
| * rs ----- |
| * rd ----- |
| */ |
| std::string NMD::MFHC1(uint64 instruction) |
| { |
| uint64 rt_value = extract_rt_25_24_23_22_21(instruction); |
| uint64 fs_value = extract_fs_20_19_18_17_16(instruction); |
| |
| std::string rt = GPR(copy(rt_value)); |
| std::string fs = FPR(copy(fs_value)); |
| |
| return img::format("MFHC1 %s, %s", rt, fs); |
| } |
| |
| |
| /* |
| * |
| * |
| * 3 2 1 |
| * 10987654321098765432109876543210 |
| * 001000 x1110000101 |
| * rt ----- |
| * rs ----- |
| * rd ----- |
| */ |
| std::string NMD::MFHC2(uint64 instruction) |
| { |
| uint64 rt_value = extract_rt_25_24_23_22_21(instruction); |
| uint64 cs_value = extract_cs_20_19_18_17_16(instruction); |
| |
| std::string rt = GPR(copy(rt_value)); |
| std::string cs = CPR(copy(cs_value)); |
| |
| return img::format("MFHC2 %s, %s", rt, cs); |
| } |
| |
| |
| /* |
| * |
| * |
| * 3 2 1 |
| * 10987654321098765432109876543210 |
| * 001000 x1110000101 |
| * rt ----- |
| * rs ----- |
| * rd ----- |
| */ |
| std::string NMD::MFHGC0(uint64 instruction) |
| { |
| uint64 rt_value = extract_rt_25_24_23_22_21(instruction); |
| uint64 c0s_value = extract_c0s_20_19_18_17_16(instruction); |
| uint64 sel_value = extract_sel_15_14_13_12_11(instruction); |
| |
| std::string rt = GPR(copy(rt_value)); |
| std::string c0s = CPR(copy(c0s_value)); |
| std::string sel = IMMEDIATE(copy(sel_value)); |
| |
| return img::format("MFHGC0 %s, %s, %s", rt, c0s, sel); |
| } |
| |
| |
| /* |
| * [DSP] MFHI rs, ac - Move from HI register |
| * |
| * 3 2 1 |
| * 10987654321098765432109876543210 |
| * 001000 xxxxx 00000001111111 |
| * rt ----- |
| * ac -- |
| */ |
| std::string NMD::MFHI_DSP_(uint64 instruction) |
| { |
| uint64 rt_value = extract_rt_25_24_23_22_21(instruction); |
| uint64 ac_value = extract_ac_15_14(instruction); |
| |
| std::string rt = GPR(copy(rt_value)); |
| std::string ac = AC(copy(ac_value)); |
| |
| return img::format("MFHI %s, %s", rt, ac); |
| } |
| |
| |
| /* |
| * |
| * |
| * 3 2 1 |
| * 10987654321098765432109876543210 |
| * 001000 x1110000101 |
| * rt ----- |
| * rs ----- |
| * rd ----- |
| */ |
| std::string NMD::MFHTR(uint64 instruction) |
| { |
| uint64 rt_value = extract_rt_25_24_23_22_21(instruction); |
| uint64 c0s_value = extract_c0s_20_19_18_17_16(instruction); |
| uint64 sel_value = extract_sel_15_14_13_12_11(instruction); |
| uint64 u_value = extract_u_10(instruction); |
| |
| std::string rt = GPR(copy(rt_value)); |
| std::string c0s = IMMEDIATE(copy(c0s_value)); |
| std::string u = IMMEDIATE(copy(u_value)); |
| std::string sel = IMMEDIATE(copy(sel_value)); |
| |
| return img::format("MFHTR %s, %s, %s, %s", rt, c0s, u, sel); |
| } |
| |
| |
| /* |
| * [DSP] MFLO rs, ac - Move from HI register |
| * |
| * 3 2 1 |
| * 10987654321098765432109876543210 |
| * 001000 xxxxx 01000001111111 |
| * rt ----- |
| * ac -- |
| */ |
| std::string NMD::MFLO_DSP_(uint64 instruction) |
| { |
| uint64 rt_value = extract_rt_25_24_23_22_21(instruction); |
| uint64 ac_value = extract_ac_15_14(instruction); |
| |
| std::string rt = GPR(copy(rt_value)); |
| std::string ac = AC(copy(ac_value)); |
| |
| return img::format("MFLO %s, %s", rt, ac); |
| } |
| |
| |
| /* |
| * |
| * |
| * 3 2 1 |
| * 10987654321098765432109876543210 |
| * 001000 x1110000101 |
| * rt ----- |
| * rs ----- |
| * rd ----- |
| */ |
| std::string NMD::MFTR(uint64 instruction) |
| { |
| uint64 rt_value = extract_rt_25_24_23_22_21(instruction); |
| uint64 c0s_value = extract_c0s_20_19_18_17_16(instruction); |
| uint64 sel_value = extract_sel_15_14_13_12_11(instruction); |
| uint64 u_value = extract_u_10(instruction); |
| |
| std::string rt = GPR(copy(rt_value)); |
| std::string c0s = IMMEDIATE(copy(c0s_value)); |
| std::string u = IMMEDIATE(copy(u_value)); |
| std::string sel = IMMEDIATE(copy(sel_value)); |
| |
| return img::format("MFTR %s, %s, %s, %s", rt, c0s, u, sel); |
| } |
| |
| |
| /* |
| * |
| * |
| * 3 2 1 |
| * 10987654321098765432109876543210 |
| * 001000 x1110000101 |
| * rt ----- |
| * rs ----- |
| * rd ----- |
| */ |
| std::string NMD::MIN_D(uint64 instruction) |
| { |
| uint64 ft_value = extract_ft_25_24_23_22_21(instruction); |
| uint64 fs_value = extract_fs_20_19_18_17_16(instruction); |
| uint64 fd_value = extract_fd_15_14_13_12_11(instruction); |
| |
| std::string fd = FPR(copy(fd_value)); |
| std::string fs = FPR(copy(fs_value)); |
| std::string ft = FPR(copy(ft_value)); |
| |
| return img::format("MIN.D %s, %s, %s", fd, fs, ft); |
| } |
| |
| |
| /* |
| * |
| * |
| * 3 2 1 |
| * 10987654321098765432109876543210 |
| * 001000 x1110000101 |
| * rt ----- |
| * rs ----- |
| * rd ----- |
| */ |
| std::string NMD::MIN_S(uint64 instruction) |
| { |
| uint64 ft_value = extract_ft_25_24_23_22_21(instruction); |
| uint64 fs_value = extract_fs_20_19_18_17_16(instruction); |
| uint64 fd_value = extract_fd_15_14_13_12_11(instruction); |
| |
| std::string fd = FPR(copy(fd_value)); |
| std::string fs = FPR(copy(fs_value)); |
| std::string ft = FPR(copy(ft_value)); |
| |
| return img::format("MIN.S %s, %s, %s", fd, fs, ft); |
| } |
| |
| |
| /* |
| * |
| * |
| * 3 2 1 |
| * 10987654321098765432109876543210 |
| * 001000 x1110000101 |
| * rt ----- |
| * rs ----- |
| * rd ----- |
| */ |
| std::string NMD::MINA_D(uint64 instruction) |
| { |
| uint64 ft_value = extract_ft_25_24_23_22_21(instruction); |
| uint64 fs_value = extract_fs_20_19_18_17_16(instruction); |
| uint64 fd_value = extract_fd_15_14_13_12_11(instruction); |
| |
| std::string fd = FPR(copy(fd_value)); |
| std::string fs = FPR(copy(fs_value)); |
| std::string ft = FPR(copy(ft_value)); |
| |
| return img::format("MINA.D %s, %s, %s", fd, fs, ft); |
| } |
| |
| |
| /* |
| * |
| * |
| * 3 2 1 |
| * 10987654321098765432109876543210 |
| * 001000 x1110000101 |
| * rt ----- |
| * rs ----- |
| * rd ----- |
| */ |
| std::string NMD::MINA_S(uint64 instruction) |
| { |
| uint64 ft_value = extract_ft_25_24_23_22_21(instruction); |
| uint64 fs_value = extract_fs_20_19_18_17_16(instruction); |
| uint64 fd_value = extract_fd_15_14_13_12_11(instruction); |
| |
| std::string fd = FPR(copy(fd_value)); |
| std::string fs = FPR(copy(fs_value)); |
| std::string ft = FPR(copy(ft_value)); |
| |
| return img::format("MINA.S %s, %s, %s", fd, fs, ft); |
| } |
| |
| |
| /* |
| * |
| * |
| * 3 2 1 |
| * 10987654321098765432109876543210 |
| * 001000 x1110000101 |
| * rt ----- |
| * rs ----- |
| * rd ----- |
| */ |
| std::string NMD::MOD(uint64 instruction) |
| { |
| uint64 rt_value = extract_rt_25_24_23_22_21(instruction); |
| uint64 rs_value = extract_rs_20_19_18_17_16(instruction); |
| uint64 rd_value = extract_rd_15_14_13_12_11(instruction); |
| |
| std::string rd = GPR(copy(rd_value)); |
| std::string rs = GPR(copy(rs_value)); |
| std::string rt = GPR(copy(rt_value)); |
| |
| return img::format("MOD %s, %s, %s", rd, rs, rt); |
| } |
| |
| |
| /* |
| * [DSP] MODSUB rd, rs, rt - Modular subtraction on an index value |
| * |
| * 3 2 1 |
| * 10987654321098765432109876543210 |
| * 001000 x1110000101 |
| * rt ----- |
| * rs ----- |
| * rd ----- |
| */ |
| std::string NMD::MODSUB(uint64 instruction) |
| { |
| uint64 rt_value = extract_rt_25_24_23_22_21(instruction); |
| uint64 rs_value = extract_rs_20_19_18_17_16(instruction); |
| uint64 rd_value = extract_rd_15_14_13_12_11(instruction); |
| |
| std::string rd = GPR(copy(rd_value)); |
| std::string rs = GPR(copy(rs_value)); |
| std::string rt = GPR(copy(rt_value)); |
| |
| return img::format("MODSUB %s, %s, %s", rd, rs, rt); |
| } |
| |
| |
| /* |
| * |
| * |
| * 3 2 1 |
| * 10987654321098765432109876543210 |
| * 001000 x1010010101 |
| * rt ----- |
| * rs ----- |
| * rd ----- |
| */ |
| std::string NMD::MODU(uint64 instruction) |
| { |
| uint64 rt_value = extract_rt_25_24_23_22_21(instruction); |
| uint64 rs_value = extract_rs_20_19_18_17_16(instruction); |
| uint64 rd_value = extract_rd_15_14_13_12_11(instruction); |
| |
| std::string rd = GPR(copy(rd_value)); |
| std::string rs = GPR(copy(rs_value)); |
| std::string rt = GPR(copy(rt_value)); |
| |
| return img::format("MODU %s, %s, %s", rd, rs, rt); |
| } |
| |
| |
| /* |
| * |
| * |
| * 3 2 1 |
| * 10987654321098765432109876543210 |
| * 001000 x1110000101 |
| * rt ----- |
| * rs ----- |
| * rd ----- |
| */ |
| std::string NMD::MOV_D(uint64 instruction) |
| { |
| uint64 ft_value = extract_ft_25_24_23_22_21(instruction); |
| uint64 fs_value = extract_fs_20_19_18_17_16(instruction); |
| |
| std::string ft = FPR(copy(ft_value)); |
| std::string fs = FPR(copy(fs_value)); |
| |
| return img::format("MOV.D %s, %s", ft, fs); |
| } |
| |
| |
| /* |
| * |
| * |
| * 3 2 1 |
| * 10987654321098765432109876543210 |
| * 001000 x1110000101 |
| * rt ----- |
| * rs ----- |
| * rd ----- |
| */ |
| std::string NMD::MOV_S(uint64 instruction) |
| { |
| uint64 ft_value = extract_ft_25_24_23_22_21(instruction); |
| uint64 fs_value = extract_fs_20_19_18_17_16(instruction); |
| |
| std::string ft = FPR(copy(ft_value)); |
| std::string fs = FPR(copy(fs_value)); |
| |
| return img::format("MOV.S %s, %s", ft, fs); |
| } |
| |
| |
| /* |
| * |
| * |
| * 3 2 1 |
| * 10987654321098765432109876543210 |
| * 001000 x1110000101 |
| * rt ----- |
| * rs ----- |
| * rd ----- |
| */ |
| std::string NMD::MOVE_BALC(uint64 instruction) |
| { |
| uint64 rtz4_value = extract_rtz4_27_26_25_23_22_21(instruction); |
| uint64 rd1_value = extract_rdl_25_24(instruction); |
| int64 s_value = extract_s__se21_0_20_to_1_s1(instruction); |
| |
| std::string rd1 = GPR(decode_gpr_gpr1(rd1_value)); |
| std::string rtz4 = GPR(decode_gpr_gpr4_zero(rtz4_value)); |
| std::string s = ADDRESS(encode_s_from_address(s_value), 4); |
| |
| return img::format("MOVE.BALC %s, %s, %s", rd1, rtz4, s); |
| } |
| |
| |
| /* |
| * |
| * |
| * 3 2 1 |
| * 10987654321098765432109876543210 |
| * 001000 x1110000101 |
| * rt ----- |
| * rs ----- |
| * rd ----- |
| */ |
| std::string NMD::MOVEP(uint64 instruction) |
| { |
| uint64 rtz4_value = extract_rtz4_9_7_6_5(instruction); |
| uint64 rd2_value = extract_rd2_3_8(instruction); |
| uint64 rsz4_value = extract_rsz4_4_2_1_0(instruction); |
| |
| std::string rd2 = GPR(decode_gpr_gpr2_reg1(rd2_value)); |
| std::string re2 = GPR(decode_gpr_gpr2_reg2(rd2_value)); |
| /* !!!!!!!!!! - no conversion function */ |
| std::string rsz4 = GPR(decode_gpr_gpr4_zero(rsz4_value)); |
| std::string rtz4 = GPR(decode_gpr_gpr4_zero(rtz4_value)); |
| |
| return img::format("MOVEP %s, %s, %s, %s", rd2, re2, rsz4, rtz4); |
| /* hand edited */ |
| } |
| |
| |
| /* |
| * |
| * |
| * 3 2 1 |
| * 10987654321098765432109876543210 |
| * 001000 x1110000101 |
| * rt ----- |
| * rs ----- |
| * rd ----- |
| */ |
| std::string NMD::MOVEP_REV_(uint64 instruction) |
| { |
| uint64 rt4_value = extract_rt4_9_7_6_5(instruction); |
| uint64 rd2_value = extract_rd2_3_8(instruction); |
| uint64 rs4_value = extract_rs4_4_2_1_0(instruction); |
| |
| std::string rs4 = GPR(decode_gpr_gpr4(rs4_value)); |
| std::string rt4 = GPR(decode_gpr_gpr4(rt4_value)); |
| std::string rd2 = GPR(decode_gpr_gpr2_reg1(rd2_value)); |
| std::string rs2 = GPR(decode_gpr_gpr2_reg2(rd2_value)); |
| /* !!!!!!!!!! - no conversion function */ |
| |
| return img::format("MOVEP %s, %s, %s, %s", rs4, rt4, rd2, rs2); |
| /* hand edited */ |
| } |
| |
| |
| /* |
| * ADDQH_R.W rd, rt, rs - Add Fractional Words And Shift Right to Halve Results |
| * |
| * 3 2 1 |
| * 10987654321098765432109876543210 |
| * 001000 00010001101 |
| * rt ----- |
| * rs ----- |
| * rd ----- |
| */ |
| std::string NMD::MOVE(uint64 instruction) |
| { |
| uint64 rt_value = extract_rt_9_8_7_6_5(instruction); |
| uint64 rs_value = extract_rs_4_3_2_1_0(instruction); |
| |
| std::string rt = GPR(copy(rt_value)); |
| std::string rs = GPR(copy(rs_value)); |
| |
| return img::format("MOVE %s, %s", rt, rs); |
| } |
| |
| |
| /* |
| * ADDQH_R.W rd, rt, rs - Add Fractional Words And Shift Right to Halve Results |
| * |
| * 3 2 1 |
| * 10987654321098765432109876543210 |
| * 001000 00010001101 |
| * rt ----- |
| * rs ----- |
| * rd ----- |
| */ |
| std::string NMD::MOVN(uint64 instruction) |
| { |
| uint64 rt_value = extract_rt_25_24_23_22_21(instruction); |
| uint64 rs_value = extract_rs_20_19_18_17_16(instruction); |
| uint64 rd_value = extract_rd_15_14_13_12_11(instruction); |
| |
| std::string rd = GPR(copy(rd_value)); |
| std::string rs = GPR(copy(rs_value)); |
| std::string rt = GPR(copy(rt_value)); |
| |
| return img::format("MOVN %s, %s, %s", rd, rs, rt); |
| } |
| |
| |
| /* |
| * ADDQH_R.W rd, rt, rs - Add Fractional Words And Shift Right to Halve Results |
| * |
| * 3 2 1 |
| * 10987654321098765432109876543210 |
| * 001000 00010001101 |
| * rt ----- |
| * rs ----- |
| * rd ----- |
| */ |
| std::string NMD::MOVZ(uint64 instruction) |
| { |
| uint64 rt_value = extract_rt_25_24_23_22_21(instruction); |
| uint64 rs_value = extract_rs_20_19_18_17_16(instruction); |
| uint64 rd_value = extract_rd_15_14_13_12_11(instruction); |
| |
| std::string rd = GPR(copy(rd_value)); |
| std::string rs = GPR(copy(rs_value)); |
| std::string rt = GPR(copy(rt_value)); |
| |
| return img::format("MOVZ %s, %s, %s", rd, rs, rt); |
| } |
| |
| |
| /* |
| * [DSP] MSUB ac, rs, rt - Multiply word and subtract from accumulator |
| * |
| * 3 2 1 |
| * 10987654321098765432109876543210 |
| * 001000 10101010111111 |
| * rt ----- |
| * rs ----- |
| * ac -- |
| */ |
| std::string NMD::MSUB_DSP_(uint64 instruction) |
| { |
| uint64 rt_value = extract_rt_25_24_23_22_21(instruction); |
| uint64 rs_value = extract_rs_20_19_18_17_16(instruction); |
| uint64 ac_value = extract_ac_15_14(instruction); |
| |
| std::string ac = AC(copy(ac_value)); |
| std::string rs = GPR(copy(rs_value)); |
| std::string rt = GPR(copy(rt_value)); |
| |
| return img::format("MSUB %s, %s, %s", ac, rs, rt); |
| } |
| |
| |
| /* |
| * ADDQH_R.W rd, rt, rs - Add Fractional Words And Shift Right to Halve Results |
| * |
| * 3 2 1 |
| * 10987654321098765432109876543210 |
| * 001000 00010001101 |
| * rt ----- |
| * rs ----- |
| * rd ----- |
| */ |
| std::string NMD::MSUBF_D(uint64 instruction) |
| { |
| uint64 ft_value = extract_ft_25_24_23_22_21(instruction); |
| uint64 fs_value = extract_fs_20_19_18_17_16(instruction); |
| uint64 fd_value = extract_fd_15_14_13_12_11(instruction); |
| |
| std::string fd = FPR(copy(fd_value)); |
| std::string fs = FPR(copy(fs_value)); |
| std::string ft = FPR(copy(ft_value)); |
| |
| return img::format("MSUBF.D %s, %s, %s", fd, fs, ft); |
| } |
| |
| |
| /* |
| * ADDQH_R.W rd, rt, rs - Add Fractional Words And Shift Right to Halve Results |
| * |
| * 3 2 1 |
| * 10987654321098765432109876543210 |
| * 001000 00010001101 |
| * rt ----- |
| * rs ----- |
| * rd ----- |
| */ |
| std::string NMD::MSUBF_S(uint64 instruction) |
| { |
| uint64 ft_value = extract_ft_25_24_23_22_21(instruction); |
| uint64 fs_value = extract_fs_20_19_18_17_16(instruction); |
| uint64 fd_value = extract_fd_15_14_13_12_11(instruction); |
| |
| std::string fd = FPR(copy(fd_value)); |
| std::string fs = FPR(copy(fs_value)); |
| std::string ft = FPR(copy(ft_value)); |
| |
| return img::format("MSUBF.S %s, %s, %s", fd, fs, ft); |
| } |
| |
| |
| /* |
| * [DSP] MSUBU ac, rs, rt - Multiply word and add to accumulator |
| * |
| * 3 2 1 |
| * 10987654321098765432109876543210 |
| * 001000 11101010111111 |
| * rt ----- |
| * rs ----- |
| * ac -- |
| */ |
| std::string NMD::MSUBU_DSP_(uint64 instruction) |
| { |
| uint64 rt_value = extract_rt_25_24_23_22_21(instruction); |
| uint64 rs_value = extract_rs_20_19_18_17_16(instruction); |
| uint64 ac_value = extract_ac_15_14(instruction); |
| |
| std::string ac = AC(copy(ac_value)); |
| std::string rs = GPR(copy(rs_value)); |
| std::string rt = GPR(copy(rt_value)); |
| |
| return img::format("MSUBU %s, %s, %s", ac, rs, rt); |
| } |
| |
| |
| /* |
| * ADDQH_R.W rd, rt, rs - Add Fractional Words And Shift Right to Halve Results |
| * |
| * 3 2 1 |
| * 10987654321098765432109876543210 |
| * 001000 00010001101 |
| * rt ----- |
| * rs ----- |
| * rd ----- |
| */ |
| std::string NMD::MTC0(uint64 instruction) |
| { |
| uint64 rt_value = extract_rt_25_24_23_22_21(instruction); |
| uint64 c0s_value = extract_c0s_20_19_18_17_16(instruction); |
| uint64 sel_value = extract_sel_15_14_13_12_11(instruction); |
| |
| std::string rt = GPR(copy(rt_value)); |
| std::string c0s = CPR(copy(c0s_value)); |
| std::string sel = IMMEDIATE(copy(sel_value)); |
| |
| return img::format("MTC0 %s, %s, %s", rt, c0s, sel); |
| } |
| |
| |
| /* |
| * ADDQH_R.W rd, rt, rs - Add Fractional Words And Shift Right to Halve Results |
| * |
| * 3 2 1 |
| * 10987654321098765432109876543210 |
| * 001000 00010001101 |
| * rt ----- |
| * rs ----- |
| * rd ----- |
| */ |
| std::string NMD::MTC1(uint64 instruction) |
| { |
| uint64 rt_value = extract_rt_25_24_23_22_21(instruction); |
| uint64 fs_value = extract_fs_20_19_18_17_16(instruction); |
| |
| std::string rt = GPR(copy(rt_value)); |
| std::string fs = FPR(copy(fs_value)); |
| |
| return img::format("MTC1 %s, %s", rt, fs); |
| } |
| |
| |
| /* |
| * ADDQH_R.W rd, rt, rs - Add Fractional Words And Shift Right to Halve Results |
| * |
| * 3 2 1 |
| * 10987654321098765432109876543210 |
| * 001000 00010001101 |
| * rt ----- |
| * rs ----- |
| * rd ----- |
| */ |
| std::string NMD::MTC2(uint64 instruction) |
| { |
| uint64 rt_value = extract_rt_25_24_23_22_21(instruction); |
| uint64 cs_value = extract_cs_20_19_18_17_16(instruction); |
| |
| std::string rt = GPR(copy(rt_value)); |
| std::string cs = CPR(copy(cs_value)); |
| |
| return img::format("MTC2 %s, %s", rt, cs); |
| } |
| |
| |
| /* |
| * ADDQH_R.W rd, rt, rs - Add Fractional Words And Shift Right to Halve Results |
| * |
| * 3 2 1 |
| * 10987654321098765432109876543210 |
| * 001000 00010001101 |
| * rt ----- |
| * rs ----- |
| * rd ----- |
| */ |
| std::string NMD::MTGC0(uint64 instruction) |
| { |
| uint64 rt_value = extract_rt_25_24_23_22_21(instruction); |
| uint64 c0s_value = extract_c0s_20_19_18_17_16(instruction); |
| uint64 sel_value = extract_sel_15_14_13_12_11(instruction); |
| |
| std::string rt = GPR(copy(rt_value)); |
| std::string c0s = CPR(copy(c0s_value)); |
| std::string sel = IMMEDIATE(copy(sel_value)); |
| |
| return img::format("MTGC0 %s, %s, %s", rt, c0s, sel); |
| } |
| |
| |
| /* |
| * ADDQH_R.W rd, rt, rs - Add Fractional Words And Shift Right to Halve Results |
| * |
| * 3 2 1 |
| * 10987654321098765432109876543210 |
| * 001000 00010001101 |
| * rt ----- |
| * rs ----- |
| * rd ----- |
| */ |
| std::string NMD::MTHC0(uint64 instruction) |
| { |
| uint64 rt_value = extract_rt_25_24_23_22_21(instruction); |
| uint64 c0s_value = extract_c0s_20_19_18_17_16(instruction); |
| uint64 sel_value = extract_sel_15_14_13_12_11(instruction); |
| |
| std::string rt = GPR(copy(rt_value)); |
| std::string c0s = CPR(copy(c0s_value)); |
| std::string sel = IMMEDIATE(copy(sel_value)); |
| |
| return img::format("MTHC0 %s, %s, %s", rt, c0s, sel); |
| } |
| |
| |
| /* |
| * ADDQH_R.W rd, rt, rs - Add Fractional Words And Shift Right to Halve Results |
| * |
| * 3 2 1 |
| * 10987654321098765432109876543210 |
| * 001000 00010001101 |
| * rt ----- |
| * rs ----- |
| * rd ----- |
| */ |
| std::string NMD::MTHC1(uint64 instruction) |
| { |
| uint64 rt_value = extract_rt_25_24_23_22_21(instruction); |
| uint64 fs_value = extract_fs_20_19_18_17_16(instruction); |
| |
| std::string rt = GPR(copy(rt_value)); |
| std::string fs = FPR(copy(fs_value)); |
| |
| return img::format("MTHC1 %s, %s", rt, fs); |
| } |
| |
| |
| /* |
| * ADDQH_R.W rd, rt, rs - Add Fractional Words And Shift Right to Halve Results |
| * |
| * 3 2 1 |
| * 10987654321098765432109876543210 |
| * 001000 00010001101 |
| * rt ----- |
| * rs ----- |
| * rd ----- |
| */ |
| std::string NMD::MTHC2(uint64 instruction) |
| { |
| uint64 rt_value = extract_rt_25_24_23_22_21(instruction); |
| uint64 cs_value = extract_cs_20_19_18_17_16(instruction); |
| |
| std::string rt = GPR(copy(rt_value)); |
| std::string cs = CPR(copy(cs_value)); |
| |
| return img::format("MTHC2 %s, %s", rt, cs); |
| } |
| |
| |
| /* |
| * ADDQH_R.W rd, rt, rs - Add Fractional Words And Shift Right to Halve Results |
| * |
| * 3 2 1 |
| * 10987654321098765432109876543210 |
| * 001000 00010001101 |
| * rt ----- |
| * rs ----- |
| * rd ----- |
| */ |
| std::string NMD::MTHGC0(uint64 instruction) |
| { |
| uint64 rt_value = extract_rt_25_24_23_22_21(instruction); |
| uint64 c0s_value = extract_c0s_20_19_18_17_16(instruction); |
| uint64 sel_value = extract_sel_15_14_13_12_11(instruction); |
| |
| std::string rt = GPR(copy(rt_value)); |
| std::string c0s = CPR(copy(c0s_value)); |
| std::string sel = IMMEDIATE(copy(sel_value)); |
| |
| return img::format("MTHGC0 %s, %s, %s", rt, c0s, sel); |
| } |
| |
| |
| /* |
| * [DSP] MTHI rs, ac - Move to HI register |
| * |
| * 3 2 1 |
| * 10987654321098765432109876543210 |
| * 001000xxxxx 10000001111111 |
| * rs ----- |
| * ac -- |
| */ |
| std::string NMD::MTHI_DSP_(uint64 instruction) |
| { |
| uint64 rs_value = extract_rs_20_19_18_17_16(instruction); |
| uint64 ac_value = extract_ac_15_14(instruction); |
| |
| std::string rs = GPR(copy(rs_value)); |
| std::string ac = AC(copy(ac_value)); |
| |
| return img::format("MTHI %s, %s", rs, ac); |
| } |
| |
| |
| /* |
| * [DSP] MTHLIP rs, ac - Copy LO to HI and a GPR to LO and increment pos by 32 |
| * |
| * 3 2 1 |
| * 10987654321098765432109876543210 |
| * 001000xxxxx 00001001111111 |
| * rs ----- |
| * ac -- |
| */ |
| std::string NMD::MTHLIP(uint64 instruction) |
| { |
| uint64 rs_value = extract_rs_20_19_18_17_16(instruction); |
| uint64 ac_value = extract_ac_15_14(instruction); |
| |
| std::string rs = GPR(copy(rs_value)); |
| std::string ac = AC(copy(ac_value)); |
| |
| return img::format("MTHLIP %s, %s", rs, ac); |
| } |
| |
| |
| /* |
| * ADDQH_R.W rd, rt, rs - Add Fractional Words And Shift Right to Halve Results |
| * |
| * 3 2 1 |
| * 10987654321098765432109876543210 |
| * 001000 00010001101 |
| * rt ----- |
| * rs ----- |
| * rd ----- |
| */ |
| std::string NMD::MTHTR(uint64 instruction) |
| { |
| uint64 rt_value = extract_rt_25_24_23_22_21(instruction); |
| uint64 c0s_value = extract_c0s_20_19_18_17_16(instruction); |
| uint64 sel_value = extract_sel_15_14_13_12_11(instruction); |
| uint64 u_value = extract_u_10(instruction); |
| |
| std::string rt = GPR(copy(rt_value)); |
| std::string c0s = IMMEDIATE(copy(c0s_value)); |
| std::string u = IMMEDIATE(copy(u_value)); |
| std::string sel = IMMEDIATE(copy(sel_value)); |
| |
| return img::format("MTHTR %s, %s, %s, %s", rt, c0s, u, sel); |
| } |
| |
| |
| /* |
| * [DSP] MTLO rs, ac - Move to LO register |
| * |
| * 3 2 1 |
| * 10987654321098765432109876543210 |
| * 001000xxxxx 11000001111111 |
| * rs ----- |
| * ac -- |
| */ |
| std::string NMD::MTLO_DSP_(uint64 instruction) |
| { |
| uint64 rs_value = extract_rs_20_19_18_17_16(instruction); |
| uint64 ac_value = extract_ac_15_14(instruction); |
| |
| std::string rs = GPR(copy(rs_value)); |
| std::string ac = AC(copy(ac_value)); |
| |
| return img::format("MTLO %s, %s", rs, ac); |
| } |
| |
| |
| /* |
| * ADDQH_R.W rd, rt, rs - Add Fractional Words And Shift Right to Halve Results |
| * |
| * 3 2 1 |
| * 10987654321098765432109876543210 |
| * 001000 00010001101 |
| * rt ----- |
| * rs ----- |
| * rd ----- |
| */ |
| std::string NMD::MTTR(uint64 instruction) |
| { |
| uint64 rt_value = extract_rt_25_24_23_22_21(instruction); |
| uint64 c0s_value = extract_c0s_20_19_18_17_16(instruction); |
| uint64 sel_value = extract_sel_15_14_13_12_11(instruction); |
| uint64 u_value = extract_u_10(instruction); |
| |
| std::string rt = GPR(copy(rt_value)); |
| std::string c0s = IMMEDIATE(copy(c0s_value)); |
| std::string u = IMMEDIATE(copy(u_value)); |
| std::string sel = IMMEDIATE(copy(sel_value)); |
| |
| return img::format("MTTR %s, %s, %s, %s", rt, c0s, u, sel); |
| } |
| |
| |
| /* |
| * ADDQH_R.W rd, rt, rs - Add Fractional Words And Shift Right to Halve Results |
| * |
| * 3 2 1 |
| * 10987654321098765432109876543210 |
| * 001000 00010001101 |
| * rt ----- |
| * rs ----- |
| * rd ----- |
| */ |
| std::string NMD::MUH(uint64 instruction) |
| { |
| uint64 rt_value = extract_rt_25_24_23_22_21(instruction); |
| uint64 rs_value = extract_rs_20_19_18_17_16(instruction); |
| uint64 rd_value = extract_rd_15_14_13_12_11(instruction); |
| |
| std::string rd = GPR(copy(rd_value)); |
| std::string rs = GPR(copy(rs_value)); |
| std::string rt = GPR(copy(rt_value)); |
| |
| return img::format("MUH %s, %s, %s", rd, rs, rt); |
| } |
| |
| |
| /* |
| * ADDQH_R.W rd, rt, rs - Add Fractional Words And Shift Right to Halve Results |
| * |
| * 3 2 1 |
| * 10987654321098765432109876543210 |
| * 001000 00010001101 |
| * rt ----- |
| * rs ----- |
| * rd ----- |
| */ |
| std::string NMD::MUHU(uint64 instruction) |
| { |
| uint64 rt_value = extract_rt_25_24_23_22_21(instruction); |
| uint64 rs_value = extract_rs_20_19_18_17_16(instruction); |
| uint64 rd_value = extract_rd_15_14_13_12_11(instruction); |
| |
| std::string rd = GPR(copy(rd_value)); |
| std::string rs = GPR(copy(rs_value)); |
| std::string rt = GPR(copy(rt_value)); |
| |
| return img::format("MUHU %s, %s, %s", rd, rs, rt); |
| } |
| |
| |
| /* |
| * ADDQH_R.W rd, rt, rs - Add Fractional Words And Shift Right to Halve Results |
| * |
| * 3 2 1 |
| * 10987654321098765432109876543210 |
| * 001000 00010001101 |
| * rt ----- |
| * rs ----- |
| * rd ----- |
| */ |
| std::string NMD::MUL_32_(uint64 instruction) |
| { |
| uint64 rt_value = extract_rt_25_24_23_22_21(instruction); |
| uint64 rs_value = extract_rs_20_19_18_17_16(instruction); |
| uint64 rd_value = extract_rd_15_14_13_12_11(instruction); |
| |
| std::string rd = GPR(copy(rd_value)); |
| std::string rs = GPR(copy(rs_value)); |
| std::string rt = GPR(copy(rt_value)); |
| |
| return img::format("MUL %s, %s, %s", rd, rs, rt); |
| } |
| |
| |
| /* |
| * ADDQH_R.W rd, rt, rs - Add Fractional Words And Shift Right to Halve Results |
| * |
| * 3 2 1 |
| * 10987654321098765432109876543210 |
| * 001000 00010001101 |
| * rt ----- |
| * rs ----- |
| * rd ----- |
| */ |
| std::string NMD::MUL_4X4_(uint64 instruction) |
| { |
| uint64 rt4_value = extract_rt4_9_7_6_5(instruction); |
| uint64 rs4_value = extract_rs4_4_2_1_0(instruction); |
| |
| std::string rs4 = GPR(decode_gpr_gpr4(rs4_value)); |
| std::string rt4 = GPR(decode_gpr_gpr4(rt4_value)); |
| |
| return img::format("MUL %s, %s", rs4, rt4); |
| } |
| |
| |
| /* |
| * ADDQH_R.W rd, rt, rs - Add Fractional Words And Shift Right to Halve Results |
| * |
| * 3 2 1 |
| * 10987654321098765432109876543210 |
| * 001000 00010001101 |
| * rt ----- |
| * rs ----- |
| * rd ----- |
| */ |
| std::string NMD::MUL_D(uint64 instruction) |
| { |
| uint64 ft_value = extract_ft_25_24_23_22_21(instruction); |
| uint64 fs_value = extract_fs_20_19_18_17_16(instruction); |
| uint64 fd_value = extract_fd_15_14_13_12_11(instruction); |
| |
| std::string fd = FPR(copy(fd_value)); |
| std::string fs = FPR(copy(fs_value)); |
| std::string ft = FPR(copy(ft_value)); |
| |
| return img::format("MUL.D %s, %s, %s", fd, fs, ft); |
| } |
| |
| |
| /* |
| * [DSP] MUL.PH rd, rs, rt - Multiply vector integer half words to same size |
| * products |
| * |
| * 3 2 1 |
| * 10987654321098765432109876543210 |
| * 001000 00000101101 |
| * rt ----- |
| * rs ----- |
| * rd ----- |
| */ |
| std::string NMD::MUL_PH(uint64 instruction) |
| { |
| uint64 rt_value = extract_rt_25_24_23_22_21(instruction); |
| uint64 rs_value = extract_rs_20_19_18_17_16(instruction); |
| uint64 rd_value = extract_rd_15_14_13_12_11(instruction); |
| |
| std::string rd = GPR(copy(rd_value)); |
| std::string rs = GPR(copy(rs_value)); |
| std::string rt = GPR(copy(rt_value)); |
| |
| return img::format("MUL.PH %s, %s, %s", rd, rs, rt); |
| } |
| |
| |
| /* |
| * [DSP] MUL_S.PH rd, rs, rt - Multiply vector integer half words to same size |
| * products (saturated) |
| * |
| * 3 2 1 |
| * 10987654321098765432109876543210 |
| * 001000 10000101101 |
| * rt ----- |
| * rs ----- |
| * rd ----- |
| */ |
| std::string NMD::MUL_S_PH(uint64 instruction) |
| { |
| uint64 rt_value = extract_rt_25_24_23_22_21(instruction); |
| uint64 rs_value = extract_rs_20_19_18_17_16(instruction); |
| uint64 rd_value = extract_rd_15_14_13_12_11(instruction); |
| |
| std::string rd = GPR(copy(rd_value)); |
| std::string rs = GPR(copy(rs_value)); |
| std::string rt = GPR(copy(rt_value)); |
| |
| return img::format("MUL_S.PH %s, %s, %s", rd, rs, rt); |
| } |
| |
| |
| /* |
| * ADDQH_R.W rd, rt, rs - Add Fractional Words And Shift Right to Halve Results |
| * |
| * 3 2 1 |
| * 10987654321098765432109876543210 |
| * 001000 00010001101 |
| * rt ----- |
| * rs ----- |
| * rd ----- |
| */ |
| std::string NMD::MUL_S(uint64 instruction) |
| { |
| uint64 ft_value = extract_ft_25_24_23_22_21(instruction); |
| uint64 fs_value = extract_fs_20_19_18_17_16(instruction); |
| uint64 fd_value = extract_fd_15_14_13_12_11(instruction); |
| |
| std::string fd = FPR(copy(fd_value)); |
| std::string fs = FPR(copy(fs_value)); |
| std::string ft = FPR(copy(ft_value)); |
| |
| return img::format("MUL.S %s, %s, %s", fd, fs, ft); |
| } |
| |
| |
| /* |
| * [DSP] MULEQ_S.W.PHL rd, rs, rt - Multiply vector fractional left halfwords |
| * to expanded width products |
| * |
| * 3 2 1 |
| * 10987654321098765432109876543210 |
| * 001000 x0000100101 |
| * rt ----- |
| * rs ----- |
| * rd ----- |
| */ |
| std::string NMD::MULEQ_S_W_PHL(uint64 instruction) |
| { |
| uint64 rt_value = extract_rt_25_24_23_22_21(instruction); |
| uint64 rs_value = extract_rs_20_19_18_17_16(instruction); |
| uint64 rd_value = extract_rd_15_14_13_12_11(instruction); |
| |
| std::string rd = GPR(copy(rd_value)); |
| std::string rs = GPR(copy(rs_value)); |
| std::string rt = GPR(copy(rt_value)); |
| |
| return img::format("MULEQ_S.W.PHL %s, %s, %s", rd, rs, rt); |
| } |
| |
| |
| /* |
| * [DSP] MULEQ_S.W.PHR rd, rs, rt - Multiply vector fractional right halfwords |
| * to expanded width products |
| * |
| * 3 2 1 |
| * 10987654321098765432109876543210 |
| * 001000 x0001100101 |
| * rt ----- |
| * rs ----- |
| * rd ----- |
| */ |
| std::string NMD::MULEQ_S_W_PHR(uint64 instruction) |
| { |
| uint64 rt_value = extract_rt_25_24_23_22_21(instruction); |
| uint64 rs_value = extract_rs_20_19_18_17_16(instruction); |
| uint64 rd_value = extract_rd_15_14_13_12_11(instruction); |
| |
| std::string rd = GPR(copy(rd_value)); |
| std::string rs = GPR(copy(rs_value)); |
| std::string rt = GPR(copy(rt_value)); |
| |
| return img::format("MULEQ_S.W.PHR %s, %s, %s", rd, rs, rt); |
| } |
| |
| |
| /* |
| * [DSP] MULEU_S.PH.QBL rd, rs, rt - Multiply vector fractional left bytes |
| * by halfwords to halfword products |
| * |
| * 3 2 1 |
| * 10987654321098765432109876543210 |
| * 001000 x0010010101 |
| * rt ----- |
| * rs ----- |
| * rd ----- |
| */ |
| std::string NMD::MULEU_S_PH_QBL(uint64 instruction) |
| { |
| uint64 rt_value = extract_rt_25_24_23_22_21(instruction); |
| uint64 rs_value = extract_rs_20_19_18_17_16(instruction); |
| uint64 rd_value = extract_rd_15_14_13_12_11(instruction); |
| |
| std::string rd = GPR(copy(rd_value)); |
| std::string rs = GPR(copy(rs_value)); |
| std::string rt = GPR(copy(rt_value)); |
| |
| return img::format("MULEU_S.PH.QBL %s, %s, %s", rd, rs, rt); |
| } |
| |
| |
| /* |
| * [DSP] MULEU_S.PH.QBR rd, rs, rt - Multiply vector fractional right bytes |
| * by halfwords to halfword products |
| * |
| * 3 2 1 |
| * 10987654321098765432109876543210 |
| * 001000 x0011010101 |
| * rt ----- |
| * rs ----- |
| * rd ----- |
| */ |
| std::string NMD::MULEU_S_PH_QBR(uint64 instruction) |
| { |
| uint64 rt_value = extract_rt_25_24_23_22_21(instruction); |
| uint64 rs_value = extract_rs_20_19_18_17_16(instruction); |
| uint64 rd_value = extract_rd_15_14_13_12_11(instruction); |
| |
| std::string rd = GPR(copy(rd_value)); |
| std::string rs = GPR(copy(rs_value)); |
| std::string rt = GPR(copy(rt_value)); |
| |
| return img::format("MULEU_S.PH.QBR %s, %s, %s", rd, rs, rt); |
| } |
| |
| |
| /* |
| * [DSP] MULQ_RS.PH rd, rs, rt - Multiply vector fractional halfwords |
| * to fractional halfword products |
| * |
| * 3 2 1 |
| * 10987654321098765432109876543210 |
| * 001000 x0100010101 |
| * rt ----- |
| * rs ----- |
| * rd ----- |
| */ |
| std::string NMD::MULQ_RS_PH(uint64 instruction) |
| { |
| uint64 rt_value = extract_rt_25_24_23_22_21(instruction); |
| uint64 rs_value = extract_rs_20_19_18_17_16(instruction); |
| uint64 rd_value = extract_rd_15_14_13_12_11(instruction); |
| |
| std::string rd = GPR(copy(rd_value)); |
| std::string rs = GPR(copy(rs_value)); |
| std::string rt = GPR(copy(rt_value)); |
| |
| return img::format("MULQ_RS.PH %s, %s, %s", rd, rs, rt); |
| } |
| |
| |
| /* |
| * [DSP] MULQ_RS.W rd, rs, rt - Multiply fractional words to same size |
| * product with saturation and rounding |
| * |
| * 3 2 1 |
| * 10987654321098765432109876543210 |
| * 001000 x0110010101 |
| * rt ----- |
| * rs ----- |
| * rd ----- |
| */ |
| std::string NMD::MULQ_RS_W(uint64 instruction) |
| { |
| uint64 rt_value = extract_rt_25_24_23_22_21(instruction); |
| uint64 rs_value = extract_rs_20_19_18_17_16(instruction); |
| uint64 rd_value = extract_rd_15_14_13_12_11(instruction); |
| |
| std::string rd = GPR(copy(rd_value)); |
| std::string rs = GPR(copy(rs_value)); |
| std::string rt = GPR(copy(rt_value)); |
| |
| return img::format("MULQ_RS.W %s, %s, %s", rd, rs, rt); |
| } |
| |
| |
| /* |
| * [DSP] MULQ_S.PH rd, rs, rt - Multiply fractional halfwords to same size |
| * products |
| * |
| * 3 2 1 |
| * 10987654321098765432109876543210 |
| * 001000 x0101010101 |
| * rt ----- |
| * rs ----- |
| * rd ----- |
| */ |
| std::string NMD::MULQ_S_PH(uint64 instruction) |
| { |
| uint64 rt_value = extract_rt_25_24_23_22_21(instruction); |
| uint64 rs_value = extract_rs_20_19_18_17_16(instruction); |
| uint64 rd_value = extract_rd_15_14_13_12_11(instruction); |
| |
| std::string rd = GPR(copy(rd_value)); |
| std::string rs = GPR(copy(rs_value)); |
| std::string rt = GPR(copy(rt_value)); |
| |
| return img::format("MULQ_S.PH %s, %s, %s", rd, rs, rt); |
| } |
| |
| |
| /* |
| * [DSP] MULQ_S.W rd, rs, rt - Multiply fractional words to same size product |
| * with saturation |
| * |
| * 3 2 1 |
| * 10987654321098765432109876543210 |
| * 001000 x0111010101 |
| * rt ----- |
| * rs ----- |
| * rd ----- |
| */ |
| std::string NMD::MULQ_S_W(uint64 instruction) |
| { |
| uint64 rt_value = extract_rt_25_24_23_22_21(instruction); |
| uint64 rs_value = extract_rs_20_19_18_17_16(instruction); |
| uint64 rd_value = extract_rd_15_14_13_12_11(instruction); |
| |
| std::string rd = GPR(copy(rd_value)); |
| std::string rs = GPR(copy(rs_value)); |
| std::string rt = GPR(copy(rt_value)); |
| |
| return img::format("MULQ_S.W %s, %s, %s", rd, rs, rt); |
| } |
| |
| |
| /* |
| * [DSP] MULSA.W.PH ac, rs, rt - Multiply and subtract vector integer halfword |
| * elements and accumulate |
| * |
| * 3 2 1 |
| * 10987654321098765432109876543210 |
| * 001000 10110010111111 |
| * rt ----- |
| * rs ----- |
| * ac -- |
| */ |
| std::string NMD::MULSA_W_PH(uint64 instruction) |
| { |
| uint64 rt_value = extract_rt_25_24_23_22_21(instruction); |
| uint64 rs_value = extract_rs_20_19_18_17_16(instruction); |
| uint64 ac_value = extract_ac_15_14(instruction); |
| |
| std::string ac = AC(copy(ac_value)); |
| std::string rs = GPR(copy(rs_value)); |
| std::string rt = GPR(copy(rt_value)); |
| |
| return img::format("MULSA.W.PH %s, %s, %s", ac, rs, rt); |
| } |
| |
| |
| /* |
| * [DSP] MULSAQ_S.W.PH ac, rs, rt - Multiply and subtract vector fractional |
| * halfwords and accumulate |
| * |
| * 3 2 1 |
| * 10987654321098765432109876543210 |
| * 001000 11110010111111 |
| * rt ----- |
| * rs ----- |
| * ac -- |
| */ |
| std::string NMD::MULSAQ_S_W_PH(uint64 instruction) |
| { |
| uint64 rt_value = extract_rt_25_24_23_22_21(instruction); |
| uint64 rs_value = extract_rs_20_19_18_17_16(instruction); |
| uint64 ac_value = extract_ac_15_14(instruction); |
| |
| std::string ac = AC(copy(ac_value)); |
| std::string rs = GPR(copy(rs_value)); |
| std::string rt = GPR(copy(rt_value)); |
| |
| return img::format("MULSAQ_S.W.PH %s, %s, %s", ac, rs, rt); |
| } |
| |
| |
| /* |
| * [DSP] MULT ac, rs, rt - Multiply word |
| * |
| * 3 2 1 |
| * 10987654321098765432109876543210 |
| * 001000 00110010111111 |
| * rt ----- |
| * rs ----- |
| * ac -- |
| */ |
| std::string NMD::MULT_DSP_(uint64 instruction) |
| { |
| uint64 rt_value = extract_rt_25_24_23_22_21(instruction); |
| uint64 rs_value = extract_rs_20_19_18_17_16(instruction); |
| uint64 ac_value = extract_ac_15_14(instruction); |
| |
| std::string ac = AC(copy(ac_value)); |
| std::string rs = GPR(copy(rs_value)); |
| std::string rt = GPR(copy(rt_value)); |
| |
| return img::format("MULT %s, %s, %s", ac, rs, rt); |
| } |
| |
| |
| /* |
| * [DSP] MULTU ac, rs, rt - Multiply unsigned word |
| * |
| * 3 2 1 |
| * 10987654321098765432109876543210 |
| * 001000 01110010111111 |
| * rt ----- |
| * rs ----- |
| * ac -- |
| */ |
| std::string NMD::MULTU_DSP_(uint64 instruction) |
| { |
| uint64 rt_value = extract_rt_25_24_23_22_21(instruction); |
| uint64 rs_value = extract_rs_20_19_18_17_16(instruction); |
| uint64 ac_value = extract_ac_15_14(instruction); |
| |
| std::string ac = AC(copy(ac_value)); |
| std::string rs = GPR(copy(rs_value)); |
| std::string rt = GPR(copy(rt_value)); |
| |
| return img::format("MULTU %s, %s, %s", ac, rs, rt); |
| } |
| |
| |
| /* |
| * ADDQH_R.W rd, rt, rs - Add Fractional Words And Shift Right to Halve Results |
| * |
| * 3 2 1 |
| * 10987654321098765432109876543210 |
| * 001000 00010001101 |
| * rt ----- |
| * rs ----- |
| * rd ----- |
| */ |
| std::string NMD::MULU(uint64 instruction) |
| { |
| uint64 rt_value = extract_rt_25_24_23_22_21(instruction); |
| uint64 rs_value = extract_rs_20_19_18_17_16(instruction); |
| uint64 rd_value = extract_rd_15_14_13_12_11(instruction); |
| |
| std::string rd = GPR(copy(rd_value)); |
| std::string rs = GPR(copy(rs_value)); |
| std::string rt = GPR(copy(rt_value)); |
| |
| return img::format("MULU %s, %s, %s", rd, rs, rt); |
| } |
| |
| |
| /* |
| * ADDQH_R.W rd, rt, rs - Add Fractional Words And Shift Right to Halve Results |
| * |
| * 3 2 1 |
| * 10987654321098765432109876543210 |
| * 001000 00010001101 |
| * rt ----- |
| * rs ----- |
| * rd ----- |
| */ |
| std::string NMD::NEG_D(uint64 instruction) |
| { |
| uint64 ft_value = extract_ft_25_24_23_22_21(instruction); |
| uint64 fs_value = extract_fs_20_19_18_17_16(instruction); |
| |
| std::string ft = FPR(copy(ft_value)); |
| std::string fs = FPR(copy(fs_value)); |
| |
| return img::format("NEG.D %s, %s", ft, fs); |
| } |
| |
| |
| /* |
| * ADDQH_R.W rd, rt, rs - Add Fractional Words And Shift Right to Halve Results |
| * |
| * 3 2 1 |
| * 10987654321098765432109876543210 |
| * 001000 00010001101 |
| * rt ----- |
| * rs ----- |
| * rd ----- |
| */ |
| std::string NMD::NEG_S(uint64 instruction) |
| { |
| uint64 ft_value = extract_ft_25_24_23_22_21(instruction); |
| uint64 fs_value = extract_fs_20_19_18_17_16(instruction); |
| |
| std::string ft = FPR(copy(ft_value)); |
| std::string fs = FPR(copy(fs_value)); |
| |
| return img::format("NEG.S %s, %s", ft, fs); |
| } |
| |
| |
| /* |
| * ADDQH_R.W rd, rt, rs - Add Fractional Words And Shift Right to Halve Results |
| * |
| * 3 2 1 |
| * 10987654321098765432109876543210 |
| * 001000 00010001101 |
| * rt ----- |
| * rs ----- |
| * rd ----- |
| */ |
| std::string NMD::NOP_16_(uint64 instruction) |
| { |
| (void)instruction; |
| |
| return "NOP "; |
| } |
| |
| |
| /* |
| * ADDQH_R.W rd, rt, rs - Add Fractional Words And Shift Right to Halve Results |
| * |
| * 3 2 1 |
| * 10987654321098765432109876543210 |
| * 001000 00010001101 |
| * rt ----- |
| * rs ----- |
| * rd ----- |
| */ |
| std::string NMD::NOP_32_(uint64 instruction) |
| { |
| (void)instruction; |
| |
| return "NOP "; |
| } |
| |
| |
| /* |
| * ADDQH_R.W rd, rt, rs - Add Fractional Words And Shift Right to Halve Results |
| * |
| * 3 2 1 |
| * 10987654321098765432109876543210 |
| * 001000 00010001101 |
| * rt ----- |
| * rs ----- |
| * rd ----- |
| */ |
| std::string NMD::NOR(uint64 instruction) |
| { |
| uint64 rt_value = extract_rt_25_24_23_22_21(instruction); |
| uint64 rs_value = extract_rs_20_19_18_17_16(instruction); |
| uint64 rd_value = extract_rd_15_14_13_12_11(instruction); |
| |
| std::string rd = GPR(copy(rd_value)); |
| std::string rs = GPR(copy(rs_value)); |
| std::string rt = GPR(copy(rt_value)); |
| |
| return img::format("NOR %s, %s, %s", rd, rs, rt); |
| } |
| |
| |
| /* |
| * ADDQH_R.W rd, rt, rs - Add Fractional Words And Shift Right to Halve Results |
| * |
| * 3 2 1 |
| * 10987654321098765432109876543210 |
| * 001000 00010001101 |
| * rt ----- |
| * rs ----- |
| * rd ----- |
| */ |
| std::string NMD::NOT_16_(uint64 instruction) |
| { |
| uint64 rt3_value = extract_rt3_9_8_7(instruction); |
| uint64 rs3_value = extract_rs3_6_5_4(instruction); |
| |
| std::string rt3 = GPR(decode_gpr_gpr3(rt3_value)); |
| std::string rs3 = GPR(decode_gpr_gpr3(rs3_value)); |
| |
| return img::format("NOT %s, %s", rt3, rs3); |
| } |
| |
| |
| /* |
| * ADDQH_R.W rd, rt, rs - Add Fractional Words And Shift Right to Halve Results |
| * |
| * 3 2 1 |
| * 10987654321098765432109876543210 |
| * 001000 00010001101 |
| * rt ----- |
| * rs ----- |
| * rd ----- |
| */ |
| std::string NMD::OR_16_(uint64 instruction) |
| { |
| uint64 rt3_value = extract_rt3_9_8_7(instruction); |
| uint64 rs3_value = extract_rs3_6_5_4(instruction); |
| |
| std::string rs3 = GPR(decode_gpr_gpr3(rs3_value)); |
| std::string rt3 = GPR(decode_gpr_gpr3(rt3_value)); |
| |
| return img::format("OR %s, %s", rs3, rt3); |
| } |
| |
| |
| /* |
| * ADDQH_R.W rd, rt, rs - Add Fractional Words And Shift Right to Halve Results |
| * |
| * 3 2 1 |
| * 10987654321098765432109876543210 |
| * 001000 00010001101 |
| * rt ----- |
| * rs ----- |
| * rd ----- |
| */ |
| std::string NMD::OR_32_(uint64 instruction) |
| { |
| uint64 rt_value = extract_rt_25_24_23_22_21(instruction); |
| uint64 rs_value = extract_rs_20_19_18_17_16(instruction); |
| uint64 rd_value = extract_rd_15_14_13_12_11(instruction); |
| |
| std::string rd = GPR(copy(rd_value)); |
| std::string rs = GPR(copy(rs_value)); |
| std::string rt = GPR(copy(rt_value)); |
| |
| return img::format("OR %s, %s, %s", rd, rs, rt); |
| } |
| |
| |
| /* |
| * ADDQH_R.W rd, rt, rs - Add Fractional Words And Shift Right to Halve Results |
| * |
| * 3 2 1 |
| * 10987654321098765432109876543210 |
| * 001000 00010001101 |
| * rt ----- |
| * rs ----- |
| * rd ----- |
| */ |
| std::string NMD::ORI(uint64 instruction) |
| { |
| uint64 rt_value = extract_rt_25_24_23_22_21(instruction); |
| uint64 rs_value = extract_rs_20_19_18_17_16(instruction); |
| uint64 u_value = extract_u_11_10_9_8_7_6_5_4_3_2_1_0(instruction); |
| |
| std::string rt = GPR(copy(rt_value)); |
| std::string rs = GPR(copy(rs_value)); |
| std::string u = IMMEDIATE(copy(u_value)); |
| |
| return img::format("ORI %s, %s, %s", rt, rs, u); |
| } |
| |
| |
| /* |
| * [DSP] PACKRL.PH rd, rs, rt - Pack a word using the right halfword from one |
| * source register and left halfword from another source register |
| * |
| * 3 2 1 |
| * 10987654321098765432109876543210 |
| * 001000 00010001101 |
| * rt ----- |
| * rs ----- |
| * rd ----- |
| */ |
| std::string NMD::PACKRL_PH(uint64 instruction) |
| { |
| uint64 rt_value = extract_rt_25_24_23_22_21(instruction); |
| uint64 rs_value = extract_rs_20_19_18_17_16(instruction); |
| uint64 rd_value = extract_rd_15_14_13_12_11(instruction); |
| |
| std::string rd = GPR(copy(rd_value)); |
| std::string rs = GPR(copy(rs_value)); |
| std::string rt = GPR(copy(rt_value)); |
| |
| return img::format("PACKRL.PH %s, %s, %s", rd, rs, rt); |
| } |
| |
| |
| /* |
| * ADDQH_R.W rd, rt, rs - Add Fractional Words And Shift Right to Halve Results |
| * |
| * 3 2 1 |
| * 10987654321098765432109876543210 |
| * 001000 00010001101 |
| * rt ----- |
| * rs ----- |
| * rd ----- |
| */ |
| std::string NMD::PAUSE(uint64 instruction) |
| { |
| (void)instruction; |
| |
| return "PAUSE "; |
| } |
| |
| |
| /* |
| * [DSP] PICK.PH rd, rs, rt - Pick a vector of halfwords based on condition |
| * code bits |
| * |
| * 3 2 1 |
| * 10987654321098765432109876543210 |
| * 001000 00010001101 |
| * rt ----- |
| * rs ----- |
| * rd ----- |
| */ |
| std::string NMD::PICK_PH(uint64 instruction) |
| { |
| uint64 rt_value = extract_rt_25_24_23_22_21(instruction); |
| uint64 rs_value = extract_rs_20_19_18_17_16(instruction); |
| uint64 rd_value = extract_rd_15_14_13_12_11(instruction); |
| |
| std::string rd = GPR(copy(rd_value)); |
| std::string rs = GPR(copy(rs_value)); |
| std::string rt = GPR(copy(rt_value)); |
| |
| return img::format("PICK.PH %s, %s, %s", rd, rs, rt); |
| } |
| |
| |
| /* |
| * [DSP] PICK.QB rd, rs, rt - Pick a vector of byte values based on condition |
| * code bits |
| * |
| * 3 2 1 |
| * 10987654321098765432109876543210 |
| * 001000 00010001101 |
| * rt ----- |
| * rs ----- |
| * rd ----- |
| */ |
| std::string NMD::PICK_QB(uint64 instruction) |
| { |
| uint64 rt_value = extract_rt_25_24_23_22_21(instruction); |
| uint64 rs_value = extract_rs_20_19_18_17_16(instruction); |
| uint64 rd_value = extract_rd_15_14_13_12_11(instruction); |
| |
| std::string rd = GPR(copy(rd_value)); |
| std::string rs = GPR(copy(rs_value)); |
| std::string rt = GPR(copy(rt_value)); |
| |
| return img::format("PICK.QB %s, %s, %s", rd, rs, rt); |
| } |
| |
| |
| /* |
| * [DSP] PRECEQ.W.PHL rt, rs - Expand the precision of the left-most element |
| * of a paired halfword |
| * |
| * 3 2 1 |
| * 10987654321098765432109876543210 |
| * 001000 00010001101 |
| * rt ----- |
| * rs ----- |
| * rd ----- |
| */ |
| std::string NMD::PRECEQ_W_PHL(uint64 instruction) |
| { |
| uint64 rt_value = extract_rt_25_24_23_22_21(instruction); |
| uint64 rs_value = extract_rs_20_19_18_17_16(instruction); |
| |
| std::string rt = GPR(copy(rt_value)); |
| std::string rs = GPR(copy(rs_value)); |
| |
| return img::format("PRECEQ.W.PHL %s, %s", rt, rs); |
| } |
| |
| |
| /* |
| * [DSP] PRECEQ.W.PHR rt, rs - Expand the precision of the right-most element |
| * of a paired halfword |
| * |
| * 3 2 1 |
| * 10987654321098765432109876543210 |
| * 001000 00010001101 |
| * rt ----- |
| * rs ----- |
| * rd ----- |
| */ |
| std::string NMD::PRECEQ_W_PHR(uint64 instruction) |
| { |
| uint64 rt_value = extract_rt_25_24_23_22_21(instruction); |
| uint64 rs_value = extract_rs_20_19_18_17_16(instruction); |
| |
| std::string rt = GPR(copy(rt_value)); |
| std::string rs = GPR(copy(rs_value)); |
| |
| return img::format("PRECEQ.W.PHR %s, %s", rt, rs); |
| } |
| |
| |
| /* |
| * [DSP] PRECEQU.PH.QBLA rt, rs - Expand the precision of the two |
| * left-alternate elements of a quad byte vector |
| * |
| * 3 2 1 |
| * 10987654321098765432109876543210 |
| * 001000 00010001101 |
| * rt ----- |
| * rs ----- |
| * rd ----- |
| */ |
| std::string NMD::PRECEQU_PH_QBLA(uint64 instruction) |
| { |
| uint64 rt_value = extract_rt_25_24_23_22_21(instruction); |
| uint64 rs_value = extract_rs_20_19_18_17_16(instruction); |
| |
| std::string rt = GPR(copy(rt_value)); |
| std::string rs = GPR(copy(rs_value)); |
| |
| return img::format("PRECEQU.PH.QBLA %s, %s", rt, rs); |
| } |
| |
| |
| /* |
| * [DSP] PRECEQU.PH.QBL rt, rs - Expand the precision of the two left-most |
| * elements of a quad byte vector |
| * |
| * 3 2 1 |
| * 10987654321098765432109876543210 |
| * 001000 00010001101 |
| * rt ----- |
| * rs ----- |
| * rd ----- |
| */ |
| std::string NMD::PRECEQU_PH_QBL(uint64 instruction) |
| { |
| uint64 rt_value = extract_rt_25_24_23_22_21(instruction); |
| uint64 rs_value = extract_rs_20_19_18_17_16(instruction); |
| |
| std::string rt = GPR(copy(rt_value)); |
| std::string rs = GPR(copy(rs_value)); |
| |
| return img::format("PRECEQU.PH.QBL %s, %s", rt, rs); |
| } |
| |
| |
| /* |
| * [DSP] PRECEQU.PH.QBRA rt, rs - Expand the precision of the two |
| * right-alternate elements of a quad byte vector |
| * |
| * 3 2 1 |
| * 10987654321098765432109876543210 |
| * 001000 00010001101 |
| * rt ----- |
| * rs ----- |
| * rd ----- |
| */ |
| std::string NMD::PRECEQU_PH_QBRA(uint64 instruction) |
| { |
| uint64 rt_value = extract_rt_25_24_23_22_21(instruction); |
| uint64 rs_value = extract_rs_20_19_18_17_16(instruction); |
| |
| std::string rt = GPR(copy(rt_value)); |
| std::string rs = GPR(copy(rs_value)); |
| |
| return img::format("PRECEQU.PH.QBRA %s, %s", rt, rs); |
| } |
| |
| |
| /* |
| * [DSP] PRECEQU.PH.QBR rt, rs - Expand the precision of the two right-most |
| * elements of a quad byte vector |
| * |
| * 3 2 1 |
| * 10987654321098765432109876543210 |
| * 001000 00010001101 |
| * rt ----- |
| * rs ----- |
| * rd ----- |
| */ |
| std::string NMD::PRECEQU_PH_QBR(uint64 instruction) |
| { |
| uint64 rt_value = extract_rt_25_24_23_22_21(instruction); |
| uint64 rs_value = extract_rs_20_19_18_17_16(instruction); |
| |
| std::string rt = GPR(copy(rt_value)); |
| std::string rs = GPR(copy(rs_value)); |
| |
| return img::format("PRECEQU.PH.QBR %s, %s", rt, rs); |
| } |
| |
| |
| /* |
| * [DSP] PRECEU.PH.QBLA rt, rs - Expand the precision of the two |
| * left-alternate elements of a quad byte vector to four unsigned |
| * halfwords |
| * |
| * 3 2 1 |
| * 10987654321098765432109876543210 |
| * 001000 00010001101 |
| * rt ----- |
| * rs ----- |
| * rd ----- |
| */ |
| std::string NMD::PRECEU_PH_QBLA(uint64 instruction) |
| { |
| uint64 rt_value = extract_rt_25_24_23_22_21(instruction); |
| uint64 rs_value = extract_rs_20_19_18_17_16(instruction); |
| |
| std::string rt = GPR(copy(rt_value)); |
| std::string rs = GPR(copy(rs_value)); |
| |
| return img::format("PRECEU.PH.QBLA %s, %s", rt, rs); |
| } |
| |
| |
| /* |
| * [DSP] PRECEU.PH.QBL rt, rs - Expand the precision of the two left-most |
| * elements of a quad byte vector to form unsigned halfwords |
| * |
| * 3 2 1 |
| * 10987654321098765432109876543210 |
| * 001000 00010001101 |
| * rt ----- |
| * rs ----- |
| * rd ----- |
| */ |
| std::string NMD::PRECEU_PH_QBL(uint64 instruction) |
| { |
| uint64 rt_value = extract_rt_25_24_23_22_21(instruction); |
| uint64 rs_value = extract_rs_20_19_18_17_16(instruction); |
| |
| std::string rt = GPR(copy(rt_value)); |
| std::string rs = GPR(copy(rs_value)); |
| |
| return img::format("PRECEU.PH.QBL %s, %s", rt, rs); |
| } |
| |
| |
| /* |
| * [DSP] PRECEU.PH.QBRA rt, rs - Expand the precision of the two |
| * right-alternate elements of a quad byte vector to form four |
| * unsigned halfwords |
| * |
| * 3 2 1 |
| * 10987654321098765432109876543210 |
| * 001000 00010001101 |
| * rt ----- |
| * rs ----- |
| * rd ----- |
| */ |
| std::string NMD::PRECEU_PH_QBRA(uint64 instruction) |
| { |
| uint64 rt_value = extract_rt_25_24_23_22_21(instruction); |
| uint64 rs_value = extract_rs_20_19_18_17_16(instruction); |
| |
| std::string rt = GPR(copy(rt_value)); |
| std::string rs = GPR(copy(rs_value)); |
| |
| return img::format("PRECEU.PH.QBRA %s, %s", rt, rs); |
| } |
| |
| |
| /* |
| * [DSP] PRECEU.PH.QBR rt, rs - Expand the precision of the two right-most |
| * elements of a quad byte vector to form unsigned halfwords |
| * |
| * 3 2 1 |
| * 10987654321098765432109876543210 |
| * 001000 00010001101 |
| * rt ----- |
| * rs ----- |
| * rd ----- |
| */ |
| std::string NMD::PRECEU_PH_QBR(uint64 instruction) |
| { |
| uint64 rt_value = extract_rt_25_24_23_22_21(instruction); |
| uint64 rs_value = extract_rs_20_19_18_17_16(instruction); |
| |
| std::string rt = GPR(copy(rt_value)); |
| std::string rs = GPR(copy(rs_value)); |
| |
| return img::format("PRECEU.PH.QBR %s, %s", rt, rs); |
| } |
| |
| |
| /* |
| * [DSP] PRECR.QB.PH rd, rs, rt - Reduce the precision of four integer |
| * halfwords to four bytes |
| * |
| * 3 2 1 |
| * 10987654321098765432109876543210 |
| * 001000 x0001101101 |
| * rt ----- |
| * rs ----- |
| * rd ----- |
| */ |
| std::string NMD::PRECR_QB_PH(uint64 instruction) |
| { |
| uint64 rt_value = extract_rt_25_24_23_22_21(instruction); |
| uint64 rs_value = extract_rs_20_19_18_17_16(instruction); |
| uint64 rd_value = extract_rd_15_14_13_12_11(instruction); |
| |
| std::string rd = GPR(copy(rd_value)); |
| std::string rs = GPR(copy(rs_value)); |
| std::string rt = GPR(copy(rt_value)); |
| |
| return img::format("PRECR.QB.PH %s, %s, %s", rd, rs, rt); |
| } |
| |
| |
| /* |
| * [DSP] PRECR_SRA.PH.W rt, rs, sa - Reduce the precision of two integer |
| * words to halfwords after a right shift |
| * |
| * 3 2 1 |
| * 10987654321098765432109876543210 |
| * 001000 x1110000101 |
| * rt ----- |
| * rs ----- |
| * rd ----- |
| */ |
| std::string NMD::PRECR_SRA_PH_W(uint64 instruction) |
| { |
| uint64 rt_value = extract_rt_25_24_23_22_21(instruction); |
| uint64 rs_value = extract_rs_20_19_18_17_16(instruction); |
| uint64 sa_value = extract_sa_15_14_13_12_11(instruction); |
| |
| std::string rt = GPR(copy(rt_value)); |
| std::string rs = GPR(copy(rs_value)); |
| std::string sa = IMMEDIATE(copy(sa_value)); |
| |
| return img::format("PRECR_SRA.PH.W %s, %s, %s", rt, rs, sa); |
| } |
| |
| |
| /* |
| * [DSP] PRECR_SRA_R.PH.W rt, rs, sa - Reduce the precision of two integer |
| * words to halfwords after a right shift with rounding |
| * |
| * 3 2 1 |
| * 10987654321098765432109876543210 |
| * 001000 x1110000101 |
| * rt ----- |
| * rs ----- |
| * rd ----- |
| */ |
| std::string NMD::PRECR_SRA_R_PH_W(uint64 instruction) |
| { |
| uint64 rt_value = extract_rt_25_24_23_22_21(instruction); |
| uint64 rs_value = extract_rs_20_19_18_17_16(instruction); |
| uint64 sa_value = extract_sa_15_14_13_12_11(instruction); |
| |
| std::string rt = GPR(copy(rt_value)); |
| std::string rs = GPR(copy(rs_value)); |
| std::string sa = IMMEDIATE(copy(sa_value)); |
| |
| return img::format("PRECR_SRA_R.PH.W %s, %s, %s", rt, rs, sa); |
| } |
| |
| |
| /* |
| * [DSP] PRECRQ.PH.W rd, rs, rt - Reduce the precision of fractional |
| * words to fractional halfwords |
| * |
| * 3 2 1 |
| * 10987654321098765432109876543210 |
| * 001000 x1110000101 |
| * rt ----- |
| * rs ----- |
| * rd ----- |
| */ |
| std::string NMD::PRECRQ_PH_W(uint64 instruction) |
| { |
| uint64 rt_value = extract_rt_25_24_23_22_21(instruction); |
| uint64 rs_value = extract_rs_20_19_18_17_16(instruction); |
| uint64 rd_value = extract_rd_15_14_13_12_11(instruction); |
| |
| std::string rd = GPR(copy(rd_value)); |
| std::string rs = GPR(copy(rs_value)); |
| std::string rt = GPR(copy(rt_value)); |
| |
| return img::format("PRECRQ.PH.W %s, %s, %s", rd, rs, rt); |
| } |
| |
| |
| /* |
| * [DSP] PRECRQ.QB.PH rd, rs, rt - Reduce the precision of four fractional |
| * halfwords to four bytes |
| * |
| * 3 2 1 |
| * 10987654321098765432109876543210 |
| * 001000 x0010101101 |
| * rt ----- |
| * rs ----- |
| * rd ----- |
| */ |
| std::string NMD::PRECRQ_QB_PH(uint64 instruction) |
| { |
| uint64 rt_value = extract_rt_25_24_23_22_21(instruction); |
| uint64 rs_value = extract_rs_20_19_18_17_16(instruction); |
| uint64 rd_value = extract_rd_15_14_13_12_11(instruction); |
| |
| std::string rd = GPR(copy(rd_value)); |
| std::string rs = GPR(copy(rs_value)); |
| std::string rt = GPR(copy(rt_value)); |
| |
| return img::format("PRECRQ.QB.PH %s, %s, %s", rd, rs, rt); |
| } |
| |
| |
| /* |
| * [DSP] PRECRQ_RS.PH.W rd, rs, rt - Reduce the precision of fractional |
| * words to halfwords with rounding and saturation |
| * |
| * 3 2 1 |
| * 10987654321098765432109876543210 |
| * 001000 x1110000101 |
| * rt ----- |
| * rs ----- |
| * rd ----- |
| */ |
| std::string NMD::PRECRQ_RS_PH_W(uint64 instruction) |
| { |
| uint64 rt_value = extract_rt_25_24_23_22_21(instruction); |
| uint64 rs_value = extract_rs_20_19_18_17_16(instruction); |
| uint64 rd_value = extract_rd_15_14_13_12_11(instruction); |
| |
| std::string rd = GPR(copy(rd_value)); |
| std::string rs = GPR(copy(rs_value)); |
| std::string rt = GPR(copy(rt_value)); |
| |
| return img::format("PRECRQ_RS.PH.W %s, %s, %s", rd, rs, rt); |
| } |
| |
| |
| /* |
| * [DSP] PRECRQU_S.QB.PH rd, rs, rt - Reduce the precision of fractional |
| * halfwords to unsigned bytes with saturation |
| * |
| * 3 2 1 |
| * 10987654321098765432109876543210 |
| * 001000 x1110000101 |
| * rt ----- |
| * rs ----- |
| * rd ----- |
| */ |
| std::string NMD::PRECRQU_S_QB_PH(uint64 instruction) |
| { |
| uint64 rt_value = extract_rt_25_24_23_22_21(instruction); |
| uint64 rs_value = extract_rs_20_19_18_17_16(instruction); |
| uint64 rd_value = extract_rd_15_14_13_12_11(instruction); |
| |
| std::string rd = GPR(copy(rd_value)); |
| std::string rs = GPR(copy(rs_value)); |
| std::string rt = GPR(copy(rt_value)); |
| |
| return img::format("PRECRQU_S.QB.PH %s, %s, %s", rd, rs, rt); |
| } |
| |
| |
| /* |
| * |
| * |
| * 3 2 1 |
| * 10987654321098765432109876543210 |
| * 001000 x1110000101 |
| * rt ----- |
| * rs ----- |
| * rd ----- |
| */ |
| std::string NMD::PREF_S9_(uint64 instruction) |
| { |
| uint64 hint_value = extract_hint_25_24_23_22_21(instruction); |
| uint64 rs_value = extract_rs_20_19_18_17_16(instruction); |
| int64 s_value = extract_s__se8_15_7_6_5_4_3_2_1_0(instruction); |
| |
| std::string hint = IMMEDIATE(copy(hint_value)); |
| std::string s = IMMEDIATE(copy(s_value)); |
| std::string rs = GPR(copy(rs_value)); |
| |
| return img::format("PREF %s, %s(%s)", hint, s, rs); |
| } |
| |
| |
| /* |
| * |
| * |
| * 3 2 1 |
| * 10987654321098765432109876543210 |
| * 001000 x1110000101 |
| * rt ----- |
| * rs ----- |
| * rd ----- |
| */ |
| std::string NMD::PREF_U12_(uint64 instruction) |
| { |
| uint64 hint_value = extract_hint_25_24_23_22_21(instruction); |
| uint64 rs_value = extract_rs_20_19_18_17_16(instruction); |
| uint64 u_value = extract_u_11_10_9_8_7_6_5_4_3_2_1_0(instruction); |
| |
| std::string hint = IMMEDIATE(copy(hint_value)); |
| std::string u = IMMEDIATE(copy(u_value)); |
| std::string rs = GPR(copy(rs_value)); |
| |
| return img::format("PREF %s, %s(%s)", hint, u, rs); |
| } |
| |
| |
| /* |
| * |
| * |
| * 3 2 1 |
| * 10987654321098765432109876543210 |
| * 001000 x1110000101 |
| * rt ----- |
| * rs ----- |
| * rd ----- |
| */ |
| std::string NMD::PREFE(uint64 instruction) |
| { |
| uint64 hint_value = extract_hint_25_24_23_22_21(instruction); |
| uint64 rs_value = extract_rs_20_19_18_17_16(instruction); |
| int64 s_value = extract_s__se8_15_7_6_5_4_3_2_1_0(instruction); |
| |
| std::string hint = IMMEDIATE(copy(hint_value)); |
| std::string s = IMMEDIATE(copy(s_value)); |
| std::string rs = GPR(copy(rs_value)); |
| |
| return img::format("PREFE %s, %s(%s)", hint, s, rs); |
| } |
| |
| |
| /* |
| * [DSP] PREPEND rt, rs, sa - Right shift and prepend bits to the MSB |
| * |
| * 3 2 1 |
| * 10987654321098765432109876543210 |
| * 001000 x1110000101 |
| * rt ----- |
| * rs ----- |
| * rd ----- |
| */ |
| std::string NMD::PREPEND(uint64 instruction) |
| { |
| uint64 rt_value = extract_rt_25_24_23_22_21(instruction); |
| uint64 rs_value = extract_rs_20_19_18_17_16(instruction); |
| uint64 sa_value = extract_sa_15_14_13_12_11(instruction); |
| |
| std::string rt = GPR(copy(rt_value)); |
| std::string rs = GPR(copy(rs_value)); |
| std::string sa = IMMEDIATE(copy(sa_value)); |
| |
| return img::format("PREPEND %s, %s, %s", rt, rs, sa); |
| } |
| |
| |
| /* |
| * [DSP] RADDU.W.QB rt, rs - Unsigned reduction add of vector quad bytes |
| * |
| * 3 2 1 |
| * 10987654321098765432109876543210 |
| * 001000 1111000100111111 |
| * rt ----- |
| * rs ----- |
| */ |
| std::string NMD::RADDU_W_QB(uint64 instruction) |
| { |
| uint64 rt_value = extract_rt_25_24_23_22_21(instruction); |
| uint64 rs_value = extract_rs_20_19_18_17_16(instruction); |
| |
| std::string rt = GPR(copy(rt_value)); |
| std::string rs = GPR(copy(rs_value)); |
| |
| return img::format("RADDU.W.QB %s, %s", rt, rs); |
| } |
| |
| |
| /* |
| * [DSP] RDDSP rt, mask - Read DSPControl register fields to a GPR |
| * |
| * 3 2 1 |
| * 10987654321098765432109876543210 |
| * 001000 00011001111111 |
| * rt ----- |
| * mask ------- |
| */ |
| std::string NMD::RDDSP(uint64 instruction) |
| { |
| uint64 rt_value = extract_rt_25_24_23_22_21(instruction); |
| uint64 mask_value = extract_mask_20_19_18_17_16_15_14(instruction); |
| |
| std::string rt = GPR(copy(rt_value)); |
| std::string mask = IMMEDIATE(copy(mask_value)); |
| |
| return img::format("RDDSP %s, %s", rt, mask); |
| } |
| |
| |
| /* |
| * |
| * |
| * 3 2 1 |
| * 10987654321098765432109876543210 |
| * 001000 x1110000101 |
| * rt ----- |
| * rs ----- |
| * rd ----- |
| */ |
| std::string NMD::RDHWR(uint64 instruction) |
| { |
| uint64 rt_value = extract_rt_25_24_23_22_21(instruction); |
| uint64 hs_value = extract_hs_20_19_18_17_16(instruction); |
| uint64 sel_value = extract_sel_13_12_11(instruction); |
| |
| std::string rt = GPR(copy(rt_value)); |
| std::string hs = CPR(copy(hs_value)); |
| std::string sel = IMMEDIATE(copy(sel_value)); |
| |
| return img::format("RDHWR %s, %s, %s", rt, hs, sel); |
| } |
| |
| |
| /* |
| * |
| * |
| * 3 2 1 |
| * 10987654321098765432109876543210 |
| * 001000 x1110000101 |
| * rt ----- |
| * rs ----- |
| * rd ----- |
| */ |
| std::string NMD::RDPGPR(uint64 instruction) |
| { |
| uint64 rt_value = extract_rt_25_24_23_22_21(instruction); |
| uint64 rs_value = extract_rs_20_19_18_17_16(instruction); |
| |
| std::string rt = GPR(copy(rt_value)); |
| std::string rs = GPR(copy(rs_value)); |
| |
| return img::format("RDPGPR %s, %s", rt, rs); |
| } |
| |
| |
| /* |
| * |
| * |
| * 3 2 1 |
| * 10987654321098765432109876543210 |
| * 001000 x1110000101 |
| * rt ----- |
| * rs ----- |
| * rd ----- |
| */ |
| std::string NMD::RECIP_D(uint64 instruction) |
| { |
| uint64 ft_value = extract_ft_25_24_23_22_21(instruction); |
| uint64 fs_value = extract_fs_20_19_18_17_16(instruction); |
| |
| std::string ft = FPR(copy(ft_value)); |
| std::string fs = FPR(copy(fs_value)); |
| |
| return img::format("RECIP.D %s, %s", ft, fs); |
| } |
| |
| |
| /* |
| * |
| * |
| * 3 2 1 |
| * 10987654321098765432109876543210 |
| * 001000 x1110000101 |
| * rt ----- |
| * rs ----- |
| * rd ----- |
| */ |
| std::string NMD::RECIP_S(uint64 instruction) |
| { |
| uint64 ft_value = extract_ft_25_24_23_22_21(instruction); |
| uint64 fs_value = extract_fs_20_19_18_17_16(instruction); |
| |
| std::string ft = FPR(copy(ft_value)); |
| std::string fs = FPR(copy(fs_value)); |
| |
| return img::format("RECIP.S %s, %s", ft, fs); |
| } |
| |
| |
| /* |
| * [DSP] REPL.PH rd, s - Replicate immediate integer into all vector element |
| * positions |
| * |
| * 3 2 1 |
| * 10987654321098765432109876543210 |
| * 001000 x0000111101 |
| * rt ----- |
| * s ---------- |
| */ |
| std::string NMD::REPL_PH(uint64 instruction) |
| { |
| uint64 rt_value = extract_rt_25_24_23_22_21(instruction); |
| int64 s_value = extract_s__se9_20_19_18_17_16_15_14_13_12_11(instruction); |
| |
| std::string rt = GPR(copy(rt_value)); |
| std::string s = IMMEDIATE(copy(s_value)); |
| |
| return img::format("REPL.PH %s, %s", rt, s); |
| } |
| |
| |
| /* |
| * [DSP] REPL.QB rd, u - Replicate immediate integer into all vector element |
| * positions |
| * |
| * 3 2 1 |
| * 10987654321098765432109876543210 |
| * 001000 x010111111111 |
| * rt ----- |
| * u -------- |
| */ |
| std::string NMD::REPL_QB(uint64 instruction) |
| { |
| uint64 rt_value = extract_rt_25_24_23_22_21(instruction); |
| uint64 u_value = extract_u_20_19_18_17_16_15_14_13(instruction); |
| |
| std::string rt = GPR(copy(rt_value)); |
| std::string u = IMMEDIATE(copy(u_value)); |
| |
| return img::format("REPL.QB %s, %s", rt, u); |
| } |
| |
| |
| /* |
| * [DSP] REPLV.PH rt, rs - Replicate a halfword into all vector element |
| * positions |
| * |
| * 3 2 1 |
| * 10987654321098765432109876543210 |
| * 001000 0000001100111111 |
| * rt ----- |
| * rs ----- |
| */ |
| std::string NMD::REPLV_PH(uint64 instruction) |
| { |
| uint64 rt_value = extract_rt_25_24_23_22_21(instruction); |
| uint64 rs_value = extract_rs_20_19_18_17_16(instruction); |
| |
| std::string rt = GPR(copy(rt_value)); |
| std::string rs = GPR(copy(rs_value)); |
| |
| return img::format("REPLV.PH %s, %s", rt, rs); |
| } |
| |
| |
| /* |
| * [DSP] REPLV.QB rt, rs - Replicate byte into all vector element positions |
| * |
| * 3 2 1 |
| * 10987654321098765432109876543210 |
| * 001000 0001001100111111 |
| * rt ----- |
| * rs ----- |
| */ |
| std::string NMD::REPLV_QB(uint64 instruction) |
| { |
| uint64 rt_value = extract_rt_25_24_23_22_21(instruction); |
| uint64 rs_value = extract_rs_20_19_18_17_16(instruction); |
| |
| std::string rt = GPR(copy(rt_value)); |
| std::string rs = GPR(copy(rs_value)); |
| |
| return img::format("REPLV.QB %s, %s", rt, rs); |
| } |
| |
| |
| /* |
| * |
| * |
| * 3 2 1 |
| * 10987654321098765432109876543210 |
| * 001000 x1110000101 |
| * rt ----- |
| * rs ----- |
| * rd ----- |
| */ |
| std::string NMD::RESTORE_32_(uint64 instruction) |
| { |
| uint64 rt_value = extract_rt_25_24_23_22_21(instruction); |
| uint64 count_value = extract_count_19_18_17_16(instruction); |
| uint64 u_value = extract_u_11_10_9_8_7_6_5_4_3__s3(instruction); |
| uint64 gp_value = extract_gp_2(instruction); |
| |
| std::string u = IMMEDIATE(copy(u_value)); |
| return img::format("RESTORE %s%s", u, |
| save_restore_list(rt_value, count_value, gp_value)); |
| } |
| |
| |
| /* |
| * |
| * |
| * 3 2 1 |
| * 10987654321098765432109876543210 |
| * 001000 x1110000101 |
| * rt ----- |
| * rs ----- |
| * rd ----- |
| */ |
| std::string NMD::RESTORE_JRC_16_(uint64 instruction) |
| { |
| uint64 rt1_value = extract_rtl_11(instruction); |
| uint64 u_value = extract_u_7_6_5_4__s4(instruction); |
| uint64 count_value = extract_count_3_2_1_0(instruction); |
| |
| std::string u = IMMEDIATE(copy(u_value)); |
| return img::format("RESTORE.JRC %s%s", u, |
| save_restore_list(encode_rt1_from_rt(rt1_value), count_value, 0)); |
| } |
| |
| |
| /* |
| * |
| * |
| * 3 2 1 |
| * 10987654321098765432109876543210 |
| * 001000 x1110000101 |
| * rt ----- |
| * rs ----- |
| * rd ----- |
| */ |
| std::string NMD::RESTORE_JRC_32_(uint64 instruction) |
| { |
| uint64 rt_value = extract_rt_25_24_23_22_21(instruction); |
| uint64 count_value = extract_count_19_18_17_16(instruction); |
| uint64 u_value = extract_u_11_10_9_8_7_6_5_4_3__s3(instruction); |
| uint64 gp_value = extract_gp_2(instruction); |
| |
| std::string u = IMMEDIATE(copy(u_value)); |
| return img::format("RESTORE.JRC %s%s", u, |
| save_restore_list(rt_value, count_value, gp_value)); |
| } |
| |
| |
| /* |
| * |
| * |
| * 3 2 1 |
| * 10987654321098765432109876543210 |
| * 001000 x1110000101 |
| * rt ----- |
| * rs ----- |
| * rd ----- |
| */ |
| std::string NMD::RESTOREF(uint64 instruction) |
| { |
| uint64 count_value = extract_count_19_18_17_16(instruction); |
| uint64 u_value = extract_u_11_10_9_8_7_6_5_4_3__s3(instruction); |
| |
| std::string u = IMMEDIATE(copy(u_value)); |
| std::string count = IMMEDIATE(copy(count_value)); |
| |
| return img::format("RESTOREF %s, %s", u, count); |
| } |
| |
| |
| /* |
| * |
| * |
| * 3 2 1 |
| * 10987654321098765432109876543210 |
| * 001000 x1110000101 |
| * rt ----- |
| * rs ----- |
| * rd ----- |
| */ |
| std::string NMD::RINT_D(uint64 instruction) |
| { |
| uint64 ft_value = extract_ft_25_24_23_22_21(instruction); |
| uint64 fs_value = extract_fs_20_19_18_17_16(instruction); |
| |
| std::string ft = FPR(copy(ft_value)); |
| std::string fs = FPR(copy(fs_value)); |
| |
| return img::format("RINT.D %s, %s", ft, fs); |
| } |
| |
| |
| /* |
| * |
| * |
| * 3 2 1 |
| * 10987654321098765432109876543210 |
| * 001000 x1110000101 |
| * rt ----- |
| * rs ----- |
| * rd ----- |
| */ |
| std::string NMD::RINT_S(uint64 instruction) |
| { |
| uint64 ft_value = extract_ft_25_24_23_22_21(instruction); |
| uint64 fs_value = extract_fs_20_19_18_17_16(instruction); |
| |
| std::string ft = FPR(copy(ft_value)); |
| std::string fs = FPR(copy(fs_value)); |
| |
| return img::format("RINT.S %s, %s", ft, fs); |
| } |
| |
| |
| /* |
| * |
| * |
| * 3 2 1 |
| * 10987654321098765432109876543210 |
| * 001000 x1110000101 |
| * rt ----- |
| * rs ----- |
| * rd ----- |
| */ |
| std::string NMD::ROTR(uint64 instruction) |
| { |
| uint64 rt_value = extract_rt_25_24_23_22_21(instruction); |
| uint64 rs_value = extract_rs_20_19_18_17_16(instruction); |
| uint64 shift_value = extract_shift_4_3_2_1_0(instruction); |
| |
| std::string rt = GPR(copy(rt_value)); |
| std::string rs = GPR(copy(rs_value)); |
| std::string shift = IMMEDIATE(copy(shift_value)); |
| |
| return img::format("ROTR %s, %s, %s", rt, rs, shift); |
| } |
| |
| |
| /* |
| * |
| * |
| * 3 2 1 |
| * 10987654321098765432109876543210 |
| * 001000 x1110000101 |
| * rt ----- |
| * rs ----- |
| * rd ----- |
| */ |
| std::string NMD::ROTRV(uint64 instruction) |
| { |
| uint64 rt_value = extract_rt_25_24_23_22_21(instruction); |
| uint64 rs_value = extract_rs_20_19_18_17_16(instruction); |
| uint64 rd_value = extract_rd_15_14_13_12_11(instruction); |
| |
| std::string rd = GPR(copy(rd_value)); |
| std::string rs = GPR(copy(rs_value)); |
| std::string rt = GPR(copy(rt_value)); |
| |
| return img::format("ROTRV %s, %s, %s", rd, rs, rt); |
| } |
| |
| |
| /* |
| * |
| * |
| * 3 2 1 |
| * 10987654321098765432109876543210 |
| * 001000 x1110000101 |
| * rt ----- |
| * rs ----- |
| * rd ----- |
| */ |
| std::string NMD::ROTX(uint64 instruction) |
| { |
| uint64 rt_value = extract_rt_25_24_23_22_21(instruction); |
| uint64 rs_value = extract_rs_20_19_18_17_16(instruction); |
| uint64 shiftx_value = extract_shiftx_10_9_8_7__s1(instruction); |
| uint64 stripe_value = extract_stripe_6(instruction); |
| uint64 shift_value = extract_shift_4_3_2_1_0(instruction); |
| |
| std::string rt = GPR(copy(rt_value)); |
| std::string rs = GPR(copy(rs_value)); |
| std::string shift = IMMEDIATE(copy(shift_value)); |
| std::string shiftx = IMMEDIATE(copy(shiftx_value)); |
| std::string stripe = IMMEDIATE(copy(stripe_value)); |
| |
| return img::format("ROTX %s, %s, %s, %s, %s", |
| rt, rs, shift, shiftx, stripe); |
| } |
| |
| |
| /* |
| * |
| * |
| * 3 2 1 |
| * 10987654321098765432109876543210 |
| * 001000 x1110000101 |
| * rt ----- |
| * rs ----- |
| * rd ----- |
| */ |
| std::string NMD::ROUND_L_D(uint64 instruction) |
| { |
| uint64 ft_value = extract_ft_25_24_23_22_21(instruction); |
| uint64 fs_value = extract_fs_20_19_18_17_16(instruction); |
| |
| std::string ft = FPR(copy(ft_value)); |
| std::string fs = FPR(copy(fs_value)); |
| |
| return img::format("ROUND.L.D %s, %s", ft, fs); |
| } |
| |
| |
| /* |
| * |
| * |
| * 3 2 1 |
| * 10987654321098765432109876543210 |
| * 001000 x1110000101 |
| * rt ----- |
| * rs ----- |
| * rd ----- |
| */ |
| std::string NMD::ROUND_L_S(uint64 instruction) |
| { |
| uint64 ft_value = extract_ft_25_24_23_22_21(instruction); |
| uint64 fs_value = extract_fs_20_19_18_17_16(instruction); |
| |
| std::string ft = FPR(copy(ft_value)); |
| std::string fs = FPR(copy(fs_value)); |
| |
| return img::format("ROUND.L.S %s, %s", ft, fs); |
| } |
| |
| |
| /* |
| * |
| * |
| * 3 2 1 |
| * 10987654321098765432109876543210 |
| * 001000 x1110000101 |
| * rt ----- |
| * rs ----- |
| * rd ----- |
| */ |
| std::string NMD::ROUND_W_D(uint64 instruction) |
| { |
| uint64 ft_value = extract_ft_25_24_23_22_21(instruction); |
| uint64 fs_value = extract_fs_20_19_18_17_16(instruction); |
| |
| std::string ft = FPR(copy(ft_value)); |
| std::string fs = FPR(copy(fs_value)); |
| |
| return img::format("ROUND.W.D %s, %s", ft, fs); |
| } |
| |
| |
| /* |
| * |
| * |
| * 3 2 1 |
| * 10987654321098765432109876543210 |
| * 001000 x1110000101 |
| * rt ----- |
| * rs ----- |
| * rd ----- |
| */ |
| std::string NMD::ROUND_W_S(uint64 instruction) |
| { |
| uint64 ft_value = extract_ft_25_24_23_22_21(instruction); |
| uint64 fs_value = extract_fs_20_19_18_17_16(instruction); |
| |
| std::string ft = FPR(copy(ft_value)); |
| std::string fs = FPR(copy(fs_value)); |
| |
| return img::format("ROUND.W.S %s, %s", ft, fs); |
| } |
| |
| |
| /* |
| * |
| * |
| * 3 2 1 |
| * 10987654321098765432109876543210 |
| * 001000 x1110000101 |
| * rt ----- |
| * rs ----- |
| * rd ----- |
| */ |
| std::string NMD::RSQRT_D(uint64 instruction) |
| { |
| uint64 ft_value = extract_ft_25_24_23_22_21(instruction); |
| uint64 fs_value = extract_fs_20_19_18_17_16(instruction); |
| |
| std::string ft = FPR(copy(ft_value)); |
| std::string fs = FPR(copy(fs_value)); |
| |
| return img::format("RSQRT.D %s, %s", ft, fs); |
| } |
| |
| |
| /* |
| * |
| * |
| * 3 2 1 |
| * 10987654321098765432109876543210 |
| * 001000 x1110000101 |
| * rt ----- |
| * rs ----- |
| * rd ----- |
| */ |
| std::string NMD::RSQRT_S(uint64 instruction) |
| { |
| uint64 ft_value = extract_ft_25_24_23_22_21(instruction); |
| uint64 fs_value = extract_fs_20_19_18_17_16(instruction); |
| |
| std::string ft = FPR(copy(ft_value)); |
| std::string fs = FPR(copy(fs_value)); |
| |
| return img::format("RSQRT.S %s, %s", ft, fs); |
| } |
| |
| |
| /* |
| * |
| * |
| * 3 2 1 |
| * 10987654321098765432109876543210 |
| * 001000 01001001101 |
| * rt ----- |
| * rs ----- |
| * rd ----- |
| */ |
| std::string NMD::SAVE_16_(uint64 instruction) |
| { |
| uint64 rt1_value = extract_rtl_11(instruction); |
| uint64 u_value = extract_u_7_6_5_4__s4(instruction); |
| uint64 count_value = extract_count_3_2_1_0(instruction); |
| |
| std::string u = IMMEDIATE(copy(u_value)); |
| return img::format("SAVE %s%s", u, |
| save_restore_list(encode_rt1_from_rt(rt1_value), count_value, 0)); |
| } |
| |
| |
| /* |
| * |
| * |
| * 3 2 1 |
| * 10987654321098765432109876543210 |
| * 001000 01001001101 |
| * rt ----- |
| * rs ----- |
| * rd ----- |
| */ |
| std::string NMD::SAVE_32_(uint64 instruction) |
| { |
| uint64 count_value = extract_count_19_18_17_16(instruction); |
| uint64 rt_value = extract_rt_25_24_23_22_21(instruction); |
| uint64 u_value = extract_u_11_10_9_8_7_6_5_4_3__s3(instruction); |
| uint64 gp_value = extract_gp_2(instruction); |
| |
| std::string u = IMMEDIATE(copy(u_value)); |
| return img::format("SAVE %s%s", u, |
| save_restore_list(rt_value, count_value, gp_value)); |
| } |
| |
| |
| /* |
| * |
| * |
| * 3 2 1 |
| * 10987654321098765432109876543210 |
| * 001000 01001001101 |
| * rt ----- |
| * rs ----- |
| * rd ----- |
| */ |
| std::string NMD::SAVEF(uint64 instruction) |
| { |
| uint64 count_value = extract_count_19_18_17_16(instruction); |
| uint64 u_value = extract_u_11_10_9_8_7_6_5_4_3__s3(instruction); |
| |
| std::string u = IMMEDIATE(copy(u_value)); |
| std::string count = IMMEDIATE(copy(count_value)); |
| |
| return img::format("SAVEF %s, %s", u, count); |
| } |
| |
| |
| /* |
| * |
| * |
| * 3 2 1 |
| * 10987654321098765432109876543210 |
| * 001000 01001001101 |
| * rt ----- |
| * rs ----- |
| * rd ----- |
| */ |
| std::string NMD::SB_16_(uint64 instruction) |
| { |
| uint64 rtz3_value = extract_rtz3_9_8_7(instruction); |
| uint64 rs3_value = extract_rs3_6_5_4(instruction); |
| uint64 u_value = extract_u_1_0(instruction); |
| |
| std::string rtz3 = GPR(decode_gpr_gpr3_src_store(rtz3_value)); |
| std::string u = IMMEDIATE(copy(u_value)); |
| std::string rs3 = GPR(decode_gpr_gpr3(rs3_value)); |
| |
| return img::format("SB %s, %s(%s)", rtz3, u, rs3); |
| } |
| |
| |
| /* |
| * |
| * |
| * 3 2 1 |
| * 10987654321098765432109876543210 |
| * 001000 01001001101 |
| * rt ----- |
| * rs ----- |
| * rd ----- |
| */ |
| std::string NMD::SB_GP_(uint64 instruction) |
| { |
| uint64 rt_value = extract_rt_25_24_23_22_21(instruction); |
| uint64 u_value = extract_u_17_to_0(instruction); |
| |
| std::string rt = GPR(copy(rt_value)); |
| std::string u = IMMEDIATE(copy(u_value)); |
| |
| return img::format("SB %s, %s($%d)", rt, u, 28); |
| } |
| |
| |
| /* |
| * |
| * |
| * 3 2 1 |
| * 10987654321098765432109876543210 |
| * 001000 01001001101 |
| * rt ----- |
| * rs ----- |
| * rd ----- |
| */ |
| std::string NMD::SB_S9_(uint64 instruction) |
| { |
| uint64 rt_value = extract_rt_25_24_23_22_21(instruction); |
| uint64 rs_value = extract_rs_20_19_18_17_16(instruction); |
| int64 s_value = extract_s__se8_15_7_6_5_4_3_2_1_0(instruction); |
| |
| std::string rt = GPR(copy(rt_value)); |
| std::string s = IMMEDIATE(copy(s_value)); |
| std::string rs = GPR(copy(rs_value)); |
| |
| return img::format("SB %s, %s(%s)", rt, s, rs); |
| } |
| |
| |
| /* |
| * |
| * |
| * 3 2 1 |
| * 10987654321098765432109876543210 |
| * 001000 01001001101 |
| * rt ----- |
| * rs ----- |
| * rd ----- |
| */ |
| std::string NMD::SB_U12_(uint64 instruction) |
| { |
| uint64 rt_value = extract_rt_25_24_23_22_21(instruction); |
| uint64 rs_value = extract_rs_20_19_18_17_16(instruction); |
| uint64 u_value = extract_u_11_10_9_8_7_6_5_4_3_2_1_0(instruction); |
| |
| std::string rt = GPR(copy(rt_value)); |
| std::string u = IMMEDIATE(copy(u_value)); |
| std::string rs = GPR(copy(rs_value)); |
| |
| return img::format("SB %s, %s(%s)", rt, u, rs); |
| } |
| |
| |
| /* |
| * |
| * |
| * 3 2 1 |
| * 10987654321098765432109876543210 |
| * 001000 01001001101 |
| * rt ----- |
| * rs ----- |
| * rd ----- |
| */ |
| std::string NMD::SBE(uint64 instruction) |
| { |
| uint64 rt_value = extract_rt_25_24_23_22_21(instruction); |
| uint64 rs_value = extract_rs_20_19_18_17_16(instruction); |
| int64 s_value = extract_s__se8_15_7_6_5_4_3_2_1_0(instruction); |
| |
| std::string rt = GPR(copy(rt_value)); |
| std::string s = IMMEDIATE(copy(s_value)); |
| std::string rs = GPR(copy(rs_value)); |
| |
| return img::format("SBE %s, %s(%s)", rt, s, rs); |
| } |
| |
| |
| /* |
| * |
| * |
| * 3 2 1 |
| * 10987654321098765432109876543210 |
| * 001000 01001001101 |
| * rt ----- |
| * rs ----- |
| * rd ----- |
| */ |
| std::string NMD::SBX(uint64 instruction) |
| { |
| uint64 rt_value = extract_rt_25_24_23_22_21(instruction); |
| uint64 rs_value = extract_rs_20_19_18_17_16(instruction); |
| uint64 rd_value = extract_rd_15_14_13_12_11(instruction); |
| |
| std::string rd = GPR(copy(rd_value)); |
| std::string rs = GPR(copy(rs_value)); |
| std::string rt = GPR(copy(rt_value)); |
| |
| return img::format("SBX %s, %s(%s)", rd, rs, rt); |
| } |
| |
| |
| /* |
| * |
| * |
| * 3 2 1 |
| * 10987654321098765432109876543210 |
| * 001000 01001001101 |
| * rt ----- |
| * rs ----- |
| * rd ----- |
| */ |
| std::string NMD::SC(uint64 instruction) |
| { |
| uint64 rt_value = extract_rt_25_24_23_22_21(instruction); |
| uint64 rs_value = extract_rs_20_19_18_17_16(instruction); |
| int64 s_value = extract_s__se8_15_7_6_5_4_3_2_s2(instruction); |
| |
| std::string rt = GPR(copy(rt_value)); |
| std::string s = IMMEDIATE(copy(s_value)); |
| std::string rs = GPR(copy(rs_value)); |
| |
| return img::format("SC %s, %s(%s)", rt, s, rs); |
| } |
| |
| |
| /* |
| * |
| * |
| * 3 2 1 |
| * 10987654321098765432109876543210 |
| * 001000 01001001101 |
| * rt ----- |
| * rs ----- |
| * rd ----- |
| */ |
| std::string NMD::SCD(uint64 instruction) |
| { |
| uint64 rt_value = extract_rt_25_24_23_22_21(instruction); |
| uint64 rs_value = extract_rs_20_19_18_17_16(instruction); |
| int64 s_value = extract_s__se8_15_7_6_5_4_3_s3(instruction); |
| |
| std::string rt = GPR(copy(rt_value)); |
| std::string s = IMMEDIATE(copy(s_value)); |
| std::string rs = GPR(copy(rs_value)); |
| |
| return img::format("SCD %s, %s(%s)", rt, s, rs); |
| } |
| |
| |
| /* |
| * |
| * |
| * 3 2 1 |
| * 10987654321098765432109876543210 |
| * 001000 01001001101 |
| * rt ----- |
| * rs ----- |
| * rd ----- |
| */ |
| std::string NMD::SCDP(uint64 instruction) |
| { |
| uint64 rt_value = extract_rt_25_24_23_22_21(instruction); |
| uint64 rs_value = extract_rs_20_19_18_17_16(instruction); |
| uint64 ru_value = extract_ru_7_6_5_4_3(instruction); |
| |
| std::string rt = GPR(copy(rt_value)); |
| std::string ru = GPR(copy(ru_value)); |
| std::string rs = GPR(copy(rs_value)); |
| |
| return img::format("SCDP %s, %s, (%s)", rt, ru, rs); |
| } |
| |
| |
| /* |
| * |
| * |
| * 3 2 1 |
| * 10987654321098765432109876543210 |
| * 001000 01001001101 |
| * rt ----- |
| * rs ----- |
| * rd ----- |
| */ |
| std::string NMD::SCE(uint64 instruction) |
| { |
| uint64 rt_value = extract_rt_25_24_23_22_21(instruction); |
| uint64 rs_value = extract_rs_20_19_18_17_16(instruction); |
| int64 s_value = extract_s__se8_15_7_6_5_4_3_2_s2(instruction); |
| |
| std::string rt = GPR(copy(rt_value)); |
| std::string s = IMMEDIATE(copy(s_value)); |
| std::string rs = GPR(copy(rs_value)); |
| |
| return img::format("SCE %s, %s(%s)", rt, s, rs); |
| } |
| |
| |
| /* |
| * |
| * |
| * 3 2 1 |
| * 10987654321098765432109876543210 |
| * 001000 01001001101 |
| * rt ----- |
| * rs ----- |
| * rd ----- |
| */ |
| std::string NMD::SCWP(uint64 instruction) |
| { |
| uint64 rt_value = extract_rt_25_24_23_22_21(instruction); |
| uint64 rs_value = extract_rs_20_19_18_17_16(instruction); |
| uint64 ru_value = extract_ru_7_6_5_4_3(instruction); |
| |
| std::string rt = GPR(copy(rt_value)); |
| std::string ru = GPR(copy(ru_value)); |
| std::string rs = GPR(copy(rs_value)); |
| |
| return img::format("SCWP %s, %s, (%s)", rt, ru, rs); |
| } |
| |
| |
| /* |
| * |
| * |
| * 3 2 1 |
| * 10987654321098765432109876543210 |
| * 001000 01001001101 |
| * rt ----- |
| * rs ----- |
| * rd ----- |
| */ |
| std::string NMD::SCWPE(uint64 instruction) |
| { |
| uint64 rt_value = extract_rt_25_24_23_22_21(instruction); |
| uint64 rs_value = extract_rs_20_19_18_17_16(instruction); |
| uint64 ru_value = extract_ru_7_6_5_4_3(instruction); |
| |
| std::string rt = GPR(copy(rt_value)); |
| std::string ru = GPR(copy(ru_value)); |
| std::string rs = GPR(copy(rs_value)); |
| |
| return img::format("SCWPE %s, %s, (%s)", rt, ru, rs); |
| } |
| |
| |
| /* |
| * |
| * |
| * 3 2 1 |
| * 10987654321098765432109876543210 |
| * 001000 01001001101 |
| * rt ----- |
| * rs ----- |
| * rd ----- |
| */ |
| std::string NMD::SD_GP_(uint64 instruction) |
| { |
| uint64 rt_value = extract_rt_25_24_23_22_21(instruction); |
| uint64 u_value = extract_u_20_to_3__s3(instruction); |
| |
| std::string rt = GPR(copy(rt_value)); |
| std::string u = IMMEDIATE(copy(u_value)); |
| |
| return img::format("SD %s, %s($%d)", rt, u, 28); |
| } |
| |
| |
| /* |
| * |
| * |
| * 3 2 1 |
| * 10987654321098765432109876543210 |
| * 001000 01001001101 |
| * rt ----- |
| * rs ----- |
| * rd ----- |
| */ |
| std::string NMD::SD_S9_(uint64 instruction) |
| { |
| uint64 rt_value = extract_rt_25_24_23_22_21(instruction); |
| uint64 rs_value = extract_rs_20_19_18_17_16(instruction); |
| int64 s_value = extract_s__se8_15_7_6_5_4_3_2_1_0(instruction); |
| |
| std::string rt = GPR(copy(rt_value)); |
| std::string s = IMMEDIATE(copy(s_value)); |
| std::string rs = GPR(copy(rs_value)); |
| |
| return img::format("SD %s, %s(%s)", rt, s, rs); |
| } |
| |
| |
| /* |
| * |
| * |
| * 3 2 1 |
| * 10987654321098765432109876543210 |
| * 001000 01001001101 |
| * rt ----- |
| * rs ----- |
| * rd ----- |
| */ |
| std::string NMD::SD_U12_(uint64 instruction) |
| { |
| uint64 rt_value = extract_rt_25_24_23_22_21(instruction); |
| uint64 rs_value = extract_rs_20_19_18_17_16(instruction); |
| uint64 u_value = extract_u_11_10_9_8_7_6_5_4_3_2_1_0(instruction); |
| |
| std::string rt = GPR(copy(rt_value)); |
| std::string u = IMMEDIATE(copy(u_value)); |
| std::string rs = GPR(copy(rs_value)); |
| |
| return img::format("SD %s, %s(%s)", rt, u, rs); |
| } |
| |
| |
| /* |
| * |
| * |
| * 3 2 1 |
| * 10987654321098765432109876543210 |
| * 001000 01001001101 |
| * rt ----- |
| * rs ----- |
| * rd ----- |
| */ |
| std::string NMD::SDBBP_16_(uint64 instruction) |
| { |
| uint64 code_value = extract_code_2_1_0(instruction); |
| |
| std::string code = IMMEDIATE(copy(code_value)); |
| |
| return img::format("SDBBP %s", code); |
| } |
| |
| |
| /* |
| * |
| * |
| * 3 2 1 |
| * 10987654321098765432109876543210 |
| * 001000 01001001101 |
| * rt ----- |
| * rs ----- |
| * rd ----- |
| */ |
| std::string NMD::SDBBP_32_(uint64 instruction) |
| { |
| uint64 code_value = extract_code_18_to_0(instruction); |
| |
| std::string code = IMMEDIATE(copy(code_value)); |
| |
| return img::format("SDBBP %s", code); |
| } |
| |
| |
| /* |
| * |
| * |
| * 3 2 1 |
| * 10987654321098765432109876543210 |
| * 001000 01001001101 |
| * rt ----- |
| * rs ----- |
| * rd ----- |
| */ |
| std::string NMD::SDC1_GP_(uint64 instruction) |
| { |
| uint64 ft_value = extract_ft_25_24_23_22_21(instruction); |
| uint64 u_value = extract_u_17_to_2__s2(instruction); |
| |
| std::string ft = FPR(copy(ft_value)); |
| std::string u = IMMEDIATE(copy(u_value)); |
| |
| return img::format("SDC1 %s, %s($%d)", ft, u, 28); |
| } |
| |
| |
| /* |
| * |
| * |
| * 3 2 1 |
| * 10987654321098765432109876543210 |
| * 001000 01001001101 |
| * rt ----- |
| * rs ----- |
| * rd ----- |
| */ |
| std::string NMD::SDC1_S9_(uint64 instruction) |
| { |
| uint64 ft_value = extract_ft_25_24_23_22_21(instruction); |
| uint64 rs_value = extract_rs_20_19_18_17_16(instruction); |
| int64 s_value = extract_s__se8_15_7_6_5_4_3_2_1_0(instruction); |
| |
| std::string ft = FPR(copy(ft_value)); |
| std::string s = IMMEDIATE(copy(s_value)); |
| std::string rs = GPR(copy(rs_value)); |
| |
| return img::format("SDC1 %s, %s(%s)", ft, s, rs); |
| } |
| |
| |
| /* |
| * |
| * |
| * 3 2 1 |
| * 10987654321098765432109876543210 |
| * 001000 01001001101 |
| * rt ----- |
| * rs ----- |
| * rd ----- |
| */ |
| std::string NMD::SDC1_U12_(uint64 instruction) |
| { |
| uint64 ft_value = extract_ft_25_24_23_22_21(instruction); |
| uint64 rs_value = extract_rs_20_19_18_17_16(instruction); |
| uint64 u_value = extract_u_11_10_9_8_7_6_5_4_3_2_1_0(instruction); |
| |
| std::string ft = FPR(copy(ft_value)); |
| std::string u = IMMEDIATE(copy(u_value)); |
| std::string rs = GPR(copy(rs_value)); |
| |
| return img::format("SDC1 %s, %s(%s)", ft, u, rs); |
| } |
| |
| |
| /* |
| * |
| * |
| * 3 2 1 |
| * 10987654321098765432109876543210 |
| * 001000 01001001101 |
| * rt ----- |
| * rs ----- |
| * rd ----- |
| */ |
| std::string NMD::SDC1X(uint64 instruction) |
| { |
| uint64 rt_value = extract_rt_25_24_23_22_21(instruction); |
| uint64 rs_value = extract_rs_20_19_18_17_16(instruction); |
| uint64 ft_value = extract_ft_15_14_13_12_11(instruction); |
| |
| std::string ft = FPR(copy(ft_value)); |
| std::string rs = GPR(copy(rs_value)); |
| std::string rt = GPR(copy(rt_value)); |
| |
| return img::format("SDC1X %s, %s(%s)", ft, rs, rt); |
| } |
| |
| |
| /* |
| * |
| * |
| * 3 2 1 |
| * 10987654321098765432109876543210 |
| * 001000 01001001101 |
| * rt ----- |
| * rs ----- |
| * rd ----- |
| */ |
| std::string NMD::SDC1XS(uint64 instruction) |
| { |
| uint64 rt_value = extract_rt_25_24_23_22_21(instruction); |
| uint64 rs_value = extract_rs_20_19_18_17_16(instruction); |
| uint64 ft_value = extract_ft_15_14_13_12_11(instruction); |
| |
| std::string ft = FPR(copy(ft_value)); |
| std::string rs = GPR(copy(rs_value)); |
| std::string rt = GPR(copy(rt_value)); |
| |
| return img::format("SDC1XS %s, %s(%s)", ft, rs, rt); |
| } |
| |
| |
| /* |
| * |
| * |
| * 3 2 1 |
| * 10987654321098765432109876543210 |
| * 001000 01001001101 |
| * rt ----- |
| * rs ----- |
| * rd ----- |
| */ |
| std::string NMD::SDC2(uint64 instruction) |
| { |
| uint64 cs_value = extract_cs_25_24_23_22_21(instruction); |
| uint64 rs_value = extract_rs_20_19_18_17_16(instruction); |
| int64 s_value = extract_s__se8_15_7_6_5_4_3_2_1_0(instruction); |
| |
| std::string cs = CPR(copy(cs_value)); |
| std::string s = IMMEDIATE(copy(s_value)); |
| std::string rs = GPR(copy(rs_value)); |
| |
| return img::format("SDC2 %s, %s(%s)", cs, s, rs); |
| } |
| |
| |
| /* |
| * |
| * |
| * 3 2 1 |
| * 10987654321098765432109876543210 |
| * 001000 01001001101 |
| * rt ----- |
| * rs ----- |
| * rd ----- |
| */ |
| std::string NMD::SDM(uint64 instruction) |
| { |
| uint64 rt_value = extract_rt_25_24_23_22_21(instruction); |
| uint64 rs_value = extract_rs_20_19_18_17_16(instruction); |
| int64 s_value = extract_s__se8_15_7_6_5_4_3_2_1_0(instruction); |
| uint64 count3_value = extract_count3_14_13_12(instruction); |
| |
| std::string rt = GPR(copy(rt_value)); |
| std::string s = IMMEDIATE(copy(s_value)); |
| std::string rs = GPR(copy(rs_value)); |
| std::string count3 = IMMEDIATE(encode_count3_from_count(count3_value)); |
| |
| return img::format("SDM %s, %s(%s), %s", rt, s, rs, count3); |
| } |
| |
| |
| /* |
| * |
| * |
| * 3 2 1 |
| * 10987654321098765432109876543210 |
| * 001000 01001001101 |
| * rt ----- |
| * rs ----- |
| * rd ----- |
| */ |
| std::string NMD::SDPC_48_(uint64 instruction) |
| { |
| uint64 rt_value = extract_rt_41_40_39_38_37(instruction); |
| int64 s_value = extract_s__se31_15_to_0_31_to_16(instruction); |
| |
| std::string rt = GPR(copy(rt_value)); |
| std::string s = ADDRESS(encode_s_from_address(s_value), 6); |
| |
| return img::format("SDPC %s, %s", rt, s); |
| } |
| |
| |
| /* |
| * |
| * |
| * 3 2 1 |
| * 10987654321098765432109876543210 |
| * 001000 01001001101 |
| * rt ----- |
| * rs ----- |
| * rd ----- |
| */ |
| std::string NMD::SDXS(uint64 instruction) |
| { |
| uint64 rt_value = extract_rt_25_24_23_22_21(instruction); |
| uint64 rs_value = extract_rs_20_19_18_17_16(instruction); |
| uint64 rd_value = extract_rd_15_14_13_12_11(instruction); |
| |
| std::string rd = GPR(copy(rd_value)); |
| std::string rs = GPR(copy(rs_value)); |
| std::string rt = GPR(copy(rt_value)); |
| |
| return img::format("SDXS %s, %s(%s)", rd, rs, rt); |
| } |
| |
| |
| /* |
| * |
| * |
| * 3 2 1 |
| * 10987654321098765432109876543210 |
| * 001000 01001001101 |
| * rt ----- |
| * rs ----- |
| * rd ----- |
| */ |
| std::string NMD::SDX(uint64 instruction) |
| { |
| uint64 rt_value = extract_rt_25_24_23_22_21(instruction); |
| uint64 rs_value = extract_rs_20_19_18_17_16(instruction); |
| uint64 rd_value = extract_rd_15_14_13_12_11(instruction); |
| |
| std::string rd = GPR(copy(rd_value)); |
| std::string rs = GPR(copy(rs_value)); |
| std::string rt = GPR(copy(rt_value)); |
| |
| return img::format("SDX %s, %s(%s)", rd, rs, rt); |
| } |
| |
| |
| /* |
| * |
| * |
| * 3 2 1 |
| * 10987654321098765432109876543210 |
| * 001000 01001001101 |
| * rt ----- |
| * rs ----- |
| * rd ----- |
| */ |
| std::string NMD::SEB(uint64 instruction) |
| { |
| uint64 rt_value = extract_rt_25_24_23_22_21(instruction); |
| uint64 rs_value = extract_rs_20_19_18_17_16(instruction); |
| |
| std::string rt = GPR(copy(rt_value)); |
| std::string rs = GPR(copy(rs_value)); |
| |
| return img::format("SEB %s, %s", rt, rs); |
| } |
| |
| |
| /* |
| * |
| * |
| * 3 2 1 |
| * 10987654321098765432109876543210 |
| * 001000 01001001101 |
| * rt ----- |
| * rs ----- |
| * rd ----- |
| */ |
| std::string NMD::SEH(uint64 instruction) |
| { |
| uint64 rt_value = extract_rt_25_24_23_22_21(instruction); |
| uint64 rs_value = extract_rs_20_19_18_17_16(instruction); |
| |
| std::string rt = GPR(copy(rt_value)); |
| std::string rs = GPR(copy(rs_value)); |
| |
| return img::format("SEH %s, %s", rt, rs); |
| } |
| |
| |
| /* |
| * |
| * |
| * 3 2 1 |
| * 10987654321098765432109876543210 |
| * 001000 01001001101 |
| * rt ----- |
| * rs ----- |
| * rd ----- |
| */ |
| std::string NMD::SEL_D(uint64 instruction) |
| { |
| uint64 ft_value = extract_ft_25_24_23_22_21(instruction); |
| uint64 fs_value = extract_fs_20_19_18_17_16(instruction); |
| uint64 fd_value = extract_fd_15_14_13_12_11(instruction); |
| |
| std::string fd = FPR(copy(fd_value)); |
| std::string fs = FPR(copy(fs_value)); |
| std::string ft = FPR(copy(ft_value)); |
| |
| return img::format("SEL.D %s, %s, %s", fd, fs, ft); |
| } |
| |
| |
| /* |
| * |
| * |
| * 3 2 1 |
| * 10987654321098765432109876543210 |
| * 001000 01001001101 |
| * rt ----- |
| * rs ----- |
| * rd ----- |
| */ |
| std::string NMD::SEL_S(uint64 instruction) |
| { |
| uint64 ft_value = extract_ft_25_24_23_22_21(instruction); |
| uint64 fs_value = extract_fs_20_19_18_17_16(instruction); |
| uint64 fd_value = extract_fd_15_14_13_12_11(instruction); |
| |
| std::string fd = FPR(copy(fd_value)); |
| std::string fs = FPR(copy(fs_value)); |
| std::string ft = FPR(copy(ft_value)); |
| |
| return img::format("SEL.S %s, %s, %s", fd, fs, ft); |
| } |
| |
| |
| /* |
| * |
| * |
| * 3 2 1 |
| * 10987654321098765432109876543210 |
| * 001000 01001001101 |
| * rt ----- |
| * rs ----- |
| * rd ----- |
| */ |
| std::string NMD::SELEQZ_D(uint64 instruction) |
| { |
| uint64 ft_value = extract_ft_25_24_23_22_21(instruction); |
| uint64 fs_value = extract_fs_20_19_18_17_16(instruction); |
| uint64 fd_value = extract_fd_15_14_13_12_11(instruction); |
| |
| std::string fd = FPR(copy(fd_value)); |
| std::string fs = FPR(copy(fs_value)); |
| std::string ft = FPR(copy(ft_value)); |
| |
| return img::format("SELEQZ.D %s, %s, %s", fd, fs, ft); |
| } |
| |
| |
| /* |
| * |
| * |
| * 3 2 1 |
| * 10987654321098765432109876543210 |
| * 001000 01001001101 |
| * rt ----- |
| * rs ----- |
| * rd ----- |
| */ |
| std::string NMD::SELEQZ_S(uint64 instruction) |
| { |
| uint64 ft_value = extract_ft_25_24_23_22_21(instruction); |
| uint64 fs_value = extract_fs_20_19_18_17_16(instruction); |
| uint64 fd_value = extract_fd_15_14_13_12_11(instruction); |
| |
| std::string fd = FPR(copy(fd_value)); |
| std::string fs = FPR(copy(fs_value)); |
| std::string ft = FPR(copy(ft_value)); |
| |
| return img::format("SELEQZ.S %s, %s, %s", fd, fs, ft); |
| } |
| |
| |
| /* |
| * |
| * |
| * 3 2 1 |
| * 10987654321098765432109876543210 |
| * 001000 01001001101 |
| * rt ----- |
| * rs ----- |
| * rd ----- |
| */ |
| std::string NMD::SELNEZ_D(uint64 instruction) |
| { |
| uint64 ft_value = extract_ft_25_24_23_22_21(instruction); |
| uint64 fs_value = extract_fs_20_19_18_17_16(instruction); |
| uint64 fd_value = extract_fd_15_14_13_12_11(instruction); |
| |
| std::string fd = FPR(copy(fd_value)); |
| std::string fs = FPR(copy(fs_value)); |
| std::string ft = FPR(copy(ft_value)); |
| |
| return img::format("SELNEZ.D %s, %s, %s", fd, fs, ft); |
| } |
| |
| |
| /* |
| * |
| * |
| * 3 2 1 |
| * 10987654321098765432109876543210 |
| * 001000 01001001101 |
| * rt ----- |
| * rs ----- |
| * rd ----- |
| */ |
| std::string NMD::SELNEZ_S(uint64 instruction) |
| { |
| uint64 ft_value = extract_ft_25_24_23_22_21(instruction); |
| uint64 fs_value = extract_fs_20_19_18_17_16(instruction); |
| uint64 fd_value = extract_fd_15_14_13_12_11(instruction); |
| |
| std::string fd = FPR(copy(fd_value)); |
| std::string fs = FPR(copy(fs_value)); |
| std::string ft = FPR(copy(ft_value)); |
| |
| return img::format("SELNEZ.S %s, %s, %s", fd, fs, ft); |
| } |
| |
| |
| /* |
| * |
| * |
| * 3 2 1 |
| * 10987654321098765432109876543210 |
| * 001000 01001001101 |
| * rt ----- |
| * rs ----- |
| * rd ----- |
| */ |
| std::string NMD::SEQI(uint64 instruction) |
| { |
| uint64 rt_value = extract_rt_25_24_23_22_21(instruction); |
| uint64 rs_value = extract_rs_20_19_18_17_16(instruction); |
| uint64 u_value = extract_u_11_10_9_8_7_6_5_4_3_2_1_0(instruction); |
| |
| std::string rt = GPR(copy(rt_value)); |
| std::string rs = GPR(copy(rs_value)); |
| std::string u = IMMEDIATE(copy(u_value)); |
| |
| return img::format("SEQI %s, %s, %s", rt, rs, u); |
| } |
| |
| |
| /* |
| * |
| * |
| * 3 2 1 |
| * 10987654321098765432109876543210 |
| * 001000 01001001101 |
| * rt ----- |
| * rs ----- |
| * rd ----- |
| */ |
| std::string NMD::SH_16_(uint64 instruction) |
| { |
| uint64 rtz3_value = extract_rtz3_9_8_7(instruction); |
| uint64 rs3_value = extract_rs3_6_5_4(instruction); |
| uint64 u_value = extract_u_2_1__s1(instruction); |
| |
| std::string rtz3 = GPR(decode_gpr_gpr3_src_store(rtz3_value)); |
| std::string u = IMMEDIATE(copy(u_value)); |
| std::string rs3 = GPR(decode_gpr_gpr3(rs3_value)); |
| |
| return img::format("SH %s, %s(%s)", rtz3, u, rs3); |
| } |
| |
| |
| /* |
| * |
| * |
| * 3 2 1 |
| * 10987654321098765432109876543210 |
| * 001000 01001001101 |
| * rt ----- |
| * rs ----- |
| * rd ----- |
| */ |
| std::string NMD::SH_GP_(uint64 instruction) |
| { |
| uint64 rt_value = extract_rt_25_24_23_22_21(instruction); |
| uint64 u_value = extract_u_17_to_1__s1(instruction); |
| |
| std::string rt = GPR(copy(rt_value)); |
| std::string u = IMMEDIATE(copy(u_value)); |
| |
| return img::format("SH %s, %s($%d)", rt, u, 28); |
| } |
| |
| |
| /* |
| * |
| * |
| * 3 2 1 |
| * 10987654321098765432109876543210 |
| * 001000 01001001101 |
| * rt ----- |
| * rs ----- |
| * rd ----- |
| */ |
| std::string NMD::SH_S9_(uint64 instruction) |
| { |
| uint64 rt_value = extract_rt_25_24_23_22_21(instruction); |
| uint64 rs_value = extract_rs_20_19_18_17_16(instruction); |
| int64 s_value = extract_s__se8_15_7_6_5_4_3_2_1_0(instruction); |
| |
| std::string rt = GPR(copy(rt_value)); |
| std::string s = IMMEDIATE(copy(s_value)); |
| std::string rs = GPR(copy(rs_value)); |
| |
| return img::format("SH %s, %s(%s)", rt, s, rs); |
| } |
| |
| |
| /* |
| * |
| * |
| * 3 2 1 |
| * 10987654321098765432109876543210 |
| * 001000 01001001101 |
| * rt ----- |
| * rs ----- |
| * rd ----- |
| */ |
| std::string NMD::SH_U12_(uint64 instruction) |
| { |
| uint64 rt_value = extract_rt_25_24_23_22_21(instruction); |
| uint64 rs_value = extract_rs_20_19_18_17_16(instruction); |
| uint64 u_value = extract_u_11_10_9_8_7_6_5_4_3_2_1_0(instruction); |
| |
| std::string rt = GPR(copy(rt_value)); |
| std::string u = IMMEDIATE(copy(u_value)); |
| std::string rs = GPR(copy(rs_value)); |
| |
| return img::format("SH %s, %s(%s)", rt, u, rs); |
| } |
| |
| |
| /* |
| * |
| * |
| * 3 2 1 |
| * 10987654321098765432109876543210 |
| * 001000 01001001101 |
| * rt ----- |
| * rs ----- |
| * rd ----- |
| */ |
| std::string NMD::SHE(uint64 instruction) |
| { |
| uint64 rt_value = extract_rt_25_24_23_22_21(instruction); |
| uint64 rs_value = extract_rs_20_19_18_17_16(instruction); |
| int64 s_value = extract_s__se8_15_7_6_5_4_3_2_1_0(instruction); |
| |
| std::string rt = GPR(copy(rt_value)); |
| std::string s = IMMEDIATE(copy(s_value)); |
| std::string rs = GPR(copy(rs_value)); |
| |
| return img::format("SHE %s, %s(%s)", rt, s, rs); |
| } |
| |
| |
| /* |
| * [DSP] SHILO ac, shift - Shift an accumulator value leaving the result in |
| * the same accumulator |
| * |
| * 3 2 1 |
| * 10987654321098765432109876543210 |
| * 001000xxxx xxxx0000011101 |
| * shift ------ |
| * ac -- |
| */ |
| std::string NMD::SHILO(uint64 instruction) |
| { |
| int64 shift_value = extract_shift__se5_21_20_19_18_17_16(instruction); |
| uint64 ac_value = extract_ac_15_14(instruction); |
| |
| std::string shift = IMMEDIATE(copy(shift_value)); |
| std::string ac = AC(copy(ac_value)); |
| |
| return img::format("SHILO %s, %s", ac, shift); |
| } |
| |
| |
| /* |
| * [DSP] SHILOV ac, rs - Variable shift of accumulator value leaving the result |
| * in the same accumulator |
| * |
| * 3 2 1 |
| * 10987654321098765432109876543210 |
| * 001000xxxxx 01001001111111 |
| * rs ----- |
| * ac -- |
| */ |
| std::string NMD::SHILOV(uint64 instruction) |
| { |
| uint64 rs_value = extract_rs_20_19_18_17_16(instruction); |
| uint64 ac_value = extract_ac_15_14(instruction); |
| |
| std::string rs = GPR(copy(rs_value)); |
| std::string ac = AC(copy(ac_value)); |
| |
| return img::format("SHILOV %s, %s", ac, rs); |
| } |
| |
| |
| /* |
| * [DSP] SHLL.PH rt, rs, sa - Shift left logical vector pair halfwords |
| * |
| * 3 2 1 |
| * 10987654321098765432109876543210 |
| * 001000 001110110101 |
| * rt ----- |
| * rs ----- |
| * sa ---- |
| */ |
| std::string NMD::SHLL_PH(uint64 instruction) |
| { |
| uint64 rt_value = extract_rt_25_24_23_22_21(instruction); |
| uint64 rs_value = extract_rs_20_19_18_17_16(instruction); |
| uint64 sa_value = extract_sa_15_14_13_12(instruction); |
| |
| std::string rt = GPR(copy(rt_value)); |
| std::string rs = GPR(copy(rs_value)); |
| std::string sa = IMMEDIATE(copy(sa_value)); |
| |
| return img::format("SHLL.PH %s, %s, %s", rt, rs, sa); |
| } |
| |
| |
| /* |
| * [DSP] SHLL.QB rt, rs, sa - Shift left logical vector quad bytes |
| * |
| * 3 2 1 |
| * 10987654321098765432109876543210 |
| * 001000 0100001111111 |
| * rt ----- |
| * rs ----- |
| * sa --- |
| */ |
| std::string NMD::SHLL_QB(uint64 instruction) |
| { |
| uint64 rt_value = extract_rt_25_24_23_22_21(instruction); |
| uint64 rs_value = extract_rs_20_19_18_17_16(instruction); |
| uint64 sa_value = extract_sa_15_14_13(instruction); |
| |
| std::string rt = GPR(copy(rt_value)); |
| std::string rs = GPR(copy(rs_value)); |
| std::string sa = IMMEDIATE(copy(sa_value)); |
| |
| return img::format("SHLL.QB %s, %s, %s", rt, rs, sa); |
| } |
| |
| |
| /* |
| * [DSP] SHLL_S.PH rt, rs, sa - Shift left logical vector pair halfwords |
| * with saturation |
| * |
| * 3 2 1 |
| * 10987654321098765432109876543210 |
| * 001000 001110110101 |
| * rt ----- |
| * rs ----- |
| * sa ---- |
| */ |
| std::string NMD::SHLL_S_PH(uint64 instruction) |
| { |
| uint64 rt_value = extract_rt_25_24_23_22_21(instruction); |
| uint64 rs_value = extract_rs_20_19_18_17_16(instruction); |
| uint64 sa_value = extract_sa_15_14_13_12(instruction); |
| |
| std::string rt = GPR(copy(rt_value)); |
| std::string rs = GPR(copy(rs_value)); |
| std::string sa = IMMEDIATE(copy(sa_value)); |
| |
| return img::format("SHLL_S.PH %s, %s, %s", rt, rs, sa); |
| } |
| |
| |
| /* |
| * [DSP] SHLL_S.PH rt, rs, sa - Shift left logical word with saturation |
| * |
| * 3 2 1 |
| * 10987654321098765432109876543210 |
| * 001000 x1111110101 |
| * rt ----- |
| * rs ----- |
| * sa ----- |
| */ |
| std::string NMD::SHLL_S_W(uint64 instruction) |
| { |
| uint64 rt_value = extract_rt_25_24_23_22_21(instruction); |
| uint64 rs_value = extract_rs_20_19_18_17_16(instruction); |
| uint64 sa_value = extract_sa_15_14_13_12_11(instruction); |
| |
| std::string rt = GPR(copy(rt_value)); |
| std::string rs = GPR(copy(rs_value)); |
| std::string sa = IMMEDIATE(copy(sa_value)); |
| |
| return img::format("SHLL_S.W %s, %s, %s", rt, rs, sa); |
| } |
| |
| |
| /* |
| * [DSP] SHLLV.PH rd, rt, rs - Shift left logical variable vector pair |
| * halfwords |
| * |
| * 3 2 1 |
| * 10987654321098765432109876543210 |
| * 001000 01110001101 |
| * rt ----- |
| * rs ----- |
| * rd ----- |
| */ |
| std::string NMD::SHLLV_PH(uint64 instruction) |
| { |
| uint64 rt_value = extract_rt_25_24_23_22_21(instruction); |
| uint64 rs_value = extract_rs_20_19_18_17_16(instruction); |
| uint64 rd_value = extract_rd_15_14_13_12_11(instruction); |
| |
| std::string rd = GPR(copy(rd_value)); |
| std::string rt = GPR(copy(rt_value)); |
| std::string rs = GPR(copy(rs_value)); |
| |
| return img::format("SHLLV.PH %s, %s, %s", rd, rt, rs); |
| } |
| |
| |
| /* |
| * [DSP] SHLLV_S.QB rd, rt, rs - Shift left logical variable vector quad bytes |
| * |
| * 3 2 1 |
| * 10987654321098765432109876543210 |
| * 001000 x1110010101 |
| * rt ----- |
| * rs ----- |
| * rd ----- |
| */ |
| std::string NMD::SHLLV_QB(uint64 instruction) |
| { |
| uint64 rt_value = extract_rt_25_24_23_22_21(instruction); |
| uint64 rs_value = extract_rs_20_19_18_17_16(instruction); |
| uint64 rd_value = extract_rd_15_14_13_12_11(instruction); |
| |
| std::string rd = GPR(copy(rd_value)); |
| std::string rt = GPR(copy(rt_value)); |
| std::string rs = GPR(copy(rs_value)); |
| |
| return img::format("SHLLV.QB %s, %s, %s", rd, rt, rs); |
| } |
| |
| |
| /* |
| * [DSP] SHLLV.PH rd, rt, rs - Shift left logical variable vector pair |
| * halfwords with saturation |
| * |
| * 3 2 1 |
| * 10987654321098765432109876543210 |
| * 001000 11110001101 |
| * rt ----- |
| * rs ----- |
| * rd ----- |
| */ |
| std::string NMD::SHLLV_S_PH(uint64 instruction) |
| { |
| uint64 rt_value = extract_rt_25_24_23_22_21(instruction); |
| uint64 rs_value = extract_rs_20_19_18_17_16(instruction); |
| uint64 rd_value = extract_rd_15_14_13_12_11(instruction); |
| |
| std::string rd = GPR(copy(rd_value)); |
| std::string rt = GPR(copy(rt_value)); |
| std::string rs = GPR(copy(rs_value)); |
| |
| return img::format("SHLLV_S.PH %s, %s, %s", rd, rt, rs); |
| } |
| |
| |
| /* |
| * [DSP] SHLLV_S.W rd, rt, rs - Shift left logical variable vector word |
| * |
| * 3 2 1 |
| * 10987654321098765432109876543210 |
| * 001000 x1111010101 |
| * rt ----- |
| * rs ----- |
| * rd ----- |
| */ |
| std::string NMD::SHLLV_S_W(uint64 instruction) |
| { |
| uint64 rt_value = extract_rt_25_24_23_22_21(instruction); |
| uint64 rs_value = extract_rs_20_19_18_17_16(instruction); |
| uint64 rd_value = extract_rd_15_14_13_12_11(instruction); |
| |
| std::string rd = GPR(copy(rd_value)); |
| std::string rt = GPR(copy(rt_value)); |
| std::string rs = GPR(copy(rs_value)); |
| |
| return img::format("SHLLV_S.W %s, %s, %s", rd, rt, rs); |
| } |
| |
| |
| /* |
| * |
| * |
| * 3 2 1 |
| * 10987654321098765432109876543210 |
| * 001000 01001001101 |
| * rt ----- |
| * rs ----- |
| * rd ----- |
| */ |
| std::string NMD::SHRA_PH(uint64 instruction) |
| { |
| uint64 rt_value = extract_rt_25_24_23_22_21(instruction); |
| uint64 rs_value = extract_rs_20_19_18_17_16(instruction); |
| uint64 sa_value = extract_sa_15_14_13_12(instruction); |
| |
| std::string rt = GPR(copy(rt_value)); |
| std::string rs = GPR(copy(rs_value)); |
| std::string sa = IMMEDIATE(copy(sa_value)); |
| |
| return img::format("SHRA.PH %s, %s, %s", rt, rs, sa); |
| } |
| |
| |
| /* |
| * |
| * |
| * 3 2 1 |
| * 10987654321098765432109876543210 |
| * 001000 01001001101 |
| * rt ----- |
| * rs ----- |
| * rd ----- |
| */ |
| std::string NMD::SHRA_QB(uint64 instruction) |
| { |
| uint64 rt_value = extract_rt_25_24_23_22_21(instruction); |
| uint64 rs_value = extract_rs_20_19_18_17_16(instruction); |
| uint64 sa_value = extract_sa_15_14_13(instruction); |
| |
| std::string rt = GPR(copy(rt_value)); |
| std::string rs = GPR(copy(rs_value)); |
| std::string sa = IMMEDIATE(copy(sa_value)); |
| |
| return img::format("SHRA.QB %s, %s, %s", rt, rs, sa); |
| } |
| |
| |
| /* |
| * |
| * |
| * 3 2 1 |
| * 10987654321098765432109876543210 |
| * 001000 01001001101 |
| * rt ----- |
| * rs ----- |
| * rd ----- |
| */ |
| std::string NMD::SHRA_R_PH(uint64 instruction) |
| { |
| uint64 rt_value = extract_rt_25_24_23_22_21(instruction); |
| uint64 rs_value = extract_rs_20_19_18_17_16(instruction); |
| uint64 sa_value = extract_sa_15_14_13_12(instruction); |
| |
| std::string rt = GPR(copy(rt_value)); |
| std::string rs = GPR(copy(rs_value)); |
| std::string sa = IMMEDIATE(copy(sa_value)); |
| |
| return img::format("SHRA_R.PH %s, %s, %s", rt, rs, sa); |
| } |
| |
| |
| /* |
| * |
| * |
| * 3 2 1 |
| * 10987654321098765432109876543210 |
| * 001000 01001001101 |
| * rt ----- |
| * rs ----- |
| * rd ----- |
| */ |
| std::string NMD::SHRA_R_QB(uint64 instruction) |
| { |
| uint64 rt_value = extract_rt_25_24_23_22_21(instruction); |
| uint64 rs_value = extract_rs_20_19_18_17_16(instruction); |
| uint64 sa_value = extract_sa_15_14_13(instruction); |
| |
| std::string rt = GPR(copy(rt_value)); |
| std::string rs = GPR(copy(rs_value)); |
| std::string sa = IMMEDIATE(copy(sa_value)); |
| |
| return img::format("SHRA_R.QB %s, %s, %s", rt, rs, sa); |
| } |
| |
| |
| /* |
| * |
| * |
| * 3 2 1 |
| * 10987654321098765432109876543210 |
| * 001000 01001001101 |
| * rt ----- |
| * rs ----- |
| * rd ----- |
| */ |
| std::string NMD::SHRA_R_W(uint64 instruction) |
| { |
| uint64 rt_value = extract_rt_25_24_23_22_21(instruction); |
| uint64 rs_value = extract_rs_20_19_18_17_16(instruction); |
| uint64 sa_value = extract_sa_15_14_13_12_11(instruction); |
| |
| std::string rt = GPR(copy(rt_value)); |
| std::string rs = GPR(copy(rs_value)); |
| std::string sa = IMMEDIATE(copy(sa_value)); |
| |
| return img::format("SHRA_R.W %s, %s, %s", rt, rs, sa); |
| } |
| |
| |
| /* |
| * |
| * |
| * 3 2 1 |
| * 10987654321098765432109876543210 |
| * 001000 01001001101 |
| * rt ----- |
| * rs ----- |
| * rd ----- |
| */ |
| std::string NMD::SHRAV_PH(uint64 instruction) |
| { |
| uint64 rt_value = extract_rt_25_24_23_22_21(instruction); |
| uint64 rs_value = extract_rs_20_19_18_17_16(instruction); |
| uint64 rd_value = extract_rd_15_14_13_12_11(instruction); |
| |
| std::string rd = GPR(copy(rd_value)); |
| std::string rt = GPR(copy(rt_value)); |
| std::string rs = GPR(copy(rs_value)); |
| |
| return img::format("SHRAV.PH %s, %s, %s", rd, rt, rs); |
| } |
| |
| |
| /* |
| * |
| * |
| * 3 2 1 |
| * 10987654321098765432109876543210 |
| * 001000 01001001101 |
| * rt ----- |
| * rs ----- |
| * rd ----- |
| */ |
| std::string NMD::SHRAV_QB(uint64 instruction) |
| { |
| uint64 rt_value = extract_rt_25_24_23_22_21(instruction); |
| uint64 rs_value = extract_rs_20_19_18_17_16(instruction); |
| uint64 rd_value = extract_rd_15_14_13_12_11(instruction); |
| |
| std::string rd = GPR(copy(rd_value)); |
| std::string rt = GPR(copy(rt_value)); |
| std::string rs = GPR(copy(rs_value)); |
| |
| return img::format("SHRAV.QB %s, %s, %s", rd, rt, rs); |
| } |
| |
| |
| /* |
| * |
| * |
| * 3 2 1 |
| * 10987654321098765432109876543210 |
| * 001000 01001001101 |
| * rt ----- |
| * rs ----- |
| * rd ----- |
| */ |
| std::string NMD::SHRAV_R_PH(uint64 instruction) |
| { |
| uint64 rt_value = extract_rt_25_24_23_22_21(instruction); |
| uint64 rs_value = extract_rs_20_19_18_17_16(instruction); |
| uint64 rd_value = extract_rd_15_14_13_12_11(instruction); |
| |
| std::string rd = GPR(copy(rd_value)); |
| std::string rt = GPR(copy(rt_value)); |
| std::string rs = GPR(copy(rs_value)); |
| |
| return img::format("SHRAV_R.PH %s, %s, %s", rd, rt, rs); |
| } |
| |
| |
| /* |
| * |
| * |
| * 3 2 1 |
| * 10987654321098765432109876543210 |
| * 001000 01001001101 |
| * rt ----- |
| * rs ----- |
| * rd ----- |
| */ |
| std::string NMD::SHRAV_R_QB(uint64 instruction) |
| { |
| uint64 rt_value = extract_rt_25_24_23_22_21(instruction); |
| uint64 rs_value = extract_rs_20_19_18_17_16(instruction); |
| uint64 rd_value = extract_rd_15_14_13_12_11(instruction); |
| |
| std::string rd = GPR(copy(rd_value)); |
| std::string rt = GPR(copy(rt_value)); |
| std::string rs = GPR(copy(rs_value)); |
| |
| return img::format("SHRAV_R.QB %s, %s, %s", rd, rt, rs); |
| } |
| |
| |
| /* |
| * |
| * |
| * 3 2 1 |
| * 10987654321098765432109876543210 |
| * 001000 01001001101 |
| * rt ----- |
| * rs ----- |
| * rd ----- |
| */ |
| std::string NMD::SHRAV_R_W(uint64 instruction) |
| { |
| uint64 rt_value = extract_rt_25_24_23_22_21(instruction); |
| uint64 rs_value = extract_rs_20_19_18_17_16(instruction); |
| uint64 rd_value = extract_rd_15_14_13_12_11(instruction); |
| |
| std::string rd = GPR(copy(rd_value)); |
| std::string rt = GPR(copy(rt_value)); |
| std::string rs = GPR(copy(rs_value)); |
| |
| return img::format("SHRAV_R.W %s, %s, %s", rd, rt, rs); |
| } |
| |
| |
| /* |
| * [DSP] SHRL.PH rt, rs, sa - Shift right logical two halfwords |
| * |
| * 3 2 1 |
| * 10987654321098765432109876543210 |
| * 001000 001111111111 |
| * rt ----- |
| * rs ----- |
| * sa ---- |
| */ |
| std::string NMD::SHRL_PH(uint64 instruction) |
| { |
| uint64 rt_value = extract_rt_25_24_23_22_21(instruction); |
| uint64 rs_value = extract_rs_20_19_18_17_16(instruction); |
| uint64 sa_value = extract_sa_15_14_13_12(instruction); |
| |
| std::string rt = GPR(copy(rt_value)); |
| std::string rs = GPR(copy(rs_value)); |
| std::string sa = IMMEDIATE(copy(sa_value)); |
| |
| return img::format("SHRL.PH %s, %s, %s", rt, rs, sa); |
| } |
| |
| |
| /* |
| * [DSP] SHRL.QB rt, rs, sa - Shift right logical vector quad bytes |
| * |
| * 3 2 1 |
| * 10987654321098765432109876543210 |
| * 001000 1100001111111 |
| * rt ----- |
| * rs ----- |
| * sa --- |
| */ |
| std::string NMD::SHRL_QB(uint64 instruction) |
| { |
| uint64 rt_value = extract_rt_25_24_23_22_21(instruction); |
| uint64 rs_value = extract_rs_20_19_18_17_16(instruction); |
| uint64 sa_value = extract_sa_15_14_13(instruction); |
| |
| std::string rt = GPR(copy(rt_value)); |
| std::string rs = GPR(copy(rs_value)); |
| std::string sa = IMMEDIATE(copy(sa_value)); |
| |
| return img::format("SHRL.QB %s, %s, %s", rt, rs, sa); |
| } |
| |
| |
| /* |
| * [DSP] SHLLV.PH rd, rt, rs - Shift right logical variable vector pair of |
| * halfwords |
| * |
| * 3 2 1 |
| * 10987654321098765432109876543210 |
| * 001000 x1100010101 |
| * rt ----- |
| * rs ----- |
| * rd ----- |
| */ |
| std::string NMD::SHRLV_PH(uint64 instruction) |
| { |
| uint64 rt_value = extract_rt_25_24_23_22_21(instruction); |
| uint64 rs_value = extract_rs_20_19_18_17_16(instruction); |
| uint64 rd_value = extract_rd_15_14_13_12_11(instruction); |
| |
| std::string rd = GPR(copy(rd_value)); |
| std::string rt = GPR(copy(rt_value)); |
| std::string rs = GPR(copy(rs_value)); |
| |
| return img::format("SHRLV.PH %s, %s, %s", rd, rt, rs); |
| } |
| |
| |
| /* |
| * [DSP] SHLLV.QB rd, rt, rs - Shift right logical variable vector quad bytes |
| * |
| * 3 2 1 |
| * 10987654321098765432109876543210 |
| * 001000 x1101010101 |
| * rt ----- |
| * rs ----- |
| * rd ----- |
| */ |
| std::string NMD::SHRLV_QB(uint64 instruction) |
| { |
| uint64 rt_value = extract_rt_25_24_23_22_21(instruction); |
| uint64 rs_value = extract_rs_20_19_18_17_16(instruction); |
| uint64 rd_value = extract_rd_15_14_13_12_11(instruction); |
| |
| std::string rd = GPR(copy(rd_value)); |
| std::string rt = GPR(copy(rt_value)); |
| std::string rs = GPR(copy(rs_value)); |
| |
| return img::format("SHRLV.QB %s, %s, %s", rd, rt, rs); |
| } |
| |
| |
| /* |
| * |
| * |
| * 3 2 1 |
| * 10987654321098765432109876543210 |
| * 001000 01001001101 |
| * rt ----- |
| * rs ----- |
| * rd ----- |
| */ |
| std::string NMD::SHX(uint64 instruction) |
| { |
| uint64 rt_value = extract_rt_25_24_23_22_21(instruction); |
| uint64 rs_value = extract_rs_20_19_18_17_16(instruction); |
| uint64 rd_value = extract_rd_15_14_13_12_11(instruction); |
| |
| std::string rd = GPR(copy(rd_value)); |
| std::string rs = GPR(copy(rs_value)); |
| std::string rt = GPR(copy(rt_value)); |
| |
| return img::format("SHX %s, %s(%s)", rd, rs, rt); |
| } |
| |
| |
| /* |
| * |
| * |
| * 3 2 1 |
| * 10987654321098765432109876543210 |
| * 001000 01001001101 |
| * rt ----- |
| * rs ----- |
| * rd ----- |
| */ |
| std::string NMD::SHXS(uint64 instruction) |
| { |
| uint64 rt_value = extract_rt_25_24_23_22_21(instruction); |
| uint64 rs_value = extract_rs_20_19_18_17_16(instruction); |
| uint64 rd_value = extract_rd_15_14_13_12_11(instruction); |
| |
| std::string rd = GPR(copy(rd_value)); |
| std::string rs = GPR(copy(rs_value)); |
| std::string rt = GPR(copy(rt_value)); |
| |
| return img::format("SHXS %s, %s(%s)", rd, rs, rt); |
| } |
| |
| |
| /* |
| * |
| * |
| * 3 2 1 |
| * 10987654321098765432109876543210 |
| * 001000 01001001101 |
| * rt ----- |
| * rs ----- |
| * rd ----- |
| */ |
| std::string NMD::SIGRIE(uint64 instruction) |
| { |
| uint64 code_value = extract_code_18_to_0(instruction); |
| |
| std::string code = IMMEDIATE(copy(code_value)); |
| |
| return img::format("SIGRIE %s", code); |
| } |
| |
| |
| /* |
| * |
| * |
| * 3 2 1 |
| * 10987654321098765432109876543210 |
| * 001000 01001001101 |
| * rt ----- |
| * rs ----- |
| * rd ----- |
| */ |
| std::string NMD::SLL_16_(uint64 instruction) |
| { |
| uint64 rt3_value = extract_rt3_9_8_7(instruction); |
| uint64 rs3_value = extract_rs3_6_5_4(instruction); |
| uint64 shift3_value = extract_shift3_2_1_0(instruction); |
| |
| std::string rt3 = GPR(decode_gpr_gpr3(rt3_value)); |
| std::string rs3 = GPR(decode_gpr_gpr3(rs3_value)); |
| std::string shift3 = IMMEDIATE(encode_shift3_from_shift(shift3_value)); |
| |
| return img::format("SLL %s, %s, %s", rt3, rs3, shift3); |
| } |
| |
| |
| /* |
| * |
| * |
| * 3 2 1 |
| * 10987654321098765432109876543210 |
| * 001000 01001001101 |
| * rt ----- |
| * rs ----- |
| * rd ----- |
| */ |
| std::string NMD::SLL_32_(uint64 instruction) |
| { |
| uint64 rt_value = extract_rt_25_24_23_22_21(instruction); |
| uint64 rs_value = extract_rs_20_19_18_17_16(instruction); |
| uint64 shift_value = extract_shift_4_3_2_1_0(instruction); |
| |
| std::string rt = GPR(copy(rt_value)); |
| std::string rs = GPR(copy(rs_value)); |
| std::string shift = IMMEDIATE(copy(shift_value)); |
| |
| return img::format("SLL %s, %s, %s", rt, rs, shift); |
| } |
| |
| |
| /* |
| * |
| * |
| * 3 2 1 |
| * 10987654321098765432109876543210 |
| * 001000 01001001101 |
| * rt ----- |
| * rs ----- |
| * rd ----- |
| */ |
| std::string NMD::SLLV(uint64 instruction) |
| { |
| uint64 rt_value = extract_rt_25_24_23_22_21(instruction); |
| uint64 rs_value = extract_rs_20_19_18_17_16(instruction); |
| uint64 rd_value = extract_rd_15_14_13_12_11(instruction); |
| |
| std::string rd = GPR(copy(rd_value)); |
| std::string rs = GPR(copy(rs_value)); |
| std::string rt = GPR(copy(rt_value)); |
| |
| return img::format("SLLV %s, %s, %s", rd, rs, rt); |
| } |
| |
| |
| /* |
| * |
| * |
| * 3 2 1 |
| * 10987654321098765432109876543210 |
| * 001000 01001001101 |
| * rt ----- |
| * rs ----- |
| * rd ----- |
| */ |
| std::string NMD::SLT(uint64 instruction) |
| { |
| uint64 rt_value = extract_rt_25_24_23_22_21(instruction); |
| uint64 rs_value = extract_rs_20_19_18_17_16(instruction); |
| uint64 rd_value = extract_rd_15_14_13_12_11(instruction); |
| |
| std::string rd = GPR(copy(rd_value)); |
| std::string rs = GPR(copy(rs_value)); |
| std::string rt = GPR(copy(rt_value)); |
| |
| return img::format("SLT %s, %s, %s", rd, rs, rt); |
| } |
| |
| |
| /* |
| * |
| * |
| * 3 2 1 |
| * 10987654321098765432109876543210 |
| * 001000 01001001101 |
| * rt ----- |
| * rs ----- |
| * rd ----- |
| */ |
| std::string NMD::SLTI(uint64 instruction) |
| { |
| uint64 rt_value = extract_rt_25_24_23_22_21(instruction); |
| uint64 rs_value = extract_rs_20_19_18_17_16(instruction); |
| uint64 u_value = extract_u_11_10_9_8_7_6_5_4_3_2_1_0(instruction); |
| |
| std::string rt = GPR(copy(rt_value)); |
| std::string rs = GPR(copy(rs_value)); |
| std::string u = IMMEDIATE(copy(u_value)); |
| |
| return img::format("SLTI %s, %s, %s", rt, rs, u); |
| } |
| |
| |
| /* |
| * |
| * |
| * 3 2 1 |
| * 10987654321098765432109876543210 |
| * 001000 01001001101 |
| * rt ----- |
| * rs ----- |
| * rd ----- |
| */ |
| std::string NMD::SLTIU(uint64 instruction) |
| { |
| uint64 rt_value = extract_rt_25_24_23_22_21(instruction); |
| uint64 rs_value = extract_rs_20_19_18_17_16(instruction); |
| uint64 u_value = extract_u_11_10_9_8_7_6_5_4_3_2_1_0(instruction); |
| |
| std::string rt = GPR(copy(rt_value)); |
| std::string rs = GPR(copy(rs_value)); |
| std::string u = IMMEDIATE(copy(u_value)); |
| |
| return img::format("SLTIU %s, %s, %s", rt, rs, u); |
| } |
| |
| |
| /* |
| * |
| * |
| * 3 2 1 |
| * 10987654321098765432109876543210 |
| * 001000 01001001101 |
| * rt ----- |
| * rs ----- |
| * rd ----- |
| */ |
| std::string NMD::SLTU(uint64 instruction) |
| { |
| uint64 rt_value = extract_rt_25_24_23_22_21(instruction); |
| uint64 rs_value = extract_rs_20_19_18_17_16(instruction); |
| uint64 rd_value = extract_rd_15_14_13_12_11(instruction); |
| |
| std::string rd = GPR(copy(rd_value)); |
| std::string rs = GPR(copy(rs_value)); |
| std::string rt = GPR(copy(rt_value)); |
| |
| return img::format("SLTU %s, %s, %s", rd, rs, rt); |
| } |
| |
| |
| /* |
| * |
| * |
| * 3 2 1 |
| * 10987654321098765432109876543210 |
| * 001000 01001001101 |
| * rt ----- |
| * rs ----- |
| * rd ----- |
| */ |
| std::string NMD::SOV(uint64 instruction) |
| { |
| uint64 rt_value = extract_rt_25_24_23_22_21(instruction); |
| uint64 rs_value = extract_rs_20_19_18_17_16(instruction); |
| uint64 rd_value = extract_rd_15_14_13_12_11(instruction); |
| |
| std::string rd = GPR(copy(rd_value)); |
| std::string rs = GPR(copy(rs_value)); |
| std::string rt = GPR(copy(rt_value)); |
| |
| return img::format("SOV %s, %s, %s", rd, rs, rt); |
| } |
| |
| |
| /* |
| * |
| * |
| * 3 2 1 |
| * 10987654321098765432109876543210 |
| * 001000 01001001101 |
| * rt ----- |
| * rs ----- |
| * rd ----- |
| */ |
| std::string NMD::SPECIAL2(uint64 instruction) |
| { |
| uint64 op_value = extract_op_25_to_3(instruction); |
| |
| std::string op = IMMEDIATE(copy(op_value)); |
| |
| return img::format("SPECIAL2 %s", op); |
| } |
| |
| |
| /* |
| * |
| * |
| * 3 2 1 |
| * 10987654321098765432109876543210 |
| * 001000 01001001101 |
| * rt ----- |
| * rs ----- |
| * rd ----- |
| */ |
| std::string NMD::SQRT_D(uint64 instruction) |
| { |
| uint64 ft_value = extract_ft_25_24_23_22_21(instruction); |
| uint64 fs_value = extract_fs_20_19_18_17_16(instruction); |
| |
| std::string ft = FPR(copy(ft_value)); |
| std::string fs = FPR(copy(fs_value)); |
| |
| return img::format("SQRT.D %s, %s", ft, fs); |
| } |
| |
| |
| /* |
| * |
| * |
| * 3 2 1 |
| * 10987654321098765432109876543210 |
| * 001000 01001001101 |
| * rt ----- |
| * rs ----- |
| * rd ----- |
| */ |
| std::string NMD::SQRT_S(uint64 instruction) |
| { |
| uint64 ft_value = extract_ft_25_24_23_22_21(instruction); |
| uint64 fs_value = extract_fs_20_19_18_17_16(instruction); |
| |
| std::string ft = FPR(copy(ft_value)); |
| std::string fs = FPR(copy(fs_value)); |
| |
| return img::format("SQRT.S %s, %s", ft, fs); |
| } |
| |
| |
| /* |
| * SRA rd, rt, sa - Shift Word Right Arithmetic |
| * |
| * 3 2 1 |
| * 10987654321098765432109876543210 |
| * 00000000000 000011 |
| * rt ----- |
| * rd ----- |
| * sa ----- |
| */ |
| std::string NMD::SRA(uint64 instruction) |
| { |
| uint64 rt_value = extract_rt_25_24_23_22_21(instruction); |
| uint64 rs_value = extract_rs_20_19_18_17_16(instruction); |
| uint64 shift_value = extract_shift_4_3_2_1_0(instruction); |
| |
| std::string rt = GPR(copy(rt_value)); |
| std::string rs = GPR(copy(rs_value)); |
| std::string shift = IMMEDIATE(copy(shift_value)); |
| |
| return img::format("SRA %s, %s, %s", rt, rs, shift); |
| } |
| |
| |
| /* |
| * SRAV rd, rt, rs - Shift Word Right Arithmetic Variable |
| * |
| * 3 2 1 |
| * 10987654321098765432109876543210 |
| * 001000 00000000111 |
| * rs ----- |
| * rt ----- |
| * rd ----- |
| */ |
| std::string NMD::SRAV(uint64 instruction) |
| { |
| uint64 rt_value = extract_rt_25_24_23_22_21(instruction); |
| uint64 rs_value = extract_rs_20_19_18_17_16(instruction); |
| uint64 rd_value = extract_rd_15_14_13_12_11(instruction); |
| |
| std::string rd = GPR(copy(rd_value)); |
| std::string rs = GPR(copy(rs_value)); |
| std::string rt = GPR(copy(rt_value)); |
| |
| return img::format("SRAV %s, %s, %s", rd, rs, rt); |
| } |
| |
| |
| /* |
| * |
| * |
| * 3 2 1 |
| * 10987654321098765432109876543210 |
| * 001000 00000000111 |
| * rs ----- |
| * rt ----- |
| * rd ----- |
| */ |
| std::string NMD::SRL_16_(uint64 instruction) |
| { |
| uint64 rt3_value = extract_rt3_9_8_7(instruction); |
| uint64 rs3_value = extract_rs3_6_5_4(instruction); |
| uint64 shift3_value = extract_shift3_2_1_0(instruction); |
| |
| std::string rt3 = GPR(decode_gpr_gpr3(rt3_value)); |
| std::string rs3 = GPR(decode_gpr_gpr3(rs3_value)); |
| std::string shift3 = IMMEDIATE(encode_shift3_from_shift(shift3_value)); |
| |
| return img::format("SRL %s, %s, %s", rt3, rs3, shift3); |
| } |
| |
| |
| /* |
| * |
| * |
| * 3 2 1 |
| * 10987654321098765432109876543210 |
| * 001000 01001001101 |
| * rt ----- |
| * rs ----- |
| * rd ----- |
| */ |
| std::string NMD::SRL_32_(uint64 instruction) |
| { |
| uint64 rt_value = extract_rt_25_24_23_22_21(instruction); |
| uint64 rs_value = extract_rs_20_19_18_17_16(instruction); |
| uint64 shift_value = extract_shift_4_3_2_1_0(instruction); |
| |
| std::string rt = GPR(copy(rt_value)); |
| std::string rs = GPR(copy(rs_value)); |
| std::string shift = IMMEDIATE(copy(shift_value)); |
| |
| return img::format("SRL %s, %s, %s", rt, rs, shift); |
| } |
| |
| |
| /* |
| * |
| * |
| * 3 2 1 |
| * 10987654321098765432109876543210 |
| * 001000 01001001101 |
| * rt ----- |
| * rs ----- |
| * rd ----- |
| */ |
| std::string NMD::SRLV(uint64 instruction) |
| { |
| uint64 rt_value = extract_rt_25_24_23_22_21(instruction); |
| uint64 rs_value = extract_rs_20_19_18_17_16(instruction); |
| uint64 rd_value = extract_rd_15_14_13_12_11(instruction); |
| |
| std::string rd = GPR(copy(rd_value)); |
| std::string rs = GPR(copy(rs_value)); |
| std::string rt = GPR(copy(rt_value)); |
| |
| return img::format("SRLV %s, %s, %s", rd, rs, rt); |
| } |
| |
| |
| /* |
| * |
| * |
| * 3 2 1 |
| * 10987654321098765432109876543210 |
| * 001000 01001001101 |
| * rt ----- |
| * rs ----- |
| * rd ----- |
| */ |
| std::string NMD::SUB(uint64 instruction) |
| { |
| uint64 rt_value = extract_rt_25_24_23_22_21(instruction); |
| uint64 rs_value = extract_rs_20_19_18_17_16(instruction); |
| uint64 rd_value = extract_rd_15_14_13_12_11(instruction); |
| |
| std::string rd = GPR(copy(rd_value)); |
| std::string rs = GPR(copy(rs_value)); |
| std::string rt = GPR(copy(rt_value)); |
| |
| return img::format("SUB %s, %s, %s", rd, rs, rt); |
| } |
| |
| |
| /* |
| * |
| * |
| * 3 2 1 |
| * 10987654321098765432109876543210 |
| * 001000 01001001101 |
| * rt ----- |
| * rs ----- |
| * rd ----- |
| */ |
| std::string NMD::SUB_D(uint64 instruction) |
| { |
| uint64 ft_value = extract_ft_25_24_23_22_21(instruction); |
| uint64 fs_value = extract_fs_20_19_18_17_16(instruction); |
| uint64 fd_value = extract_fd_15_14_13_12_11(instruction); |
| |
| std::string fd = FPR(copy(fd_value)); |
| std::string fs = FPR(copy(fs_value)); |
| std::string ft = FPR(copy(ft_value)); |
| |
| return img::format("SUB.D %s, %s, %s", fd, fs, ft); |
| } |
| |
| |
| /* |
| * |
| * |
| * 3 2 1 |
| * 10987654321098765432109876543210 |
| * 001000 01001001101 |
| * rt ----- |
| * rs ----- |
| * rd ----- |
| */ |
| std::string NMD::SUB_S(uint64 instruction) |
| { |
| uint64 ft_value = extract_ft_25_24_23_22_21(instruction); |
| uint64 fs_value = extract_fs_20_19_18_17_16(instruction); |
| uint64 fd_value = extract_fd_15_14_13_12_11(instruction); |
| |
| std::string fd = FPR(copy(fd_value)); |
| std::string fs = FPR(copy(fs_value)); |
| std::string ft = FPR(copy(ft_value)); |
| |
| return img::format("SUB.S %s, %s, %s", fd, fs, ft); |
| } |
| |
| |
| /* |
| * |
| * |
| * 3 2 1 |
| * 10987654321098765432109876543210 |
| * 001000 01001001101 |
| * rt ----- |
| * rs ----- |
| * rd ----- |
| */ |
| std::string NMD::SUBQ_PH(uint64 instruction) |
| { |
| uint64 rt_value = extract_rt_25_24_23_22_21(instruction); |
| uint64 rs_value = extract_rs_20_19_18_17_16(instruction); |
| uint64 rd_value = extract_rd_15_14_13_12_11(instruction); |
| |
| std::string rd = GPR(copy(rd_value)); |
| std::string rs = GPR(copy(rs_value)); |
| std::string rt = GPR(copy(rt_value)); |
| |
| return img::format("SUBQ.PH %s, %s, %s", rd, rs, rt); |
| } |
| |
| |
| /* |
| * [DSP] SUBQ.S.PH rd, rt, rs - Subtract fractional halfword vectors and shift |
| * right to halve results |
| * |
| * 3 2 1 |
| * 10987654321098765432109876543210 |
| * 001000 01001001101 |
| * rt ----- |
| * rs ----- |
| * rd ----- |
| */ |
| std::string NMD::SUBQ_S_PH(uint64 instruction) |
| { |
| uint64 rt_value = extract_rt_25_24_23_22_21(instruction); |
| uint64 rs_value = extract_rs_20_19_18_17_16(instruction); |
| uint64 rd_value = extract_rd_15_14_13_12_11(instruction); |
| |
| std::string rd = GPR(copy(rd_value)); |
| std::string rs = GPR(copy(rs_value)); |
| std::string rt = GPR(copy(rt_value)); |
| |
| return img::format("SUBQ_S.PH %s, %s, %s", rd, rs, rt); |
| } |
| |
| |
| /* |
| * [DSP] SUBQ.S.W rd, rt, rs - Subtract fractional halfword vectors and shift |
| * right to halve results |
| * |
| * 3 2 1 |
| * 10987654321098765432109876543210 |
| * 001000 01001001101 |
| * rt ----- |
| * rs ----- |
| * rd ----- |
| */ |
| std::string NMD::SUBQ_S_W(uint64 instruction) |
| { |
| uint64 rt_value = extract_rt_25_24_23_22_21(instruction); |
| uint64 rs_value = extract_rs_20_19_18_17_16(instruction); |
| uint64 rd_value = extract_rd_15_14_13_12_11(instruction); |
| |
| std::string rd = GPR(copy(rd_value)); |
| std::string rs = GPR(copy(rs_value)); |
| std::string rt = GPR(copy(rt_value)); |
| |
| return img::format("SUBQ_S.W %s, %s, %s", rd, rs, rt); |
| } |
| |
| |
| /* |
| * [DSP] SUBQH.PH rd, rt, rs - Subtract fractional halfword vectors and shift |
| * right to halve results |
| * |
| * 3 2 1 |
| * 10987654321098765432109876543210 |
| * 001000 01001001101 |
| * rt ----- |
| * rs ----- |
| * rd ----- |
| */ |
| std::string NMD::SUBQH_PH(uint64 instruction) |
| { |
| uint64 rt_value = extract_rt_25_24_23_22_21(instruction); |
| uint64 rs_value = extract_rs_20_19_18_17_16(instruction); |
| uint64 rd_value = extract_rd_15_14_13_12_11(instruction); |
| |
| std::string rd = GPR(copy(rd_value)); |
| std::string rs = GPR(copy(rs_value)); |
| std::string rt = GPR(copy(rt_value)); |
| |
| return img::format("SUBQH.PH %s, %s, %s", rd, rs, rt); |
| } |
| |
| |
| /* |
| * [DSP] SUBQH_R.PH rd, rt, rs - Subtract fractional halfword vectors and shift |
| * right to halve results |
| * |
| * 3 2 1 |
| * 10987654321098765432109876543210 |
| * 001000 01001001101 |
| * rt ----- |
| * rs ----- |
| * rd ----- |
| */ |
| std::string NMD::SUBQH_R_PH(uint64 instruction) |
| { |
| uint64 rt_value = extract_rt_25_24_23_22_21(instruction); |
| uint64 rs_value = extract_rs_20_19_18_17_16(instruction); |
| uint64 rd_value = extract_rd_15_14_13_12_11(instruction); |
| |
| std::string rd = GPR(copy(rd_value)); |
| std::string rs = GPR(copy(rs_value)); |
| std::string rt = GPR(copy(rt_value)); |
| |
| return img::format("SUBQH_R.PH %s, %s, %s", rd, rs, rt); |
| } |
| |
| |
| /* |
| * [DSP] SUBQH_R.W rd, rt, rs - Subtract fractional halfword vectors and shift |
| * right to halve results with rounding |
| * |
| * 3 2 1 |
| * 10987654321098765432109876543210 |
| * 001000 11001001101 |
| * rt ----- |
| * rs ----- |
| * rd ----- |
| */ |
| std::string NMD::SUBQH_R_W(uint64 instruction) |
| { |
| uint64 rt_value = extract_rt_25_24_23_22_21(instruction); |
| uint64 rs_value = extract_rs_20_19_18_17_16(instruction); |
| uint64 rd_value = extract_rd_15_14_13_12_11(instruction); |
| |
| std::string rd = GPR(copy(rd_value)); |
| std::string rs = GPR(copy(rs_value)); |
| std::string rt = GPR(copy(rt_value)); |
| |
| return img::format("SUBQH_R.W %s, %s, %s", rd, rs, rt); |
| } |
| |
| |
| /* |
| * [DSP] SUBQH.W rd, rs, rt - Subtract fractional words and shift right to |
| * halve results |
| * |
| * 3 2 1 |
| * 10987654321098765432109876543210 |
| * 001000 01010001101 |
| * rt ----- |
| * rs ----- |
| * rd ----- |
| */ |
| std::string NMD::SUBQH_W(uint64 instruction) |
| { |
| uint64 rt_value = extract_rt_25_24_23_22_21(instruction); |
| uint64 rs_value = extract_rs_20_19_18_17_16(instruction); |
| uint64 rd_value = extract_rd_15_14_13_12_11(instruction); |
| |
| std::string rd = GPR(copy(rd_value)); |
| std::string rs = GPR(copy(rs_value)); |
| std::string rt = GPR(copy(rt_value)); |
| |
| return img::format("SUBQH.W %s, %s, %s", rd, rs, rt); |
| } |
| |
| |
| /* |
| * ADDQH_R.W rd, rt, rs - Add Fractional Words And Shift Right to Halve Results |
| * |
| * 3 2 1 |
| * 10987654321098765432109876543210 |
| * 001000 00010001101 |
| * rt ----- |
| * rs ----- |
| * rd ----- |
| */ |
| std::string NMD::SUBU_16_(uint64 instruction) |
| { |
| uint64 rt3_value = extract_rt3_9_8_7(instruction); |
| uint64 rs3_value = extract_rs3_6_5_4(instruction); |
| uint64 rd3_value = extract_rd3_3_2_1(instruction); |
| |
| std::string rd3 = GPR(decode_gpr_gpr3(rd3_value)); |
| std::string rs3 = GPR(decode_gpr_gpr3(rs3_value)); |
| std::string rt3 = GPR(decode_gpr_gpr3(rt3_value)); |
| |
| return img::format("SUBU %s, %s, %s", rd3, rs3, rt3); |
| } |
| |
| |
| /* |
| * ADDQH_R.W rd, rt, rs - Add Fractional Words And Shift Right to Halve Results |
| * |
| * 3 2 1 |
| * 10987654321098765432109876543210 |
| * 001000 00010001101 |
| * rt ----- |
| * rs ----- |
| * rd ----- |
| */ |
| std::string NMD::SUBU_32_(uint64 instruction) |
| { |
| uint64 rt_value = extract_rt_25_24_23_22_21(instruction); |
| uint64 rs_value = extract_rs_20_19_18_17_16(instruction); |
| uint64 rd_value = extract_rd_15_14_13_12_11(instruction); |
| |
| std::string rd = GPR(copy(rd_value)); |
| std::string rs = GPR(copy(rs_value)); |
| std::string rt = GPR(copy(rt_value)); |
| |
| return img::format("SUBU %s, %s, %s", rd, rs, rt); |
| } |
| |
| |
| /* |
| * [DSP] SUBU.PH rd, rs, rt - Subtract unsigned unsigned halfwords |
| * |
| * 3 2 1 |
| * 10987654321098765432109876543210 |
| * 001000 01100001101 |
| * rt ----- |
| * rs ----- |
| * rd ----- |
| */ |
| std::string NMD::SUBU_PH(uint64 instruction) |
| { |
| uint64 rt_value = extract_rt_25_24_23_22_21(instruction); |
| uint64 rs_value = extract_rs_20_19_18_17_16(instruction); |
| uint64 rd_value = extract_rd_15_14_13_12_11(instruction); |
| |
| std::string rd = GPR(copy(rd_value)); |
| std::string rs = GPR(copy(rs_value)); |
| std::string rt = GPR(copy(rt_value)); |
| |
| return img::format("SUBU.PH %s, %s, %s", rd, rs, rt); |
| } |
| |
| |
| /* |
| * [DSP] SUBU.QB rd, rs, rt - Subtract unsigned quad byte vectors |
| * |
| * 3 2 1 |
| * 10987654321098765432109876543210 |
| * 001000 01011001101 |
| * rt ----- |
| * rs ----- |
| * rd ----- |
| */ |
| std::string NMD::SUBU_QB(uint64 instruction) |
| { |
| uint64 rt_value = extract_rt_25_24_23_22_21(instruction); |
| uint64 rs_value = extract_rs_20_19_18_17_16(instruction); |
| uint64 rd_value = extract_rd_15_14_13_12_11(instruction); |
| |
| std::string rd = GPR(copy(rd_value)); |
| std::string rs = GPR(copy(rs_value)); |
| std::string rt = GPR(copy(rt_value)); |
| |
| return img::format("SUBU.QB %s, %s, %s", rd, rs, rt); |
| } |
| |
| |
| /* |
| * [DSP] SUBU_S.PH rd, rs, rt - Subtract unsigned unsigned halfwords with |
| * 8-bit saturation |
| * |
| * 3 2 1 |
| * 10987654321098765432109876543210 |
| * 001000 11100001101 |
| * rt ----- |
| * rs ----- |
| * rd ----- |
| */ |
| std::string NMD::SUBU_S_PH(uint64 instruction) |
| { |
| uint64 rt_value = extract_rt_25_24_23_22_21(instruction); |
| uint64 rs_value = extract_rs_20_19_18_17_16(instruction); |
| uint64 rd_value = extract_rd_15_14_13_12_11(instruction); |
| |
| std::string rd = GPR(copy(rd_value)); |
| std::string rs = GPR(copy(rs_value)); |
| std::string rt = GPR(copy(rt_value)); |
| |
| return img::format("SUBU_S.PH %s, %s, %s", rd, rs, rt); |
| } |
| |
| |
| /* |
| * [DSP] SUBU_S.QB rd, rs, rt - Subtract unsigned quad byte vectors with |
| * 8-bit saturation |
| * |
| * 3 2 1 |
| * 10987654321098765432109876543210 |
| * 001000 11011001101 |
| * rt ----- |
| * rs ----- |
| * rd ----- |
| */ |
| std::string NMD::SUBU_S_QB(uint64 instruction) |
| { |
| uint64 rt_value = extract_rt_25_24_23_22_21(instruction); |
| uint64 rs_value = extract_rs_20_19_18_17_16(instruction); |
| uint64 rd_value = extract_rd_15_14_13_12_11(instruction); |
| |
| std::string rd = GPR(copy(rd_value)); |
| std::string rs = GPR(copy(rs_value)); |
| std::string rt = GPR(copy(rt_value)); |
| |
| return img::format("SUBU_S.QB %s, %s, %s", rd, rs, rt); |
| } |
| |
| |
| /* |
| * [DSP] SUBUH.QB rd, rs, rt - Subtract unsigned bytes and right shift |
| * to halve results |
| * |
| * 3 2 1 |
| * 10987654321098765432109876543210 |
| * 001000 01101001101 |
| * rt ----- |
| * rs ----- |
| * rd ----- |
| */ |
| std::string NMD::SUBUH_QB(uint64 instruction) |
| { |
| uint64 rt_value = extract_rt_25_24_23_22_21(instruction); |
| uint64 rs_value = extract_rs_20_19_18_17_16(instruction); |
| uint64 rd_value = extract_rd_15_14_13_12_11(instruction); |
| |
| std::string rd = GPR(copy(rd_value)); |
| std::string rs = GPR(copy(rs_value)); |
| std::string rt = GPR(copy(rt_value)); |
| |
| return img::format("SUBUH.QB %s, %s, %s", rd, rs, rt); |
| } |
| |
| |
| /* |
| * [DSP] SUBUH_R.QB rd, rs, rt - Subtract unsigned bytes and right shift |
| * to halve results with rounding |
| * |
| * 3 2 1 |
| * 10987654321098765432109876543210 |
| * 001000 11101001101 |
| * rt ----- |
| * rs ----- |
| * rd ----- |
| */ |
| std::string NMD::SUBUH_R_QB(uint64 instruction) |
| { |
| uint64 rt_value = extract_rt_25_24_23_22_21(instruction); |
| uint64 rs_value = extract_rs_20_19_18_17_16(instruction); |
| uint64 rd_value = extract_rd_15_14_13_12_11(instruction); |
| |
| std::string rd = GPR(copy(rd_value)); |
| std::string rs = GPR(copy(rs_value)); |
| std::string rt = GPR(copy(rt_value)); |
| |
| return img::format("SUBUH_R.QB %s, %s, %s", rd, rs, rt); |
| } |
| |
| |
| /* |
| * ADDQH_R.W rd, rt, rs - Add Fractional Words And Shift Right to Halve Results |
| * |
| * 3 2 1 |
| * 10987654321098765432109876543210 |
| * 001000 00010001101 |
| * rt ----- |
| * rs ----- |
| * rd ----- |
| */ |
| std::string NMD::SW_16_(uint64 instruction) |
| { |
| uint64 rtz3_value = extract_rtz3_9_8_7(instruction); |
| uint64 rs3_value = extract_rs3_6_5_4(instruction); |
| uint64 u_value = extract_u_3_2_1_0__s2(instruction); |
| |
| std::string rtz3 = GPR(decode_gpr_gpr3_src_store(rtz3_value)); |
| std::string u = IMMEDIATE(copy(u_value)); |
| std::string rs3 = GPR(decode_gpr_gpr3(rs3_value)); |
| |
| return img::format("SW %s, %s(%s)", rtz3, u, rs3); |
| } |
| |
| |
| /* |
| * ADDQH_R.W rd, rt, rs - Add Fractional Words And Shift Right to Halve Results |
| * |
| * 3 2 1 |
| * 10987654321098765432109876543210 |
| * 001000 00010001101 |
| * rt ----- |
| * rs ----- |
| * rd ----- |
| */ |
| std::string NMD::SW_4X4_(uint64 instruction) |
| { |
| uint64 rtz4_value = extract_rtz4_9_7_6_5(instruction); |
| uint64 rs4_value = extract_rs4_4_2_1_0(instruction); |
| uint64 u_value = extract_u_3_8__s2(instruction); |
| |
| std::string rtz4 = GPR(decode_gpr_gpr4_zero(rtz4_value)); |
| std::string u = IMMEDIATE(copy(u_value)); |
| std::string rs4 = GPR(decode_gpr_gpr4(rs4_value)); |
| |
| return img::format("SW %s, %s(%s)", rtz4, u, rs4); |
| } |
| |
| |
| /* |
| * ADDQH_R.W rd, rt, rs - Add Fractional Words And Shift Right to Halve Results |
| * |
| * 3 2 1 |
| * 10987654321098765432109876543210 |
| * 001000 00010001101 |
| * rt ----- |
| * rs ----- |
| * rd ----- |
| */ |
| std::string NMD::SW_GP16_(uint64 instruction) |
| { |
| uint64 u_value = extract_u_6_5_4_3_2_1_0__s2(instruction); |
| uint64 rtz3_value = extract_rtz3_9_8_7(instruction); |
| |
| std::string rtz3 = GPR(decode_gpr_gpr3_src_store(rtz3_value)); |
| std::string u = IMMEDIATE(copy(u_value)); |
| |
| return img::format("SW %s, %s($%d)", rtz3, u, 28); |
| } |
| |
| |
| /* |
| * ADDQH_R.W rd, rt, rs - Add Fractional Words And Shift Right to Halve Results |
| * |
| * 3 2 1 |
| * 10987654321098765432109876543210 |
| * 001000 00010001101 |
| * rt ----- |
| * rs ----- |
| * rd ----- |
| */ |
| std::string NMD::SW_GP_(uint64 instruction) |
| { |
| uint64 rt_value = extract_rt_25_24_23_22_21(instruction); |
| uint64 u_value = extract_u_20_to_2__s2(instruction); |
| |
| std::string rt = GPR(copy(rt_value)); |
| std::string u = IMMEDIATE(copy(u_value)); |
| |
| return img::format("SW %s, %s($%d)", rt, u, 28); |
| } |
| |
| |
| /* |
| * ADDQH_R.W rd, rt, rs - Add Fractional Words And Shift Right to Halve Results |
| * |
| * 3 2 1 |
| * 10987654321098765432109876543210 |
| * 001000 00010001101 |
| * rt ----- |
| * rs ----- |
| * rd ----- |
| */ |
| std::string NMD::SW_S9_(uint64 instruction) |
| { |
| uint64 rt_value = extract_rt_25_24_23_22_21(instruction); |
| int64 s_value = extract_s__se8_15_7_6_5_4_3_2_1_0(instruction); |
| uint64 rs_value = extract_rs_20_19_18_17_16(instruction); |
| |
| std::string rt = GPR(copy(rt_value)); |
| std::string s = IMMEDIATE(copy(s_value)); |
| std::string rs = GPR(copy(rs_value)); |
| |
| return img::format("SW %s, %s(%s)", rt, s, rs); |
| } |
| |
| |
| /* |
| * ADDQH_R.W rd, rt, rs - Add Fractional Words And Shift Right to Halve Results |
| * |
| * 3 2 1 |
| * 10987654321098765432109876543210 |
| * 001000 00010001101 |
| * rt ----- |
| * rs ----- |
| * rd ----- |
| */ |
| std::string NMD::SW_SP_(uint64 instruction) |
| { |
| uint64 rt_value = extract_rt_9_8_7_6_5(instruction); |
| uint64 u_value = extract_u_4_3_2_1_0__s2(instruction); |
| |
| std::string rt = GPR(copy(rt_value)); |
| std::string u = IMMEDIATE(copy(u_value)); |
| |
| return img::format("SW %s, %s($%d)", rt, u, 29); |
| } |
| |
| |
| /* |
| * ADDQH_R.W rd, rt, rs - Add Fractional Words And Shift Right to Halve Results |
| * |
| * 3 2 1 |
| * 10987654321098765432109876543210 |
| * 001000 00010001101 |
| * rt ----- |
| * rs ----- |
| * rd ----- |
| */ |
| std::string NMD::SW_U12_(uint64 instruction) |
| { |
| uint64 rt_value = extract_rt_25_24_23_22_21(instruction); |
| uint64 rs_value = extract_rs_20_19_18_17_16(instruction); |
| uint64 u_value = extract_u_11_10_9_8_7_6_5_4_3_2_1_0(instruction); |
| |
| std::string rt = GPR(copy(rt_value)); |
| std::string u = IMMEDIATE(copy(u_value)); |
| std::string rs = GPR(copy(rs_value)); |
| |
| return img::format("SW %s, %s(%s)", rt, u, rs); |
| } |
| |
| |
| /* |
| * ADDQH_R.W rd, rt, rs - Add Fractional Words And Shift Right to Halve Results |
| * |
| * 3 2 1 |
| * 10987654321098765432109876543210 |
| * 001000 00010001101 |
| * rt ----- |
| * rs ----- |
| * rd ----- |
| */ |
| std::string NMD::SWC1_GP_(uint64 instruction) |
| { |
| uint64 ft_value = extract_ft_25_24_23_22_21(instruction); |
| uint64 u_value = extract_u_17_to_2__s2(instruction); |
| |
| std::string ft = FPR(copy(ft_value)); |
| std::string u = IMMEDIATE(copy(u_value)); |
| |
| return img::format("SWC1 %s, %s($%d)", ft, u, 28); |
| } |
| |
| |
| /* |
| * ADDQH_R.W rd, rt, rs - Add Fractional Words And Shift Right to Halve Results |
| * |
| * 3 2 1 |
| * 10987654321098765432109876543210 |
| * 001000 00010001101 |
| * rt ----- |
| * rs ----- |
| * rd ----- |
| */ |
| std::string NMD::SWC1_S9_(uint64 instruction) |
| { |
| uint64 ft_value = extract_ft_25_24_23_22_21(instruction); |
| uint64 rs_value = extract_rs_20_19_18_17_16(instruction); |
| int64 s_value = extract_s__se8_15_7_6_5_4_3_2_1_0(instruction); |
| |
| std::string ft = FPR(copy(ft_value)); |
| std::string s = IMMEDIATE(copy(s_value)); |
| std::string rs = GPR(copy(rs_value)); |
| |
| return img::format("SWC1 %s, %s(%s)", ft, s, rs); |
| } |
| |
| |
| /* |
| * ADDQH_R.W rd, rt, rs - Add Fractional Words And Shift Right to Halve Results |
| * |
| * 3 2 1 |
| * 10987654321098765432109876543210 |
| * 001000 00010001101 |
| * rt ----- |
| * rs ----- |
| * rd ----- |
| */ |
| std::string NMD::SWC1_U12_(uint64 instruction) |
| { |
| uint64 ft_value = extract_ft_25_24_23_22_21(instruction); |
| uint64 rs_value = extract_rs_20_19_18_17_16(instruction); |
| uint64 u_value = extract_u_11_10_9_8_7_6_5_4_3_2_1_0(instruction); |
| |
| std::string ft = FPR(copy(ft_value)); |
| std::string u = IMMEDIATE(copy(u_value)); |
| std::string rs = GPR(copy(rs_value)); |
| |
| return img::format("SWC1 %s, %s(%s)", ft, u, rs); |
| } |
| |
| |
| /* |
| * ADDQH_R.W rd, rt, rs - Add Fractional Words And Shift Right to Halve Results |
| * |
| * 3 2 1 |
| * 10987654321098765432109876543210 |
| * 001000 00010001101 |
| * rt ----- |
| * rs ----- |
| * rd ----- |
| */ |
| std::string NMD::SWC1X(uint64 instruction) |
| { |
| uint64 rt_value = extract_rt_25_24_23_22_21(instruction); |
| uint64 rs_value = extract_rs_20_19_18_17_16(instruction); |
| uint64 ft_value = extract_ft_15_14_13_12_11(instruction); |
| |
| std::string ft = FPR(copy(ft_value)); |
| std::string rs = GPR(copy(rs_value)); |
| std::string rt = GPR(copy(rt_value)); |
| |
| return img::format("SWC1X %s, %s(%s)", ft, rs, rt); |
| } |
| |
| |
| /* |
| * ADDQH_R.W rd, rt, rs - Add Fractional Words And Shift Right to Halve Results |
| * |
| * 3 2 1 |
| * 10987654321098765432109876543210 |
| * 001000 00010001101 |
| * rt ----- |
| * rs ----- |
| * rd ----- |
| */ |
| std::string NMD::SWC1XS(uint64 instruction) |
| { |
| uint64 rt_value = extract_rt_25_24_23_22_21(instruction); |
| uint64 rs_value = extract_rs_20_19_18_17_16(instruction); |
| uint64 ft_value = extract_ft_15_14_13_12_11(instruction); |
| |
| std::string ft = FPR(copy(ft_value)); |
| std::string rs = GPR(copy(rs_value)); |
| std::string rt = GPR(copy(rt_value)); |
| |
| return img::format("SWC1XS %s, %s(%s)", ft, rs, rt); |
| } |
| |
| |
| /* |
| * ADDQH_R.W rd, rt, rs - Add Fractional Words And Shift Right to Halve Results |
| * |
| * 3 2 1 |
| * 10987654321098765432109876543210 |
| * 001000 00010001101 |
| * rt ----- |
| * rs ----- |
| * rd ----- |
| */ |
| std::string NMD::SWC2(uint64 instruction) |
| { |
| uint64 cs_value = extract_cs_25_24_23_22_21(instruction); |
| uint64 rs_value = extract_rs_20_19_18_17_16(instruction); |
| int64 s_value = extract_s__se8_15_7_6_5_4_3_2_1_0(instruction); |
| |
| std::string cs = CPR(copy(cs_value)); |
| std::string s = IMMEDIATE(copy(s_value)); |
| std::string rs = GPR(copy(rs_value)); |
| |
| return img::format("SWC2 %s, %s(%s)", cs, s, rs); |
| } |
| |
| |
| /* |
| * ADDQH_R.W rd, rt, rs - Add Fractional Words And Shift Right to Halve Results |
| * |
| * 3 2 1 |
| * 10987654321098765432109876543210 |
| * 001000 00010001101 |
| * rt ----- |
| * rs ----- |
| * rd ----- |
| */ |
| std::string NMD::SWE(uint64 instruction) |
| { |
| uint64 rt_value = extract_rt_25_24_23_22_21(instruction); |
| uint64 rs_value = extract_rs_20_19_18_17_16(instruction); |
| int64 s_value = extract_s__se8_15_7_6_5_4_3_2_1_0(instruction); |
| |
| std::string rt = GPR(copy(rt_value)); |
| std::string s = IMMEDIATE(copy(s_value)); |
| std::string rs = GPR(copy(rs_value)); |
| |
| return img::format("SWE %s, %s(%s)", rt, s, rs); |
| } |
| |
| |
| /* |
| * ADDQH_R.W rd, rt, rs - Add Fractional Words And Shift Right to Halve Results |
| * |
| * 3 2 1 |
| * 10987654321098765432109876543210 |
| * 001000 00010001101 |
| * rt ----- |
| * rs ----- |
| * rd ----- |
| */ |
| std::string NMD::SWM(uint64 instruction) |
| { |
| uint64 rt_value = extract_rt_25_24_23_22_21(instruction); |
| uint64 rs_value = extract_rs_20_19_18_17_16(instruction); |
| int64 s_value = extract_s__se8_15_7_6_5_4_3_2_1_0(instruction); |
| uint64 count3_value = extract_count3_14_13_12(instruction); |
| |
| std::string rt = GPR(copy(rt_value)); |
| std::string s = IMMEDIATE(copy(s_value)); |
| std::string rs = GPR(copy(rs_value)); |
| std::string count3 = IMMEDIATE(encode_count3_from_count(count3_value)); |
| |
| return img::format("SWM %s, %s(%s), %s", rt, s, rs, count3); |
| } |
| |
| |
| /* |
| * ADDQH_R.W rd, rt, rs - Add Fractional Words And Shift Right to Halve Results |
| * |
| * 3 2 1 |
| * 10987654321098765432109876543210 |
| * 001000 00010001101 |
| * rt ----- |
| * rs ----- |
| * rd ----- |
| */ |
| std::string NMD::SWPC_48_(uint64 instruction) |
| { |
| uint64 rt_value = extract_rt_41_40_39_38_37(instruction); |
| int64 s_value = extract_s__se31_15_to_0_31_to_16(instruction); |
| |
| std::string rt = GPR(copy(rt_value)); |
| std::string s = ADDRESS(encode_s_from_address(s_value), 6); |
| |
| return img::format("SWPC %s, %s", rt, s); |
| } |
| |
| |
| /* |
| * ADDQH_R.W rd, rt, rs - Add Fractional Words And Shift Right to Halve Results |
| * |
| * 3 2 1 |
| * 10987654321098765432109876543210 |
| * 001000 00010001101 |
| * rt ----- |
| * rs ----- |
| * rd ----- |
| */ |
| std::string NMD::SWX(uint64 instruction) |
| { |
| uint64 rt_value = extract_rt_25_24_23_22_21(instruction); |
| uint64 rs_value = extract_rs_20_19_18_17_16(instruction); |
| uint64 rd_value = extract_rd_15_14_13_12_11(instruction); |
| |
| std::string rd = GPR(copy(rd_value)); |
| std::string rs = GPR(copy(rs_value)); |
| std::string rt = GPR(copy(rt_value)); |
| |
| return img::format("SWX %s, %s(%s)", rd, rs, rt); |
| } |
| |
| |
| /* |
| * ADDQH_R.W rd, rt, rs - Add Fractional Words And Shift Right to Halve Results |
| * |
| * 3 2 1 |
| * 10987654321098765432109876543210 |
| * 001000 00010001101 |
| * rt ----- |
| * rs ----- |
| * rd ----- |
| */ |
| std::string NMD::SWXS(uint64 instruction) |
| { |
| uint64 rt_value = extract_rt_25_24_23_22_21(instruction); |
| uint64 rs_value = extract_rs_20_19_18_17_16(instruction); |
| uint64 rd_value = extract_rd_15_14_13_12_11(instruction); |
| |
| std::string rd = GPR(copy(rd_value)); |
| std::string rs = GPR(copy(rs_value)); |
| std::string rt = GPR(copy(rt_value)); |
| |
| return img::format("SWXS %s, %s(%s)", rd, rs, rt); |
| } |
| |
| |
| /* |
| * ADDQH_R.W rd, rt, rs - Add Fractional Words And Shift Right to Halve Results |
| * |
| * 3 2 1 |
| * 10987654321098765432109876543210 |
| * 001000 00010001101 |
| * rt ----- |
| * rs ----- |
| * rd ----- |
| */ |
| std::string NMD::SYNC(uint64 instruction) |
| { |
| uint64 stype_value = extract_stype_20_19_18_17_16(instruction); |
| |
| std::string stype = IMMEDIATE(copy(stype_value)); |
| |
| return img::format("SYNC %s", stype); |
| } |
| |
| |
| /* |
| * ADDQH_R.W rd, rt, rs - Add Fractional Words And Shift Right to Halve Results |
| * |
| * 3 2 1 |
| * 10987654321098765432109876543210 |
| * 001000 00010001101 |
| * rt ----- |
| * rs ----- |
| * rd ----- |
| */ |
| std::string NMD::SYNCI(uint64 instruction) |
| { |
| uint64 rs_value = extract_rs_20_19_18_17_16(instruction); |
| int64 s_value = extract_s__se8_15_7_6_5_4_3_2_1_0(instruction); |
| |
| std::string s = IMMEDIATE(copy(s_value)); |
| std::string rs = GPR(copy(rs_value)); |
| |
| return img::format("SYNCI %s(%s)", s, rs); |
| } |
| |
| |
| /* |
| * ADDQH_R.W rd, rt, rs - Add Fractional Words And Shift Right to Halve Results |
| * |
| * 3 2 1 |
| * 10987654321098765432109876543210 |
| * 001000 00010001101 |
| * rt ----- |
| * rs ----- |
| * rd ----- |
| */ |
| std::string NMD::SYNCIE(uint64 instruction) |
| { |
| uint64 rs_value = extract_rs_20_19_18_17_16(instruction); |
| int64 s_value = extract_s__se8_15_7_6_5_4_3_2_1_0(instruction); |
| |
| std::string s = IMMEDIATE(copy(s_value)); |
| std::string rs = GPR(copy(rs_value)); |
| |
| return img::format("SYNCIE %s(%s)", s, rs); |
| } |
| |
| |
| /* |
| * ADDQH_R.W rd, rt, rs - Add Fractional Words And Shift Right to Halve Results |
| * |
| * 3 2 1 |
| * 10987654321098765432109876543210 |
| * 001000 00010001101 |
| * rt ----- |
| * rs ----- |
| * rd ----- |
| */ |
| std::string NMD::SYSCALL_16_(uint64 instruction) |
| { |
| uint64 code_value = extract_code_1_0(instruction); |
| |
| std::string code = IMMEDIATE(copy(code_value)); |
| |
| return img::format("SYSCALL %s", code); |
| } |
| |
| |
| /* |
| * SYSCALL code - System Call. Cause a System Call Exception |
| * |
| * 3 2 1 |
| * 10987654321098765432109876543210 |
| * 00000000000010 |
| * code ------------------ |
| */ |
| std::string NMD::SYSCALL_32_(uint64 instruction) |
| { |
| uint64 code_value = extract_code_17_to_0(instruction); |
| |
| std::string code = IMMEDIATE(copy(code_value)); |
| |
| return img::format("SYSCALL %s", code); |
| } |
| |
| |
| /* |
| * ADDQH_R.W rd, rt, rs - Add Fractional Words And Shift Right to Halve Results |
| * |
| * 3 2 1 |
| * 10987654321098765432109876543210 |
| * 001000 00010001101 |
| * rt ----- |
| * rs ----- |
| * rd ----- |
| */ |
| std::string NMD::TEQ(uint64 instruction) |
| { |
| uint64 rt_value = extract_rt_25_24_23_22_21(instruction); |
| uint64 rs_value = extract_rs_20_19_18_17_16(instruction); |
| |
| std::string rs = GPR(copy(rs_value)); |
| std::string rt = GPR(copy(rt_value)); |
| |
| return img::format("TEQ %s, %s", rs, rt); |
| } |
| |
| |
| /* |
| * ADDQH_R.W rd, rt, rs - Add Fractional Words And Shift Right to Halve Results |
| * |
| * 3 2 1 |
| * 10987654321098765432109876543210 |
| * 001000 00010001101 |
| * rt ----- |
| * rs ----- |
| * rd ----- |
| */ |
| std::string NMD::TLBGINV(uint64 instruction) |
| { |
| (void)instruction; |
| |
| return "TLBGINV "; |
| } |
| |
| |
| /* |
| * ADDQH_R.W rd, rt, rs - Add Fractional Words And Shift Right to Halve Results |
| * |
| * 3 2 1 |
| * 10987654321098765432109876543210 |
| * 001000 00010001101 |
| * rt ----- |
| * rs ----- |
| * rd ----- |
| */ |
| std::string NMD::TLBGINVF(uint64 instruction) |
| { |
| (void)instruction; |
| |
| return "TLBGINVF "; |
| } |
| |
| |
| /* |
| * ADDQH_R.W rd, rt, rs - Add Fractional Words And Shift Right to Halve Results |
| * |
| * 3 2 1 |
| * 10987654321098765432109876543210 |
| * 001000 00010001101 |
| * rt ----- |
| * rs ----- |
| * rd ----- |
| */ |
| std::string NMD::TLBGP(uint64 instruction) |
| { |
| (void)instruction; |
| |
| return "TLBGP "; |
| } |
| |
| |
| /* |
| * ADDQH_R.W rd, rt, rs - Add Fractional Words And Shift Right to Halve Results |
| * |
| * 3 2 1 |
| * 10987654321098765432109876543210 |
| * 001000 00010001101 |
| * rt ----- |
| * rs ----- |
| * rd ----- |
| */ |
| std::string NMD::TLBGR(uint64 instruction) |
| { |
| (void)instruction; |
| |
| return "TLBGR "; |
| } |
| |
| |
| /* |
| * ADDQH_R.W rd, rt, rs - Add Fractional Words And Shift Right to Halve Results |
| * |
| * 3 2 1 |
| * 10987654321098765432109876543210 |
| * 001000 00010001101 |
| * rt ----- |
| * rs ----- |
| * rd ----- |
| */ |
| std::string NMD::TLBGWI(uint64 instruction) |
| { |
| (void)instruction; |
| |
| return "TLBGWI "; |
| } |
| |
| |
| /* |
| * ADDQH_R.W rd, rt, rs - Add Fractional Words And Shift Right to Halve Results |
| * |
| * 3 2 1 |
| * 10987654321098765432109876543210 |
| * 001000 00010001101 |
| * rt ----- |
| * rs ----- |
| * rd ----- |
| */ |
| std::string NMD::TLBGWR(uint64 instruction) |
| { |
| (void)instruction; |
| |
| return "TLBGWR "; |
| } |
| |
| |
| /* |
| * ADDQH_R.W rd, rt, rs - Add Fractional Words And Shift Right to Halve Results |
| * |
| * 3 2 1 |
| * 10987654321098765432109876543210 |
| * 001000 00010001101 |
| * rt ----- |
| * rs ----- |
| * rd ----- |
| */ |
| std::string NMD::TLBINV(uint64 instruction) |
| { |
| (void)instruction; |
| |
| return "TLBINV "; |
| } |
| |
| |
| /* |
| * ADDQH_R.W rd, rt, rs - Add Fractional Words And Shift Right to Halve Results |
| * |
| * 3 2 1 |
| * 10987654321098765432109876543210 |
| * 001000 00010001101 |
| * rt ----- |
| * rs ----- |
| * rd ----- |
| */ |
| std::string NMD::TLBINVF(uint64 instruction) |
| { |
| (void)instruction; |
| |
| return "TLBINVF "; |
| } |
| |
| |
| /* |
| * ADDQH_R.W rd, rt, rs - Add Fractional Words And Shift Right to Halve Results |
| * |
| * 3 2 1 |
| * 10987654321098765432109876543210 |
| * 001000 00010001101 |
| * rt ----- |
| * rs ----- |
| * rd ----- |
| */ |
| std::string NMD::TLBP(uint64 instruction) |
| { |
| (void)instruction; |
| |
| return "TLBP "; |
| } |
| |
| |
| /* |
| * ADDQH_R.W rd, rt, rs - Add Fractional Words And Shift Right to Halve Results |
| * |
| * 3 2 1 |
| * 10987654321098765432109876543210 |
| * 001000 00010001101 |
| * rt ----- |
| * rs ----- |
| * rd ----- |
| */ |
| std::string NMD::TLBR(uint64 instruction) |
| { |
| (void)instruction; |
| |
| return "TLBR "; |
| } |
| |
| |
| /* |
| * ADDQH_R.W rd, rt, rs - Add Fractional Words And Shift Right to Halve Results |
| * |
| * 3 2 1 |
| * 10987654321098765432109876543210 |
| * 001000 00010001101 |
| * rt ----- |
| * rs ----- |
| * rd ----- |
| */ |
| std::string NMD::TLBWI(uint64 instruction) |
| { |
| (void)instruction; |
| |
| return "TLBWI "; |
| } |
| |
| |
| /* |
| * ADDQH_R.W rd, rt, rs - Add Fractional Words And Shift Right to Halve Results |
| * |
| * 3 2 1 |
| * 10987654321098765432109876543210 |
| * 001000 00010001101 |
| * rt ----- |
| * rs ----- |
| * rd ----- |
| */ |
| std::string NMD::TLBWR(uint64 instruction) |
| { |
| (void)instruction; |
| |
| return "TLBWR "; |
| } |
| |
| |
| /* |
| * ADDQH_R.W rd, rt, rs - Add Fractional Words And Shift Right to Halve Results |
| * |
| * 3 2 1 |
| * 10987654321098765432109876543210 |
| * 001000 00010001101 |
| * rt ----- |
| * rs ----- |
| * rd ----- |
| */ |
| std::string NMD::TNE(uint64 instruction) |
| { |
| uint64 rt_value = extract_rt_25_24_23_22_21(instruction); |
| uint64 rs_value = extract_rs_20_19_18_17_16(instruction); |
| |
| std::string rs = GPR(copy(rs_value)); |
| std::string rt = GPR(copy(rt_value)); |
| |
| return img::format("TNE %s, %s", rs, rt); |
| } |
| |
| |
| /* |
| * ADDQH_R.W rd, rt, rs - Add Fractional Words And Shift Right to Halve Results |
| * |
| * 3 2 1 |
| * 10987654321098765432109876543210 |
| * 001000 00010001101 |
| * rt ----- |
| * rs ----- |
| * rd ----- |
| */ |
| std::string NMD::TRUNC_L_D(uint64 instruction) |
| { |
| uint64 ft_value = extract_ft_25_24_23_22_21(instruction); |
| uint64 fs_value = extract_fs_20_19_18_17_16(instruction); |
| |
| std::string ft = FPR(copy(ft_value)); |
| std::string fs = FPR(copy(fs_value)); |
| |
| return img::format("TRUNC.L.D %s, %s", ft, fs); |
| } |
| |
| |
| /* |
| * ADDQH_R.W rd, rt, rs - Add Fractional Words And Shift Right to Halve Results |
| * |
| * 3 2 1 |
| * 10987654321098765432109876543210 |
| * 001000 00010001101 |
| * rt ----- |
| * rs ----- |
| * rd ----- |
| */ |
| std::string NMD::TRUNC_L_S(uint64 instruction) |
| { |
| uint64 ft_value = extract_ft_25_24_23_22_21(instruction); |
| uint64 fs_value = extract_fs_20_19_18_17_16(instruction); |
| |
| std::string ft = FPR(copy(ft_value)); |
| std::string fs = FPR(copy(fs_value)); |
| |
| return img::format("TRUNC.L.S %s, %s", ft, fs); |
| } |
| |
| |
| /* |
| * ADDQH_R.W rd, rt, rs - Add Fractional Words And Shift Right to Halve Results |
| * |
| * 3 2 1 |
| * 10987654321098765432109876543210 |
| * 001000 00010001101 |
| * rt ----- |
| * rs ----- |
| * rd ----- |
| */ |
| std::string NMD::TRUNC_W_D(uint64 instruction) |
| { |
| uint64 ft_value = extract_ft_25_24_23_22_21(instruction); |
| uint64 fs_value = extract_fs_20_19_18_17_16(instruction); |
| |
| std::string ft = FPR(copy(ft_value)); |
| std::string fs = FPR(copy(fs_value)); |
| |
| return img::format("TRUNC.W.D %s, %s", ft, fs); |
| } |
| |
| |
| /* |
| * ADDQH_R.W rd, rt, rs - Add Fractional Words And Shift Right to Halve Results |
| * |
| * 3 2 1 |
| * 10987654321098765432109876543210 |
| * 001000 00010001101 |
| * rt ----- |
| * rs ----- |
| * rd ----- |
| */ |
| std::string NMD::TRUNC_W_S(uint64 instruction) |
| { |
| uint64 ft_value = extract_ft_25_24_23_22_21(instruction); |
| uint64 fs_value = extract_fs_20_19_18_17_16(instruction); |
| |
| std::string ft = FPR(copy(ft_value)); |
| std::string fs = FPR(copy(fs_value)); |
| |
| return img::format("TRUNC.W.S %s, %s", ft, fs); |
| } |
| |
| |
| /* |
| * ADDQH_R.W rd, rt, rs - Add Fractional Words And Shift Right to Halve Results |
| * |
| * 3 2 1 |
| * 10987654321098765432109876543210 |
| * 001000 00010001101 |
| * rt ----- |
| * rs ----- |
| * rd ----- |
| */ |
| std::string NMD::UALDM(uint64 instruction) |
| { |
| uint64 rt_value = extract_rt_25_24_23_22_21(instruction); |
| uint64 rs_value = extract_rs_20_19_18_17_16(instruction); |
| int64 s_value = extract_s__se8_15_7_6_5_4_3_2_1_0(instruction); |
| uint64 count3_value = extract_count3_14_13_12(instruction); |
| |
| std::string rt = GPR(copy(rt_value)); |
| std::string s = IMMEDIATE(copy(s_value)); |
| std::string rs = GPR(copy(rs_value)); |
| std::string count3 = IMMEDIATE(encode_count3_from_count(count3_value)); |
| |
| return img::format("UALDM %s, %s(%s), %s", rt, s, rs, count3); |
| } |
| |
| |
| /* |
| * ADDQH_R.W rd, rt, rs - Add Fractional Words And Shift Right to Halve Results |
| * |
| * 3 2 1 |
| * 10987654321098765432109876543210 |
| * 001000 00010001101 |
| * rt ----- |
| * rs ----- |
| * rd ----- |
| */ |
| std::string NMD::UALH(uint64 instruction) |
| { |
| uint64 rt_value = extract_rt_25_24_23_22_21(instruction); |
| uint64 rs_value = extract_rs_20_19_18_17_16(instruction); |
| int64 s_value = extract_s__se8_15_7_6_5_4_3_2_1_0(instruction); |
| |
| std::string rt = GPR(copy(rt_value)); |
| std::string s = IMMEDIATE(copy(s_value)); |
| std::string rs = GPR(copy(rs_value)); |
| |
| return img::format("UALH %s, %s(%s)", rt, s, rs); |
| } |
| |
| |
| /* |
| * ADDQH_R.W rd, rt, rs - Add Fractional Words And Shift Right to Halve Results |
| * |
| * 3 2 1 |
| * 10987654321098765432109876543210 |
| * 001000 00010001101 |
| * rt ----- |
| * rs ----- |
| * rd ----- |
| */ |
| std::string NMD::UALWM(uint64 instruction) |
| { |
| uint64 rt_value = extract_rt_25_24_23_22_21(instruction); |
| uint64 rs_value = extract_rs_20_19_18_17_16(instruction); |
| int64 s_value = extract_s__se8_15_7_6_5_4_3_2_1_0(instruction); |
| uint64 count3_value = extract_count3_14_13_12(instruction); |
| |
| std::string rt = GPR(copy(rt_value)); |
| std::string s = IMMEDIATE(copy(s_value)); |
| std::string rs = GPR(copy(rs_value)); |
| std::string count3 = IMMEDIATE(encode_count3_from_count(count3_value)); |
| |
| return img::format("UALWM %s, %s(%s), %s", rt, s, rs, count3); |
| } |
| |
| |
| /* |
| * ADDQH_R.W rd, rt, rs - Add Fractional Words And Shift Right to Halve Results |
| * |
| * 3 2 1 |
| * 10987654321098765432109876543210 |
| * 001000 00010001101 |
| * rt ----- |
| * rs ----- |
| * rd ----- |
| */ |
| std::string NMD::UASDM(uint64 instruction) |
| { |
| uint64 rt_value = extract_rt_25_24_23_22_21(instruction); |
| uint64 rs_value = extract_rs_20_19_18_17_16(instruction); |
| int64 s_value = extract_s__se8_15_7_6_5_4_3_2_1_0(instruction); |
| uint64 count3_value = extract_count3_14_13_12(instruction); |
| |
| std::string rt = GPR(copy(rt_value)); |
| std::string s = IMMEDIATE(copy(s_value)); |
| std::string rs = GPR(copy(rs_value)); |
| std::string count3 = IMMEDIATE(encode_count3_from_count(count3_value)); |
| |
| return img::format("UASDM %s, %s(%s), %s", rt, s, rs, count3); |
| } |
| |
| |
| /* |
| * ADDQH_R.W rd, rt, rs - Add Fractional Words And Shift Right to Halve Results |
| * |
| * 3 2 1 |
| * 10987654321098765432109876543210 |
| * 001000 00010001101 |
| * rt ----- |
| * rs ----- |
| * rd ----- |
| */ |
| std::string NMD::UASH(uint64 instruction) |
| { |
| uint64 rt_value = extract_rt_25_24_23_22_21(instruction); |
| uint64 rs_value = extract_rs_20_19_18_17_16(instruction); |
| int64 s_value = extract_s__se8_15_7_6_5_4_3_2_1_0(instruction); |
| |
| std::string rt = GPR(copy(rt_value)); |
| std::string s = IMMEDIATE(copy(s_value)); |
| std::string rs = GPR(copy(rs_value)); |
| |
| return img::format("UASH %s, %s(%s)", rt, s, rs); |
| } |
| |
| |
| /* |
| * ADDQH_R.W rd, rt, rs - Add Fractional Words And Shift Right to Halve Results |
| * |
| * 3 2 1 |
| * 10987654321098765432109876543210 |
| * 001000 00010001101 |
| * rt ----- |
| * rs ----- |
| * rd ----- |
| */ |
| std::string NMD::UASWM(uint64 instruction) |
| { |
| uint64 rt_value = extract_rt_25_24_23_22_21(instruction); |
| uint64 rs_value = extract_rs_20_19_18_17_16(instruction); |
| int64 s_value = extract_s__se8_15_7_6_5_4_3_2_1_0(instruction); |
| uint64 count3_value = extract_count3_14_13_12(instruction); |
| |
| std::string rt = GPR(copy(rt_value)); |
| std::string s = IMMEDIATE(copy(s_value)); |
| std::string rs = GPR(copy(rs_value)); |
| std::string count3 = IMMEDIATE(encode_count3_from_count(count3_value)); |
| |
| return img::format("UASWM %s, %s(%s), %s", rt, s, rs, count3); |
| } |
| |
| |
| /* |
| * ADDQH_R.W rd, rt, rs - Add Fractional Words And Shift Right to Halve Results |
| * |
| * 3 2 1 |
| * 10987654321098765432109876543210 |
| * 001000 00010001101 |
| * rt ----- |
| * rs ----- |
| * rd ----- |
| */ |
| std::string NMD::UDI(uint64 instruction) |
| { |
| uint64 op_value = extract_op_25_to_3(instruction); |
| |
| std::string op = IMMEDIATE(copy(op_value)); |
| |
| return img::format("UDI %s", op); |
| } |
| |
| |
| /* |
| * WAIT code - Enter Wait State |
| * |
| * 3 2 1 |
| * 10987654321098765432109876543210 |
| * 001000 1100001101111111 |
| * code ---------- |
| */ |
| std::string NMD::WAIT(uint64 instruction) |
| { |
| uint64 code_value = extract_code_25_24_23_22_21_20_19_18_17_16(instruction); |
| |
| std::string code = IMMEDIATE(copy(code_value)); |
| |
| return img::format("WAIT %s", code); |
| } |
| |
| |
| /* |
| * [DSP] WRDSP rt, mask - Write selected fields from a GPR to the DSPControl |
| * register |
| * |
| * 3 2 1 |
| * 10987654321098765432109876543210 |
| * 001000 01011001111111 |
| * rt ----- |
| * mask ------- |
| */ |
| std::string NMD::WRDSP(uint64 instruction) |
| { |
| uint64 rt_value = extract_rt_25_24_23_22_21(instruction); |
| uint64 mask_value = extract_mask_20_19_18_17_16_15_14(instruction); |
| |
| std::string rt = GPR(copy(rt_value)); |
| std::string mask = IMMEDIATE(copy(mask_value)); |
| |
| return img::format("WRDSP %s, %s", rt, mask); |
| } |
| |
| |
| /* |
| * ADDQH_R.W rd, rt, rs - Add Fractional Words And Shift Right to Halve Results |
| * |
| * 3 2 1 |
| * 10987654321098765432109876543210 |
| * 001000 00010001101 |
| * rt ----- |
| * rs ----- |
| * rd ----- |
| */ |
| std::string NMD::WRPGPR(uint64 instruction) |
| { |
| uint64 rt_value = extract_rt_25_24_23_22_21(instruction); |
| uint64 rs_value = extract_rs_20_19_18_17_16(instruction); |
| |
| std::string rt = GPR(copy(rt_value)); |
| std::string rs = GPR(copy(rs_value)); |
| |
| return img::format("WRPGPR %s, %s", rt, rs); |
| } |
| |
| |
| /* |
| * ADDQH_R.W rd, rt, rs - Add Fractional Words And Shift Right to Halve Results |
| * |
| * 3 2 1 |
| * 10987654321098765432109876543210 |
| * 001000 00010001101 |
| * rt ----- |
| * rs ----- |
| * rd ----- |
| */ |
| std::string NMD::XOR_16_(uint64 instruction) |
| { |
| uint64 rt3_value = extract_rt3_9_8_7(instruction); |
| uint64 rs3_value = extract_rs3_6_5_4(instruction); |
| |
| std::string rs3 = GPR(decode_gpr_gpr3(rs3_value)); |
| std::string rt3 = GPR(decode_gpr_gpr3(rt3_value)); |
| |
| return img::format("XOR %s, %s", rs3, rt3); |
| } |
| |
| |
| /* |
| * ADDQH_R.W rd, rt, rs - Add Fractional Words And Shift Right to Halve Results |
| * |
| * 3 2 1 |
| * 10987654321098765432109876543210 |
| * 001000 00010001101 |
| * rt ----- |
| * rs ----- |
| * rd ----- |
| */ |
| std::string NMD::XOR_32_(uint64 instruction) |
| { |
| uint64 rt_value = extract_rt_25_24_23_22_21(instruction); |
| uint64 rs_value = extract_rs_20_19_18_17_16(instruction); |
| uint64 rd_value = extract_rd_15_14_13_12_11(instruction); |
| |
| std::string rd = GPR(copy(rd_value)); |
| std::string rs = GPR(copy(rs_value)); |
| std::string rt = GPR(copy(rt_value)); |
| |
| return img::format("XOR %s, %s, %s", rd, rs, rt); |
| } |
| |
| |
| /* |
| * ADDQH_R.W rd, rt, rs - Add Fractional Words And Shift Right to Halve Results |
| * |
| * 3 2 1 |
| * 10987654321098765432109876543210 |
| * 001000 00010001101 |
| * rt ----- |
| * rs ----- |
| * rd ----- |
| */ |
| std::string NMD::XORI(uint64 instruction) |
| { |
| uint64 rt_value = extract_rt_25_24_23_22_21(instruction); |
| uint64 rs_value = extract_rs_20_19_18_17_16(instruction); |
| uint64 u_value = extract_u_11_10_9_8_7_6_5_4_3_2_1_0(instruction); |
| |
| std::string rt = GPR(copy(rt_value)); |
| std::string rs = GPR(copy(rs_value)); |
| std::string u = IMMEDIATE(copy(u_value)); |
| |
| return img::format("XORI %s, %s, %s", rt, rs, u); |
| } |
| |
| |
| /* |
| * YIELD rt, rs - |
| * |
| * 3 2 1 |
| * 10987654321098765432109876543210 |
| * 001000 00010001101 |
| * rt ----- |
| * rs ----- |
| */ |
| std::string NMD::YIELD(uint64 instruction) |
| { |
| uint64 rt_value = extract_rt_25_24_23_22_21(instruction); |
| uint64 rs_value = extract_rs_20_19_18_17_16(instruction); |
| |
| std::string rt = GPR(copy(rt_value)); |
| std::string rs = GPR(copy(rs_value)); |
| |
| return img::format("YIELD %s, %s", rt, rs); |
| } |
| |
| |
| |
| /* |
| * nanoMIPS instruction pool organization |
| * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
| * |
| * |
| * āā P.ADDIU āāā P.RI āāā P.SYSCALL |
| * ā |
| * ā āā P.TRAP |
| * ā ā |
| * ā āā _POOL32A0_0 āā¼ā P.CMOVE |
| * ā ā ā |
| * ā ā āā P.SLTU |
| * ā āā _POOL32A0 ā⤠|
| * ā ā ā |
| * ā ā ā |
| * ā ā āā _POOL32A0_1 āāā CRC32 |
| * ā ā |
| * āā P32A ā⤠|
| * ā ā āā PP.LSX |
| * ā ā āā P.LSX āāāāā⤠|
| * ā ā ā āā PP.LSXS |
| * ā āā _POOL32A7 ā⤠|
| * ā ā āā POOL32Axf_4 |
| * ā āā POOL32Axf ā⤠|
| * ā āā POOL32Axf_5 |
| * ā |
| * āā PBAL |
| * ā |
| * āā P.GP.W āā PP.LSX |
| * āā P32 ā⤠ā |
| * ā āā P.GP.BH āā“ā PP.LSXS |
| * ā ā |
| * ā āā P.J āāāāāāā PP.BALRSC |
| * ā ā |
| * ā āā P48I |
| * ā ā āā P.SR |
| * ā ā ā |
| * ā ā āā P.SHIFT |
| * ā ā ā |
| * ā āā P.U12 āāāā¼ā P.ROTX |
| * ā ā ā |
| * ā ā āā P.INS |
| * ā ā ā |
| * ā ā āā P.EXT |
| * ā ā |
| * ā āā P.LS.U12 āā P.PREF.U12 |
| * ā ā |
| * ā āā P.BR1 āāāāā P.BR3A |
| * ā ā |
| * ā ā āā P.LS.S0 āāā P16.SYSCALL |
| * ā ā ā |
| * ā ā ā āā P.LL |
| * ā ā āā P.LS.S1 ā⤠|
| * ā ā ā āā P.SC |
| * ā ā ā |
| * ā ā ā āā P.PREFE |
| * MAJOR ā⤠āā P.LS.S9 ā⤠ā |
| * ā ā āā P.LS.E0 āā¼ā P.LLE |
| * ā ā ā ā |
| * ā ā ā āā P.SCE |
| * ā ā ā |
| * ā ā āā P.LS.WM |
| * ā ā ā |
| * ā ā āā P.LS.UAWM |
| * ā ā |
| * ā ā |
| * ā āā P.BR2 |
| * ā ā |
| * ā āā P.BRI |
| * ā ā |
| * ā āā P.LUI |
| * ā |
| * ā |
| * ā āā P16.MV āāāā P16.RI āāā P16.SYSCALL |
| * ā ā |
| * ā āā P16.SR |
| * ā ā |
| * ā āā P16.SHIFT |
| * ā ā |
| * ā āā P16.4x4 |
| * ā ā |
| * ā āā P16C āāāāāā POOL16C_0 āā POOL16C_00 |
| * ā ā |
| * āā P16 āā¼ā P16.LB |
| * ā |
| * āā P16.A1 |
| * ā |
| * āā P16.LH |
| * ā |
| * āā P16.A2 āāāā P.ADDIU[RS5] |
| * ā |
| * āā P16.ADDU |
| * ā |
| * āā P16.BR āāā¬ā P16.JRC |
| * ā |
| * āā P16.BR1 |
| * |
| * |
| * (FP, DPS, and some minor instruction pools are omitted from the diagram) |
| * |
| */ |
| |
| NMD::Pool NMD::P_SYSCALL[2] = { |
| { instruction , 0 , 0 , 32, |
| 0xfffc0000, 0x00080000, &NMD::SYSCALL_32_ , 0, |
| 0x0 }, /* SYSCALL[32] */ |
| { instruction , 0 , 0 , 32, |
| 0xfffc0000, 0x000c0000, &NMD::HYPCALL , 0, |
| CP0_ | VZ_ }, /* HYPCALL */ |
| }; |
| |
| |
| NMD::Pool NMD::P_RI[4] = { |
| { instruction , 0 , 0 , 32, |
| 0xfff80000, 0x00000000, &NMD::SIGRIE , 0, |
| 0x0 }, /* SIGRIE */ |
| { pool , P_SYSCALL , 2 , 32, |
| 0xfff80000, 0x00080000, 0 , 0, |
| 0x0 }, /* P.SYSCALL */ |
| { instruction , 0 , 0 , 32, |
| 0xfff80000, 0x00100000, &NMD::BREAK_32_ , 0, |
| 0x0 }, /* BREAK[32] */ |
| { instruction , 0 , 0 , 32, |
| 0xfff80000, 0x00180000, &NMD::SDBBP_32_ , 0, |
| EJTAG_ }, /* SDBBP[32] */ |
| }; |
| |
| |
| NMD::Pool NMD::P_ADDIU[2] = { |
| { pool , P_RI , 4 , 32, |
| 0xffe00000, 0x00000000, 0 , 0, |
| 0x0 }, /* P.RI */ |
| { instruction , 0 , 0 , 32, |
| 0xfc000000, 0x00000000, &NMD::ADDIU_32_ , &NMD::ADDIU_32__cond , |
| 0x0 }, /* ADDIU[32] */ |
| }; |
| |
| |
| NMD::Pool NMD::P_TRAP[2] = { |
| { instruction , 0 , 0 , 32, |
| 0xfc0007ff, 0x20000000, &NMD::TEQ , 0, |
| XMMS_ }, /* TEQ */ |
| { instruction , 0 , 0 , 32, |
| 0xfc0007ff, 0x20000400, &NMD::TNE , 0, |
| XMMS_ }, /* TNE */ |
| }; |
| |
| |
| NMD::Pool NMD::P_CMOVE[2] = { |
| { instruction , 0 , 0 , 32, |
| 0xfc0007ff, 0x20000210, &NMD::MOVZ , 0, |
| 0x0 }, /* MOVZ */ |
| { instruction , 0 , 0 , 32, |
| 0xfc0007ff, 0x20000610, &NMD::MOVN , 0, |
| 0x0 }, /* MOVN */ |
| }; |
| |
| |
| NMD::Pool NMD::P_D_MT_VPE[2] = { |
| { instruction , 0 , 0 , 32, |
| 0xfc1f3fff, 0x20010ab0, &NMD::DMT , 0, |
| MT_ }, /* DMT */ |
| { instruction , 0 , 0 , 32, |
| 0xfc1f3fff, 0x20000ab0, &NMD::DVPE , 0, |
| MT_ }, /* DVPE */ |
| }; |
| |
| |
| NMD::Pool NMD::P_E_MT_VPE[2] = { |
| { instruction , 0 , 0 , 32, |
| 0xfc1f3fff, 0x20010eb0, &NMD::EMT , 0, |
| MT_ }, /* EMT */ |
| { instruction , 0 , 0 , 32, |
| 0xfc1f3fff, 0x20000eb0, &NMD::EVPE , 0, |
| MT_ }, /* EVPE */ |
| }; |
| |
| |
| NMD::Pool NMD::_P_MT_VPE[2] = { |
| { pool , P_D_MT_VPE , 2 , 32, |
| 0xfc003fff, 0x20000ab0, 0 , 0, |
| 0x0 }, /* P.D_MT_VPE */ |
| { pool , P_E_MT_VPE , 2 , 32, |
| 0xfc003fff, 0x20000eb0, 0 , 0, |
| 0x0 }, /* P.E_MT_VPE */ |
| }; |
| |
| |
| NMD::Pool NMD::P_MT_VPE[8] = { |
| { reserved_block , 0 , 0 , 32, |
| 0xfc003bff, 0x200002b0, 0 , 0, |
| 0x0 }, /* P.MT_VPE~*(0) */ |
| { pool , _P_MT_VPE , 2 , 32, |
| 0xfc003bff, 0x20000ab0, 0 , 0, |
| 0x0 }, /* _P.MT_VPE */ |
| { reserved_block , 0 , 0 , 32, |
| 0xfc003bff, 0x200012b0, 0 , 0, |
| 0x0 }, /* P.MT_VPE~*(2) */ |
| { reserved_block , 0 , 0 , 32, |
| 0xfc003bff, 0x20001ab0, 0 , 0, |
| 0x0 }, /* P.MT_VPE~*(3) */ |
| { reserved_block , 0 , 0 , 32, |
| 0xfc003bff, 0x200022b0, 0 , 0, |
| 0x0 }, /* P.MT_VPE~*(4) */ |
| { reserved_block , 0 , 0 , 32, |
| 0xfc003bff, 0x20002ab0, 0 , 0, |
| 0x0 }, /* P.MT_VPE~*(5) */ |
| { reserved_block , 0 , 0 , 32, |
| 0xfc003bff, 0x200032b0, 0 , 0, |
| 0x0 }, /* P.MT_VPE~*(6) */ |
| { reserved_block , 0 , 0 , 32, |
| 0xfc003bff, 0x20003ab0, 0 , 0, |
| 0x0 }, /* P.MT_VPE~*(7) */ |
| }; |
| |
| |
| NMD::Pool NMD::P_DVP[2] = { |
| { instruction , 0 , 0 , 32, |
| 0xfc00ffff, 0x20000390, &NMD::DVP , 0, |
| 0x0 }, /* DVP */ |
| { instruction , 0 , 0 , 32, |
| 0xfc00ffff, 0x20000790, &NMD::EVP , 0, |
| 0x0 }, /* EVP */ |
| }; |
| |
| |
| NMD::Pool NMD::P_SLTU[2] = { |
| { pool , P_DVP , 2 , 32, |
| 0xfc00fbff, 0x20000390, 0 , 0, |
| 0x0 }, /* P.DVP */ |
| { instruction , 0 , 0 , 32, |
| 0xfc0003ff, 0x20000390, &NMD::SLTU , &NMD::SLTU_cond , |
| 0x0 }, /* SLTU */ |
| }; |
| |
| |
| NMD::Pool NMD::_POOL32A0[128] = { |
| { pool , P_TRAP , 2 , 32, |
| 0xfc0003ff, 0x20000000, 0 , 0, |
| 0x0 }, /* P.TRAP */ |
| { instruction , 0 , 0 , 32, |
| 0xfc0003ff, 0x20000008, &NMD::SEB , 0, |
| XMMS_ }, /* SEB */ |
| { instruction , 0 , 0 , 32, |
| 0xfc0003ff, 0x20000010, &NMD::SLLV , 0, |
| 0x0 }, /* SLLV */ |
| { instruction , 0 , 0 , 32, |
| 0xfc0003ff, 0x20000018, &NMD::MUL_32_ , 0, |
| 0x0 }, /* MUL[32] */ |
| { reserved_block , 0 , 0 , 32, |
| 0xfc0003ff, 0x20000020, 0 , 0, |
| 0x0 }, /* _POOL32A0~*(4) */ |
| { reserved_block , 0 , 0 , 32, |
| 0xfc0003ff, 0x20000028, 0 , 0, |
| 0x0 }, /* _POOL32A0~*(5) */ |
| { instruction , 0 , 0 , 32, |
| 0xfc0003ff, 0x20000030, &NMD::MFC0 , 0, |
| 0x0 }, /* MFC0 */ |
| { instruction , 0 , 0 , 32, |
| 0xfc0003ff, 0x20000038, &NMD::MFHC0 , 0, |
| CP0_ | MVH_ }, /* MFHC0 */ |
| { reserved_block , 0 , 0 , 32, |
| 0xfc0003ff, 0x20000040, 0 , 0, |
| 0x0 }, /* _POOL32A0~*(8) */ |
| { instruction , 0 , 0 , 32, |
| 0xfc0003ff, 0x20000048, &NMD::SEH , 0, |
| 0x0 }, /* SEH */ |
| { instruction , 0 , 0 , 32, |
| 0xfc0003ff, 0x20000050, &NMD::SRLV , 0, |
| 0x0 }, /* SRLV */ |
| { instruction , 0 , 0 , 32, |
| 0xfc0003ff, 0x20000058, &NMD::MUH , 0, |
| 0x0 }, /* MUH */ |
| { reserved_block , 0 , 0 , 32, |
| 0xfc0003ff, 0x20000060, 0 , 0, |
| 0x0 }, /* _POOL32A0~*(12) */ |
| { reserved_block , 0 , 0 , 32, |
| 0xfc0003ff, 0x20000068, 0 , 0, |
| 0x0 }, /* _POOL32A0~*(13) */ |
| { instruction , 0 , 0 , 32, |
| 0xfc0003ff, 0x20000070, &NMD::MTC0 , 0, |
| CP0_ }, /* MTC0 */ |
| { instruction , 0 , 0 , 32, |
| 0xfc0003ff, 0x20000078, &NMD::MTHC0 , 0, |
| CP0_ | MVH_ }, /* MTHC0 */ |
| { reserved_block , 0 , 0 , 32, |
| 0xfc0003ff, 0x20000080, 0 , 0, |
| 0x0 }, /* _POOL32A0~*(16) */ |
| { reserved_block , 0 , 0 , 32, |
| 0xfc0003ff, 0x20000088, 0 , 0, |
| 0x0 }, /* _POOL32A0~*(17) */ |
| { instruction , 0 , 0 , 32, |
| 0xfc0003ff, 0x20000090, &NMD::SRAV , 0, |
| 0x0 }, /* SRAV */ |
| { instruction , 0 , 0 , 32, |
| 0xfc0003ff, 0x20000098, &NMD::MULU , 0, |
| 0x0 }, /* MULU */ |
| { reserved_block , 0 , 0 , 32, |
| 0xfc0003ff, 0x200000a0, 0 , 0, |
| 0x0 }, /* _POOL32A0~*(20) */ |
| { reserved_block , 0 , 0 , 32, |
| 0xfc0003ff, 0x200000a8, 0 , 0, |
| 0x0 }, /* _POOL32A0~*(21) */ |
| { instruction , 0 , 0 , 32, |
| 0xfc0003ff, 0x200000b0, &NMD::MFGC0 , 0, |
| CP0_ | VZ_ }, /* MFGC0 */ |
| { instruction , 0 , 0 , 32, |
| 0xfc0003ff, 0x200000b8, &NMD::MFHGC0 , 0, |
| CP0_ | VZ_ | MVH_ }, /* MFHGC0 */ |
| { reserved_block , 0 , 0 , 32, |
| 0xfc0003ff, 0x200000c0, 0 , 0, |
| 0x0 }, /* _POOL32A0~*(24) */ |
| { reserved_block , 0 , 0 , 32, |
| 0xfc0003ff, 0x200000c8, 0 , 0, |
| 0x0 }, /* _POOL32A0~*(25) */ |
| { instruction , 0 , 0 , 32, |
| 0xfc0003ff, 0x200000d0, &NMD::ROTRV , 0, |
| 0x0 }, /* ROTRV */ |
| { instruction , 0 , 0 , 32, |
| 0xfc0003ff, 0x200000d8, &NMD::MUHU , 0, |
| 0x0 }, /* MUHU */ |
| { reserved_block , 0 , 0 , 32, |
| 0xfc0003ff, 0x200000e0, 0 , 0, |
| 0x0 }, /* _POOL32A0~*(28) */ |
| { reserved_block , 0 , 0 , 32, |
| 0xfc0003ff, 0x200000e8, 0 , 0, |
| 0x0 }, /* _POOL32A0~*(29) */ |
| { instruction , 0 , 0 , 32, |
| 0xfc0003ff, 0x200000f0, &NMD::MTGC0 , 0, |
| CP0_ | VZ_ }, /* MTGC0 */ |
| { instruction , 0 , 0 , 32, |
| 0xfc0003ff, 0x200000f8, &NMD::MTHGC0 , 0, |
| CP0_ | VZ_ | MVH_ }, /* MTHGC0 */ |
| { reserved_block , 0 , 0 , 32, |
| 0xfc0003ff, 0x20000100, 0 , 0, |
| 0x0 }, /* _POOL32A0~*(32) */ |
| { reserved_block , 0 , 0 , 32, |
| 0xfc0003ff, 0x20000108, 0 , 0, |
| 0x0 }, /* _POOL32A0~*(33) */ |
| { instruction , 0 , 0 , 32, |
| 0xfc0003ff, 0x20000110, &NMD::ADD , 0, |
| XMMS_ }, /* ADD */ |
| { instruction , 0 , 0 , 32, |
| 0xfc0003ff, 0x20000118, &NMD::DIV , 0, |
| 0x0 }, /* DIV */ |
| { reserved_block , 0 , 0 , 32, |
| 0xfc0003ff, 0x20000120, 0 , 0, |
| 0x0 }, /* _POOL32A0~*(36) */ |
| { reserved_block , 0 , 0 , 32, |
| 0xfc0003ff, 0x20000128, 0 , 0, |
| 0x0 }, /* _POOL32A0~*(37) */ |
| { instruction , 0 , 0 , 32, |
| 0xfc0003ff, 0x20000130, &NMD::DMFC0 , 0, |
| CP0_ | MIPS64_ }, /* DMFC0 */ |
| { reserved_block , 0 , 0 , 32, |
| 0xfc0003ff, 0x20000138, 0 , 0, |
| 0x0 }, /* _POOL32A0~*(39) */ |
| { reserved_block , 0 , 0 , 32, |
| 0xfc0003ff, 0x20000140, 0 , 0, |
| 0x0 }, /* _POOL32A0~*(40) */ |
| { reserved_block , 0 , 0 , 32, |
| 0xfc0003ff, 0x20000148, 0 , 0, |
| 0x0 }, /* _POOL32A0~*(41) */ |
| { instruction , 0 , 0 , 32, |
| 0xfc0003ff, 0x20000150, &NMD::ADDU_32_ , 0, |
| 0x0 }, /* ADDU[32] */ |
| { instruction , 0 , 0 , 32, |
| 0xfc0003ff, 0x20000158, &NMD::MOD , 0, |
| 0x0 }, /* MOD */ |
| { reserved_block , 0 , 0 , 32, |
| 0xfc0003ff, 0x20000160, 0 , 0, |
| 0x0 }, /* _POOL32A0~*(44) */ |
| { reserved_block , 0 , 0 , 32, |
| 0xfc0003ff, 0x20000168, 0 , 0, |
| 0x0 }, /* _POOL32A0~*(45) */ |
| { instruction , 0 , 0 , 32, |
| 0xfc0003ff, 0x20000170, &NMD::DMTC0 , 0, |
| CP0_ | MIPS64_ }, /* DMTC0 */ |
| { reserved_block , 0 , 0 , 32, |
| 0xfc0003ff, 0x20000178, 0 , 0, |
| 0x0 }, /* _POOL32A0~*(47) */ |
| { reserved_block , 0 , 0 , 32, |
| 0xfc0003ff, 0x20000180, 0 , 0, |
| 0x0 }, /* _POOL32A0~*(48) */ |
| { reserved_block , 0 , 0 , 32, |
| 0xfc0003ff, 0x20000188, 0 , 0, |
| 0x0 }, /* _POOL32A0~*(49) */ |
| { instruction , 0 , 0 , 32, |
| 0xfc0003ff, 0x20000190, &NMD::SUB , 0, |
| XMMS_ }, /* SUB */ |
| { instruction , 0 , 0 , 32, |
| 0xfc0003ff, 0x20000198, &NMD::DIVU , 0, |
| 0x0 }, /* DIVU */ |
| { reserved_block , 0 , 0 , 32, |
| 0xfc0003ff, 0x200001a0, 0 , 0, |
| 0x0 }, /* _POOL32A0~*(52) */ |
| { reserved_block , 0 , 0 , 32, |
| 0xfc0003ff, 0x200001a8, 0 , 0, |
| 0x0 }, /* _POOL32A0~*(53) */ |
| { instruction , 0 , 0 , 32, |
| 0xfc0003ff, 0x200001b0, &NMD::DMFGC0 , 0, |
| CP0_ | MIPS64_ | VZ_}, /* DMFGC0 */ |
| { reserved_block , 0 , 0 , 32, |
| 0xfc0003ff, 0x200001b8, 0 , 0, |
| 0x0 }, /* _POOL32A0~*(55) */ |
| { instruction , 0 , 0 , 32, |
| 0xfc0003ff, 0x200001c0, &NMD::RDHWR , 0, |
| XMMS_ }, /* RDHWR */ |
| { reserved_block , 0 , 0 , 32, |
| 0xfc0003ff, 0x200001c8, 0 , 0, |
| 0x0 }, /* _POOL32A0~*(57) */ |
| { instruction , 0 , 0 , 32, |
| 0xfc0003ff, 0x200001d0, &NMD::SUBU_32_ , 0, |
| 0x0 }, /* SUBU[32] */ |
| { instruction , 0 , 0 , 32, |
| 0xfc0003ff, 0x200001d8, &NMD::MODU , 0, |
| 0x0 }, /* MODU */ |
| { reserved_block , 0 , 0 , 32, |
| 0xfc0003ff, 0x200001e0, 0 , 0, |
| 0x0 }, /* _POOL32A0~*(60) */ |
| { reserved_block , 0 , 0 , 32, |
| 0xfc0003ff, 0x200001e8, 0 , 0, |
| 0x0 }, /* _POOL32A0~*(61) */ |
| { instruction , 0 , 0 , 32, |
| 0xfc0003ff, 0x200001f0, &NMD::DMTGC0 , 0, |
| CP0_ | MIPS64_ | VZ_}, /* DMTGC0 */ |
| { reserved_block , 0 , 0 , 32, |
| 0xfc0003ff |