| Crates.io | rabbitizer |
| lib.rs | rabbitizer |
| version | 2.0.0-alpha.7 |
| created_at | 2022-12-18 20:16:32.904156+00 |
| updated_at | 2025-09-20 14:07:00.83193+00 |
| description | MIPS instruction decoder |
| homepage | |
| repository | https://github.com/Decompollaborate/rabbitizer |
| max_upload_size | |
| id | 740585 |
| size | 3,486,172 |
rabbitizer (whole name is lowercase) is a MIPS instruction decoder API.
use rabbitizer::{Instruction, Vram, InstructionFlags, InstructionDisplayFlags};
use rabbitizer::isa::IsaVersion;
use rabbitizer::opcodes::Opcode;
let vram = Vram::new(0x80000000);
let flags = InstructionFlags::new(IsaVersion::MIPS_I);
// The instruction word to be decoded.
let word = 0x3C088001;
// Decode the instruction.
let instr = Instruction::new(word, vram, flags);
// Check the decoded instruction.
assert_eq!(instr.opcode(), Opcode::core_lui);
// Produce an assemblable representation.
// `InstructionDisplayFlags` allows to configure the generated representation.
let display_flags = InstructionDisplayFlags::new();
let display = instr.display::<&str>(&display_flags, None, 0);
assert_eq!(
&display.to_string(),
"lui $t0, 0x8001"
);
Check the documentation at crates.io.
no_std and "no alloc".const decoding. It is possible to decode MIPS instructions at compile time..does_link() instead of checking for jal, jalr, bal
bltzal, etc.jalr instruction, allowing to disassemble
the instruction using an implicit or explicit rd register depending if
that register is $ra or not.SN64: div/divu fix: tweaks a bit the produced div, divu and
break instructions.gccee: Many workarounds for R5900EE specific instructions to support the
differences between the original toolchain and modern gas.encoder feature. See
Crate features for more info.In order to keep it simple the following features will never be supported:
The current version of rabbitizer requires Rust 1.82.0 or greater.
The current policy is that this may be bumped in minor rabbitizer updates.
rabbitizer is available on crates.io and can be included in your Cargo enabled project like this:
[dependencies]
rabbitizer = "2.0.0-alpha.7"
There are a few compilation features. Currently none of them are enabled by default.
MIPS_II: Enables support for MIPS II instructions.MIPS_III: Enables support for MIPS III instructions.
MIPS_II feature.MIPS_IV: Enables support for MIPS IV instructions.
MIPS_III feature.RSP: Enables support for the RSP extension set.
MIPS_III feature.R3000GTE: Enables support for the R3000GTE extension set.R4000ALLEGREX: Enables support for the R4000ALLEGREX extension set.
MIPS_III feature.R5900EE: Enables support for the R5900EE extension set.
MIPS_IV feature.RspViceMsp: Enables support for the Vice Msp extension set, which is an
extension for the RSP instruction set.
RSP feature.all_isas: Enables every base ISAs. Currently enables MIPS_II,
MIPS_III and MIPS_IV.all_extensions: Enables all common extensions. Currently enables RSP,
R3000GTE, R4000ALLEGREX and R5900EE features.all_gated_extensions: Enables gated extensions. Currently enables
all_extensions and RspViceMsp features.std: Turns on std (or turn off no_std, depending on how you prefer it).
This currently doesn't do much besides internally using std::error instead
of core::error, which may lower the MSRV.encoder: Exposes the encoder api.
Instruction struct, in a similar fashion to an assembler, but more
limited.unchecked_instr_fields: Exposes unchecked variants functions of the
InstrField struct that allow skipping validity checks.
unsafe. Even if their use may not trigger UB
or similar effects, they could return garbage data if misused.serde: Allows serializing and deserializing some structs and enums by
using serde.
serde then open an issue requesting it or send a
PR implementing them.bindings_c: Expose C bindings. NOT WORKING YET.pyo3: Expose Python3 bindings. NOT WORKING YET.
std, all_extensions and all_gated_extensions features.pyo3 dependency.This library follows Semantic Versioning. We try to always keep backwards compatibility, so no breaking changes should happen until a major release (i.e. jumping from 1.X.X to 2.0.0).
To see what changed on each release check either the CHANGELOG.md file or check the releases page on Github. You can also use this link to check the latest release.