Skip to content

Commit

Permalink
Implement COP2 instructions
Browse files Browse the repository at this point in the history
  • Loading branch information
AngheloAlf committed Apr 16, 2024
1 parent 39f27be commit 069b203
Show file tree
Hide file tree
Showing 44 changed files with 312 additions and 103 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,12 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [Unreleased]

### Added

- The global `regNames.r4000AllegrexVfpuControlNamedRegisters` option controls
if named registers should be used for the VFPU control registers of the R4000
ALLEGREX.

### Changed

- Cleanups in tests code.
Expand Down
94 changes: 1 addition & 93 deletions asdf.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3592,18 +3592,6 @@ tests/c/instruction_checks/r4000allegrex_vfpu_disasm.c: Error on word '0x4900000
InstrIdType: 'R4000ALLEGREX_COP2_BC2'
gnuMode 'true'

tests/c/instruction_checks/r4000allegrex_vfpu_disasm.c: Error on word '0x48640004'. Expected 'mfv $a0, S100', got '.word 0x48640004 # INVALID $v1, $a0, 0x4 # 00000000 <InstrIdType: R4000ALLEGREX_COP2_MFHC2>'
InstrIdType: 'R4000ALLEGREX_COP2_MFHC2'
gnuMode 'true'

tests/c/instruction_checks/r4000allegrex_vfpu_disasm.c: Error on word '0x48E40004'. Expected 'mtv $a0, S100', got '.word 0x48E40004 # INVALID $a3, $a0, 0x4 # 00000000 <InstrIdType: R4000ALLEGREX_COP2_MTHC2>'
InstrIdType: 'R4000ALLEGREX_COP2_MTHC2'
gnuMode 'true'

tests/c/instruction_checks/r4000allegrex_vfpu_disasm.c: Error on word '0x48E40084'. Expected 'mtvc $a0, $132', got '.word 0x48E40084 # INVALID $a3, $a0, 0x84 # 00000000 <InstrIdType: R4000ALLEGREX_COP2_MTHC2>'
InstrIdType: 'R4000ALLEGREX_COP2_MTHC2'
gnuMode 'true'

tests/c/instruction_checks/r4000allegrex_vfpu_disasm.c: Error on word '0xF2008080'. Expected 'vmscl.q M000, M000, S000', got '.word 0xF2008080 # INVALID $s0, $zero, -0x7F80 # 00000000 <InstrIdType: R4000ALLEGREX_VFPU6>'
InstrIdType: 'R4000ALLEGREX_VFPU6'
gnuMode 'true'
Expand Down Expand Up @@ -7976,70 +7964,6 @@ tests/c/instruction_checks/r4000allegrex_vfpu_disasm.c: Error on word '0x6C40888
InstrIdType: 'R4000ALLEGREX_VFPU3'
gnuMode 'true'

tests/c/instruction_checks/r4000allegrex_vfpu_disasm.c: Error on word '0x48640080'. Expected 'mfvc $a0, VFPU_PFXS', got '.word 0x48640080 # INVALID $v1, $a0, 0x80 # 00000000 <InstrIdType: R4000ALLEGREX_COP2_MFHC2_P>'
InstrIdType: 'R4000ALLEGREX_COP2_MFHC2_P'
gnuMode 'true'

tests/c/instruction_checks/r4000allegrex_vfpu_disasm.c: Error on word '0x48640081'. Expected 'mfvc $a0, VFPU_PFXT', got '.word 0x48640081 # INVALID $v1, $a0, 0x81 # 00000000 <InstrIdType: R4000ALLEGREX_COP2_MFHC2_P>'
InstrIdType: 'R4000ALLEGREX_COP2_MFHC2_P'
gnuMode 'true'

tests/c/instruction_checks/r4000allegrex_vfpu_disasm.c: Error on word '0x48640082'. Expected 'mfvc $a0, VFPU_PFXD', got '.word 0x48640082 # INVALID $v1, $a0, 0x82 # 00000000 <InstrIdType: R4000ALLEGREX_COP2_MFHC2_P>'
InstrIdType: 'R4000ALLEGREX_COP2_MFHC2_P'
gnuMode 'true'

tests/c/instruction_checks/r4000allegrex_vfpu_disasm.c: Error on word '0x48640083'. Expected 'mfvc $a0, VFPU_CC', got '.word 0x48640083 # INVALID $v1, $a0, 0x83 # 00000000 <InstrIdType: R4000ALLEGREX_COP2_MFHC2_P>'
InstrIdType: 'R4000ALLEGREX_COP2_MFHC2_P'
gnuMode 'true'

tests/c/instruction_checks/r4000allegrex_vfpu_disasm.c: Error on word '0x48640084'. Expected 'mfvc $a0, VFPU_INF4', got '.word 0x48640084 # INVALID $v1, $a0, 0x84 # 00000000 <InstrIdType: R4000ALLEGREX_COP2_MFHC2_P>'
InstrIdType: 'R4000ALLEGREX_COP2_MFHC2_P'
gnuMode 'true'

