Skip to content

Commit

Permalink
Fix some instructions missing their corresponding AccessType
Browse files Browse the repository at this point in the history
  • Loading branch information
AngheloAlf committed Oct 13, 2024
1 parent 21a849c commit 02302f2
Show file tree
Hide file tree
Showing 13 changed files with 119 additions and 58 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [Unreleased]

### Fixed

- Fix some instructions missing their corresponding AccessType.

## [1.12.0] - 2024-07-21

### Added
Expand Down
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
[package]
name = "rabbitizer"
# Version should be synced with include/common/RabbitizerVersion.h
version = "1.12.0"
version = "1.12.1"
edition = "2021"
authors = ["Anghelo Carvajal <[email protected]>"]
description = "MIPS instruction decoder"
Expand Down
5 changes: 5 additions & 0 deletions cplusplus/include/generated/AccessType_enum_class.hpp

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

5 changes: 5 additions & 0 deletions include/generated/AccessType_enum.h

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

56 changes: 28 additions & 28 deletions include/generated/InstrDescriptor_Descriptors_array.h

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
[project]
name = "rabbitizer"
# Version should be synced with include/common/RabbitizerVersion.h
version = "1.12.0"
version = "1.12.1"
description = "MIPS instruction decoder"
# license = "MIT"
readme = "README.md"
Expand Down
5 changes: 5 additions & 0 deletions rabbitizer/AccessType.pyi

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

5 changes: 5 additions & 0 deletions rust/src/access_type_enum.rs

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

