rabbitizer/cplusplus/include/instructions/InstructionR4000Allegrex.hpp
Anghelo Carvajal b51b62da45
ALLEGREX support (#60)
* setup ALLEGREX

* more setup

* clo

* fix

* Implement SPECIAL_RS and SPECIAL_SA instructions

* more table placeholders

* Implement bshfl instructions

* Rename to R4000Allegrex

* Implement SPECIAL instructions

* Add tests

* Remove some duplicated tests

* Implement SPECIAL3 instructions

* fix bug in test

* update

* Implement COPz

* Implement SPECIAL2 instructions

* Implement COP1

* Yeet cop3

* som tests

* bvf, bvfl, bvt, bvtl

* fix bshfl prefix

* need to implement the vfpu registers

* implement vt_7?

* R4000AllegrexVF -> R4000AllegrexVScalar

* Add test suite to compare with the sn toolchain decoding

* more vfpu test cases

* forgor this

* I can't decide how to name these registers

* Prepare tables for all register types

* Fix typo

* Implement vector scalar register operands

* Implement quad registers

* Fix tests?

* svl.q, svr.q

* Implement a bunch of vfpu0 instructions

* implement registers for `.t` and `.p` instructions

* Implement VFPU1 instructions

* bleh

* VFPU1, VFPU3 and `vcmp.`

* Fix wrong register type on some instructions

* start vfpu3

* Implement VFPU3 instructions

* start categorizing VFPU4

* Categorize VFPU5

* VFPU6 identification

* Identify VFPU7

* COP2 is weird

* organize COP2 a bit

* Add test cases for VFPU4 FMT

* VFPU4 FMT2 stuff

* VFPU4 FMT3 stuff

* VFPU5 stuff

* VFPU6 stuff

* VFPU7 stuff

* Implement COP2 instructions

* Implement vmov, vabs and vneg

* VPFU4 FMT0 FMT0 FMT0 implemented

* VFPU FMT0 FMT0 FMT2

* vnrcp, vnsin, vrexp2

* vrnds, vrndi, vrndf1, vrndf2

* Change tests a bit

* vf2h, vh2f, vsbz, vlgb

* vuc2ifs, vc2i, vus2i, vs2i, vi2uc, vi2c, vi2us, vi2s

* vsrt1, vsrt2, vbfy1, vbfy2, vocp, vsocp, vfad, vavg

* vsrt3, vsrt4, vsgn

* vmfvc and vmtvc placeholders

* vt4444, vt5551, vt5650

* vcst placeholder

* vf2in

* vf2iz

* vf2iu, vf2id, vi2f

* vcmovt, vcmovf

* vwbn.s, viim.s, vfim.s

* vpfxs, vpfxt, vpfxd, vnop, vsync, vflush

* vmmov, vmidt, vmzero, vmone

* vrot

* vmmul, vhtfm2, vtfm2, vhtfm3, vtfm3, vhtfm4, vtfm4, vmscl, vcrsp, vqmul

* Implement matrix operands

* fix matrix operands

* Fix `illegal` tests

* hack out a way to check the test cases are assemblable

* test-fixing: branches

* fix more test cases

* fix vmfvc and vmtvc

* more test fixing

* vdiv and fix operand R323

* more test fixing

* Fix matrix operands

* implement vcmp comparisons

* fix vsync2

* vsqrt and vrndf1 fixes

* Implement "constant" operand for `vcst`

* Add missing operand of vf2in, vf2iz, vf2iu, vf2id, vi2f

* Add missing vcmovt and vcmovf operands

* Add missing vwbn operand

* Tests cases for vmmul

* Fix vtfm2

* Implement "transpose matrix register"

* Add placeholders for the remaining missing operands

* Implement viim operand

* Implement vrot code operand

* placeholders for rp and wp operands

* test cases for vpfxs, vpfxt and vpfxd

* Properly implement rpx, rpy, rpz and rpw

* Properly implement wpx, wpy, wpz and wpw operands

* Implement vfim

* changelog

* readme

* some cleanup

* Restructure some tables

* more table restructure

* fix tests

* more table yeeting

* more cleanup

* more cleanup

* reanming

* moar

* fmt
2024-04-22 13:15:58 -04:00

86 lines
3.5 KiB
C++

/* SPDX-FileCopyrightText: © 2024 Decompollaborate */
/* SPDX-License-Identifier: MIT */
#ifndef RABBITIZER_INSTRUCTION_R4000ALLEGREX_HPP
#define RABBITIZER_INSTRUCTION_R4000ALLEGREX_HPP
#pragma once
#include "InstructionBase.hpp"
namespace rabbitizer {
class InstructionR4000Allegrex : public InstructionBase {
public:
InstructionR4000Allegrex(uint32_t word, uint32_t vram);
virtual ~InstructionR4000Allegrex();
Registers::R4000Allegrex::S GetR4000Allegrex_s_vs() const;
Registers::R4000Allegrex::S GetR4000Allegrex_s_vt() const;
Registers::R4000Allegrex::S GetR4000Allegrex_s_vd() const;
Registers::R4000Allegrex::S GetR4000Allegrex_s_vt_imm() const;
Registers::R4000Allegrex::S GetR4000Allegrex_s_vd_imm() const;
Registers::R4000Allegrex::V2D GetR4000Allegrex_p_vs() const;
Registers::R4000Allegrex::V2D GetR4000Allegrex_p_vt() const;
Registers::R4000Allegrex::V2D GetR4000Allegrex_p_vd() const;
Registers::R4000Allegrex::V3D GetR4000Allegrex_t_vs() const;
Registers::R4000Allegrex::V3D GetR4000Allegrex_t_vt() const;
Registers::R4000Allegrex::V3D GetR4000Allegrex_t_vd() const;
Registers::R4000Allegrex::V4D GetR4000Allegrex_q_vs() const;
Registers::R4000Allegrex::V4D GetR4000Allegrex_q_vt() const;
Registers::R4000Allegrex::V4D GetR4000Allegrex_q_vd() const;
Registers::R4000Allegrex::V4D GetR4000Allegrex_q_vt_imm() const;
Registers::R4000Allegrex::M2x2 GetR4000Allegrex_mp_vs() const;
Registers::R4000Allegrex::M2x2 GetR4000Allegrex_mp_vt() const;
Registers::R4000Allegrex::M2x2 GetR4000Allegrex_mp_vd() const;
Registers::R4000Allegrex::M2x2 GetR4000Allegrex_mp_vs_transpose() const;
Registers::R4000Allegrex::M3x3 GetR4000Allegrex_mt_vs() const;
Registers::R4000Allegrex::M3x3 GetR4000Allegrex_mt_vt() const;
Registers::R4000Allegrex::M3x3 GetR4000Allegrex_mt_vd() const;
Registers::R4000Allegrex::M3x3 GetR4000Allegrex_mt_vs_transpose() const;
Registers::R4000Allegrex::M4x4 GetR4000Allegrex_mq_vs() const;
Registers::R4000Allegrex::M4x4 GetR4000Allegrex_mq_vt() const;
Registers::R4000Allegrex::M4x4 GetR4000Allegrex_mq_vd() const;
Registers::R4000Allegrex::M4x4 GetR4000Allegrex_mq_vs_transpose() const;
Registers::R4000Allegrex::VfpuControl GetR4000Allegrex_cop2cs() const;
Registers::R4000Allegrex::VfpuControl GetR4000Allegrex_cop2cd() const;
uint8_t GetR4000Allegrex_pos() const;
uint8_t GetR4000Allegrex_size() const;
uint8_t GetR4000Allegrex_size_plus_pos() const;
uint8_t GetR4000Allegrex_imm3() const;
uint16_t GetR4000Allegrex_offset14() const;
uint8_t GetR4000Allegrex_vcmp_cond() const;
Registers::R4000Allegrex::VConstant GetR4000Allegrex_vconstant() const;
uint8_t GetR4000Allegrex_power_of_two() const;
uint8_t GetR4000Allegrex_vfpu_cc_bit() const;
uint8_t GetR4000Allegrex_bn() const;
uint16_t GetR4000Allegrex_intfloat16() const;
uint8_t GetR4000Allegrex_vrot_code() const;
uint8_t GetR4000Allegrex_rpx() const;
uint8_t GetR4000Allegrex_rpy() const;
uint8_t GetR4000Allegrex_rpz() const;
uint8_t GetR4000Allegrex_rpw() const;
uint8_t GetR4000Allegrex_wpx() const;
uint8_t GetR4000Allegrex_wpy() const;
uint8_t GetR4000Allegrex_wpz() const;
uint8_t GetR4000Allegrex_wpw() const;
};
};
#endif