tests/c/instruction_checks/r4000allegrex_vfpu_disasm.c: Error on word '0x48640085'. Expected 'mfvc $a0, VFPU_RSV5', got '.word 0x48640085 # INVALID $v1, $a0, 0x85 # 00000000 <InstrIdType: R4000ALLEGREX_COP2_MFHC2_P>'
InstrIdType: 'R4000ALLEGREX_COP2_MFHC2_P'
gnuMode 'true'

tests/c/instruction_checks/r4000allegrex_vfpu_disasm.c: Error on word '0x48640086'. Expected 'mfvc $a0, VFPU_RSV6', got '.word 0x48640086 # INVALID $v1, $a0, 0x86 # 00000000 <InstrIdType: R4000ALLEGREX_COP2_MFHC2_P>'
InstrIdType: 'R4000ALLEGREX_COP2_MFHC2_P'
gnuMode 'true'

tests/c/instruction_checks/r4000allegrex_vfpu_disasm.c: Error on word '0x48640087'. Expected 'mfvc $a0, VFPU_REV', got '.word 0x48640087 # INVALID $v1, $a0, 0x87 # 00000000 <InstrIdType: R4000ALLEGREX_COP2_MFHC2_P>'
InstrIdType: 'R4000ALLEGREX_COP2_MFHC2_P'
gnuMode 'true'

tests/c/instruction_checks/r4000allegrex_vfpu_disasm.c: Error on word '0x48640088'. Expected 'mfvc $a0, VFPU_RCX0', got '.word 0x48640088 # INVALID $v1, $a0, 0x88 # 00000000 <InstrIdType: R4000ALLEGREX_COP2_MFHC2_P>'
InstrIdType: 'R4000ALLEGREX_COP2_MFHC2_P'
gnuMode 'true'

tests/c/instruction_checks/r4000allegrex_vfpu_disasm.c: Error on word '0x48640089'. Expected 'mfvc $a0, VFPU_RCX1', got '.word 0x48640089 # INVALID $v1, $a0, 0x89 # 00000000 <InstrIdType: R4000ALLEGREX_COP2_MFHC2_P>'
InstrIdType: 'R4000ALLEGREX_COP2_MFHC2_P'
gnuMode 'true'

tests/c/instruction_checks/r4000allegrex_vfpu_disasm.c: Error on word '0x4864008A'. Expected 'mfvc $a0, VFPU_RCX2', got '.word 0x4864008A # INVALID $v1, $a0, 0x8A # 00000000 <InstrIdType: R4000ALLEGREX_COP2_MFHC2_P>'
InstrIdType: 'R4000ALLEGREX_COP2_MFHC2_P'
gnuMode 'true'

tests/c/instruction_checks/r4000allegrex_vfpu_disasm.c: Error on word '0x4864008B'. Expected 'mfvc $a0, VFPU_RCX3', got '.word 0x4864008B # INVALID $v1, $a0, 0x8B # 00000000 <InstrIdType: R4000ALLEGREX_COP2_MFHC2_P>'
InstrIdType: 'R4000ALLEGREX_COP2_MFHC2_P'
gnuMode 'true'

tests/c/instruction_checks/r4000allegrex_vfpu_disasm.c: Error on word '0x4864008C'. Expected 'mfvc $a0, VFPU_RCX4', got '.word 0x4864008C # INVALID $v1, $a0, 0x8C # 00000000 <InstrIdType: R4000ALLEGREX_COP2_MFHC2_P>'
InstrIdType: 'R4000ALLEGREX_COP2_MFHC2_P'
gnuMode 'true'

tests/c/instruction_checks/r4000allegrex_vfpu_disasm.c: Error on word '0x4864008D'. Expected 'mfvc $a0, VFPU_RCX5', got '.word 0x4864008D # INVALID $v1, $a0, 0x8D # 00000000 <InstrIdType: R4000ALLEGREX_COP2_MFHC2_P>'
InstrIdType: 'R4000ALLEGREX_COP2_MFHC2_P'
gnuMode 'true'

tests/c/instruction_checks/r4000allegrex_vfpu_disasm.c: Error on word '0x4864008E'. Expected 'mfvc $a0, VFPU_RCX6', got '.word 0x4864008E # INVALID $v1, $a0, 0x8E # 00000000 <InstrIdType: R4000ALLEGREX_COP2_MFHC2_P>'
InstrIdType: 'R4000ALLEGREX_COP2_MFHC2_P'
gnuMode 'true'

tests/c/instruction_checks/r4000allegrex_vfpu_disasm.c: Error on word '0x4864008F'. Expected 'mfvc $a0, VFPU_RCX7', got '.word 0x4864008F # INVALID $v1, $a0, 0x8F # 00000000 <InstrIdType: R4000ALLEGREX_COP2_MFHC2_P>'
InstrIdType: 'R4000ALLEGREX_COP2_MFHC2_P'
gnuMode 'true'