5 changes: 5 additions & 0 deletions tables/tables/AccessType.inc
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,10 @@
RAB_DEF_ACCESSTYPE(SHORT)
RAB_DEF_ACCESSTYPE(WORD)
RAB_DEF_ACCESSTYPE(DOUBLEWORD)
RAB_DEF_ACCESSTYPE(QUADWORD)
RAB_DEF_ACCESSTYPE(FLOAT)
RAB_DEF_ACCESSTYPE(DOUBLEFLOAT)
RAB_DEF_ACCESSTYPE(WORD_LEFT)
RAB_DEF_ACCESSTYPE(WORD_RIGHT)
RAB_DEF_ACCESSTYPE(DOUBLEWORD_LEFT)
RAB_DEF_ACCESSTYPE(DOUBLEWORD_RIGHT)
48 changes: 32 additions & 16 deletions tables/tables/instr_id/cpu/cpu_normal.inc
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,8 @@
.readsRs=true,
.canBeLo=true,
.doesDereference=true,
.doesLoad=true
.doesLoad=true,
.accessType=RAB_ACCESSTYPE_DOUBLEWORD_LEFT
) // Load Doubleword Left
RABBITIZER_DEF_INSTR_ID(
cpu, 0x1B, ldr,
Expand All @@ -208,7 +209,8 @@
.readsRs=true,
.canBeLo=true,
.doesDereference=true,
.doesLoad=true
.doesLoad=true,
.accessType=RAB_ACCESSTYPE_DOUBLEWORD_RIGHT
) // Load Doubleword Right
RABBITIZER_DEF_INSTR_ID(
cpu, 0x20, lb,
Expand Down Expand Up @@ -240,7 +242,8 @@
.readsRs=true,
.canBeLo=true,
.doesDereference=true,
.doesLoad=true
.doesLoad=true,
.accessType=RAB_ACCESSTYPE_WORD_LEFT
) // Load Word Left
RABBITIZER_DEF_INSTR_ID(
cpu, 0x23, lw,
Expand Down Expand Up @@ -285,7 +288,8 @@
.readsRs=true,
.canBeLo=true,
.doesDereference=true,
.doesLoad=true
.doesLoad=true,
.accessType=RAB_ACCESSTYPE_WORD_RIGHT
) // Load Word Right
RABBITIZER_DEF_INSTR_ID(
cpu, 0x27, lwu,
Expand Down Expand Up @@ -329,7 +333,8 @@
.readsRt=true,
.canBeLo=true,
.doesDereference=true,
.doesStore=true
.doesStore=true,
.accessType=RAB_ACCESSTYPE_WORD_LEFT
) // Store Word Left
RABBITIZER_DEF_INSTR_ID(
cpu, 0x2B, sw,
Expand All @@ -350,7 +355,8 @@
.readsRt=true,
.canBeLo=true,
.doesDereference=true,
.doesStore=true
.doesStore=true,
.accessType=RAB_ACCESSTYPE_DOUBLEWORD_LEFT
) // Store Doubleword Left
RABBITIZER_DEF_INSTR_ID(
cpu, 0x2D, sdr,
Expand All @@ -360,7 +366,8 @@
.readsRt=true,
.canBeLo=true,
.doesDereference=true,
.doesStore=true
.doesStore=true,
.accessType=RAB_ACCESSTYPE_DOUBLEWORD_RIGHT
) // Store Doubleword Right
RABBITIZER_DEF_INSTR_ID(
cpu, 0x2E, swr,
Expand All @@ -370,7 +377,8 @@
.readsRt=true,
.canBeLo=true,
.doesDereference=true,
.doesStore=true
.doesStore=true,
.accessType=RAB_ACCESSTYPE_WORD_RIGHT
) // Store Word Right
RABBITIZER_DEF_INSTR_ID(
cpu, 0x30, ll,
Expand All @@ -381,7 +389,8 @@
.notEmittedByCompilers=true,
.canBeLo=true,
.doesDereference=true,
.doesLoad=true
.doesLoad=true,
.accessType=RAB_ACCESSTYPE_WORD
) // Load Linked word
RABBITIZER_DEF_INSTR_ID(
cpu, 0x33, pref,
Expand All @@ -398,7 +407,8 @@
.notEmittedByCompilers=true,
.canBeLo=true,
.doesDereference=true,
.doesLoad=true
.doesLoad=true,
.accessType=RAB_ACCESSTYPE_DOUBLEWORD
) // Load Linked Doubleword
RABBITIZER_DEF_INSTR_ID(
cpu, 0x37, ld,
Expand All @@ -420,7 +430,8 @@
.notEmittedByCompilers=true,
.canBeLo=true,
.doesDereference=true,
.doesStore=true
.doesStore=true,
.accessType=RAB_ACCESSTYPE_WORD
) // Store Conditional word
RABBITIZER_DEF_INSTR_ID(
cpu, 0x3C, scd,
Expand All @@ -431,7 +442,8 @@
.notEmittedByCompilers=true,
.canBeLo=true,
.doesDereference=true,
.doesStore=true
.doesStore=true,
.accessType=RAB_ACCESSTYPE_DOUBLEWORD
) // Store Conditional Doubleword
RABBITIZER_DEF_INSTR_ID(
cpu, 0x3F, sd,
Expand Down Expand Up @@ -514,7 +526,8 @@
.readsRs=true,
.canBeLo=true,
.doesDereference=true,
.doesLoad=true
.doesLoad=true,
.accessType=RAB_ACCESSTYPE_WORD
) // Load Word to Coprocessor z
RABBITIZER_DEF_INSTR_ID(
cpu, 0x36, ldc2,
Expand All @@ -523,7 +536,8 @@
.readsRs=true,
.canBeLo=true,
.doesDereference=true,
.doesLoad=true
.doesLoad=true,
.accessType=RAB_ACCESSTYPE_DOUBLEWORD
) // Load Doubleword to Coprocessor z
RABBITIZER_DEF_INSTR_ID(
cpu, 0x3A, swc2,
Expand All @@ -532,7 +546,8 @@
.readsRs=true,
.canBeLo=true,
.doesDereference=true,
.doesStore=true
.doesStore=true,
.accessType=RAB_ACCESSTYPE_WORD
) // Store Word from Coprocessor z
RABBITIZER_DEF_INSTR_ID(
cpu, 0x3E, sdc2,
Expand All @@ -541,7 +556,8 @@
.readsRs=true,
.canBeLo=true,
.doesDereference=true,
.doesStore=true
.doesStore=true,
.accessType=RAB_ACCESSTYPE_DOUBLEWORD
) // Store Doubleword from Coprocessor z


Expand Down
24 changes: 16 additions & 8 deletions tables/tables/instr_id/r5900/r5900_cop2_viwr.inc
Original file line number Diff line number Diff line change
Expand Up @@ -30,55 +30,63 @@
.operands={RAB_OPERAND_r5900_vit, RAB_OPERAND_r5900_vis_parenthesis},
.isFloat=true,
.doesDereference=true,
.doesLoad=true
.doesLoad=true,
.accessType=RAB_ACCESSTYPE_WORD
) // Integer load word register
RABBITIZER_DEF_INSTR_ID_ALTNAME(
r5900, (0x02 << 2) | 0x02, vilwr_z, vilwr.z,
.operands={RAB_OPERAND_r5900_vit, RAB_OPERAND_r5900_vis_parenthesis},
.isFloat=true,
.doesDereference=true,
.doesLoad=true
.doesLoad=true,
.accessType=RAB_ACCESSTYPE_WORD
) // Integer load word register
RABBITIZER_DEF_INSTR_ID_ALTNAME(
r5900, (0x04 << 2) | 0x02, vilwr_y, vilwr.y,
.operands={RAB_OPERAND_r5900_vit, RAB_OPERAND_r5900_vis_parenthesis},
.isFloat=true,
.doesDereference=true,
.doesLoad=true
.doesLoad=true,
.accessType=RAB_ACCESSTYPE_WORD
) // Integer load word register
RABBITIZER_DEF_INSTR_ID_ALTNAME(
r5900, (0x08 << 2) | 0x02, vilwr_x, vilwr.x,
.operands={RAB_OPERAND_r5900_vit, RAB_OPERAND_r5900_vis_parenthesis},
.isFloat=true,
.doesDereference=true,
.doesLoad=true
.doesLoad=true,
.accessType=RAB_ACCESSTYPE_WORD
) // Integer load word register

RABBITIZER_DEF_INSTR_ID_ALTNAME(
r5900, (0x01 << 2) | 0x03, viswr_w, viswr.w,
.operands={RAB_OPERAND_r5900_vit, RAB_OPERAND_r5900_vis_parenthesis},
.isFloat=true,
.doesDereference=true,
.doesLoad=true
.doesLoad=true,
.accessType=RAB_ACCESSTYPE_WORD
) // Integer store word register
RABBITIZER_DEF_INSTR_ID_ALTNAME(
r5900, (0x02 << 2) | 0x03, viswr_z, viswr.z,
.operands={RAB_OPERAND_r5900_vit, RAB_OPERAND_r5900_vis_parenthesis},
.isFloat=true,
.doesDereference=true,
.doesLoad=true
.doesLoad=true,
.accessType=RAB_ACCESSTYPE_WORD
) // Integer store word register
RABBITIZER_DEF_INSTR_ID_ALTNAME(
r5900, (0x04 << 2) | 0x03, viswr_y, viswr.y,
.operands={RAB_OPERAND_r5900_vit, RAB_OPERAND_r5900_vis_parenthesis},
.isFloat=true,
.doesDereference=true,
.doesLoad=true
.doesLoad=true,
.accessType=RAB_ACCESSTYPE_WORD
) // Integer store word register
RABBITIZER_DEF_INSTR_ID_ALTNAME(
r5900, (0x08 << 2) | 0x03, viswr_x, viswr.x,
.operands={RAB_OPERAND_r5900_vit, RAB_OPERAND_r5900_vis_parenthesis},
.isFloat=true,
.doesDereference=true,
.doesLoad=true
.doesLoad=true,
.accessType=RAB_ACCESSTYPE_WORD
) // Integer store word register
12 changes: 8 additions & 4 deletions tables/tables/instr_id/r5900/r5900_normal.inc
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,8 @@
.readsRs=true,
.canBeLo=true,
.doesDereference=true,
.doesLoad=true
.doesLoad=true,
.accessType=RAB_ACCESSTYPE_QUADWORD
) // Load Quadword
RABBITIZER_DEF_INSTR_ID(
r5900, 0x1F, sq,
Expand All @@ -41,7 +42,8 @@
.readsRt=true,
.canBeLo=true,
.doesDereference=true,
.doesStore=true
.doesStore=true,
.accessType=RAB_ACCESSTYPE_QUADWORD
) // Store Quadword

RABBITIZER_DEF_INSTR_ID(
Expand All @@ -50,7 +52,8 @@
.readsRs=true,
.canBeLo=true,
.doesDereference=true,
.doesLoad=true
.doesLoad=true,
.accessType=RAB_ACCESSTYPE_QUADWORD
)

RABBITIZER_DEF_INSTR_ID(
Expand All @@ -59,5 +62,6 @@
.readsRs=true,
.canBeLo=true,
.doesDereference=true,
.doesStore=true
.doesStore=true,
.accessType=RAB_ACCESSTYPE_QUADWORD
)
4 changes: 4 additions & 0 deletions tests/c/logic_checks/descriptor_logic_check.c
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,10 @@ int main() {
// A instruction should not have both doesLoad and doesStore
LOGIC_ERROR(uniqueId, errorCount, !(descriptor->doesLoad && descriptor->doesStore));

// A dereference must do a non INVALID memory access
LOGIC_ERROR(uniqueId, errorCount, !(descriptor->doesDereference ^ (descriptor->accessType != RAB_ACCESSTYPE_INVALID)));
LOGIC_ERROR_A_IMPLIES_B(uniqueId, errorCount, descriptor->doesUnsignedMemoryAccess, descriptor->doesDereference);

switch (uniqueId) {
case RABBITIZER_INSTR_ID_cpu_move:
case RABBITIZER_INSTR_ID_rsp_move:
Expand Down

0 comments on commit 02302f2

Please sign in to comment.