tests/c/instruction_checks/r4000allegrex_vfpu_disasm.c: Error on word '0x48640090'. Expected 'illegal', got '.word 0x48640090 # INVALID $v1, $a0, 0x90 # 00000000 <InstrIdType: R4000ALLEGREX_COP2_MFHC2_P>'
InstrIdType: 'R4000ALLEGREX_COP2_MFHC2_P'
gnuMode 'true'
Expand All @@ -8056,22 +7980,6 @@ tests/c/instruction_checks/r4000allegrex_vfpu_disasm.c: Error on word '0x486000F
InstrIdType: 'R4000ALLEGREX_COP2_MFHC2_P'
gnuMode 'true'

tests/c/instruction_checks/r4000allegrex_vfpu_disasm.c: Error on word '0x48650000'. Expected 'mfv $a1, S000', got '.word 0x48650000 # INVALID $v1, $a1, 0x0 # 00000000 <InstrIdType: R4000ALLEGREX_COP2_MFHC2>'
InstrIdType: 'R4000ALLEGREX_COP2_MFHC2'
gnuMode 'true'

tests/c/instruction_checks/r4000allegrex_vfpu_disasm.c: Error on word '0x48650081'. Expected 'mfvc $a1, VFPU_PFXT', got '.word 0x48650081 # INVALID $v1, $a1, 0x81 # 00000000 <InstrIdType: R4000ALLEGREX_COP2_MFHC2_P>'
InstrIdType: 'R4000ALLEGREX_COP2_MFHC2_P'
gnuMode 'true'

tests/c/instruction_checks/r4000allegrex_vfpu_disasm.c: Error on word '0x48E50000'. Expected 'mtv $a1, S000', got '.word 0x48E50000 # INVALID $a3, $a1, 0x0 # 00000000 <InstrIdType: R4000ALLEGREX_COP2_MTHC2>'
InstrIdType: 'R4000ALLEGREX_COP2_MTHC2'
gnuMode 'true'

tests/c/instruction_checks/r4000allegrex_vfpu_disasm.c: Error on word '0x48E50081'. Expected 'mtvc $a1, VFPU_PFXT', got '.word 0x48E50081 # INVALID $a3, $a1, 0x81 # 00000000 <InstrIdType: R4000ALLEGREX_COP2_MTHC2>'
InstrIdType: 'R4000ALLEGREX_COP2_MTHC2'
gnuMode 'true'

tests/c/instruction_checks/r4000allegrex_vfpu_disasm.c: Error on word '0xD0001001'. Expected 'vmov.s S010, S400', got '.word 0xD0001001 # INVALID $zero, $zero, 0x1001 # 00000000 <InstrIdType: R4000ALLEGREX_VFPU4_FMT0_FMT0_FMT0>'
InstrIdType: 'R4000ALLEGREX_VFPU4_FMT0_FMT0_FMT0'
gnuMode 'true'
Expand Down Expand Up @@ -17784,5 +17692,5 @@ tests/c/instruction_checks/r4000allegrex_vfpu_disasm.c: Error on word '0xFFFF032
InstrIdType: 'R4000ALLEGREX_VFPU7'
gnuMode 'true'

tests/c/instruction_checks/r4000allegrex_vfpu_disasm.c: 4445 errors out of 4771 entries. 6.83% correct.
tests/c/instruction_checks/r4000allegrex_vfpu_disasm.c: 4422 errors out of 4771 entries. 7.32% correct.

1 change: 1 addition & 0 deletions cplusplus/include/generated/OperandType_enum_class.hpp

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

18 changes: 18 additions & 0 deletions cplusplus/include/generated/Registers_enum_classes.hpp

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 4 additions & 0 deletions cplusplus/include/generated/UniqueId_enum_class.hpp

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions include/common/RabbitizerConfig.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ typedef struct RabbitizerConfig_RegisterNames {
bool userFpcCsr; // Use FpcCsr as register $31 for the FP control/status register
bool vr4300Cop0NamedRegisters; // Use named registers for VR4300's coprocessor 0 registers
bool vr4300RspCop0NamedRegisters; // Use named registers for VR4300's RSP's coprocessor 0 registers
bool r4000AllegrexVfpuControlNamedRegisters; // Use named registers for R4000 Allegrex's VFPU control registers
} RabbitizerConfig_RegisterNames;

typedef struct RabbitizerConfig_PseudoInstr {
Expand Down
4 changes: 4 additions & 0 deletions include/generated/InstrDescriptor_Descriptors_array.h

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 4 additions & 0 deletions include/generated/InstrId_Names_array.h

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 4 additions & 0 deletions include/generated/InstrId_enum.h

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions include/generated/OperandType_enum.h

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions include/generated/OperandType_function_declarations.h

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

18 changes: 18 additions & 0 deletions include/generated/RegisterDescriptor_Descriptors_arrays.h

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

18 changes: 18 additions & 0 deletions include/generated/Registers_Names_arrays.h

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 069b203

Please sign in to comment.