Skip to main content

decode

Function decode 

Source
pub fn decode(isa: Isa, pc: u64, inst: u64) -> Instruction
Expand description

Decodes the instruction inst, located at address pc.

Only the low inst_length bytes of inst are part of the instruction; RISC-V encodings are little-endian, so this is the value of those bytes read as a little-endian integer.

use disc_v::{decode, Isa};

let ins = decode(Isa::Rv32, 0x1000, 0xfe050ee3);
assert_eq!(ins.to_string(), "beqz a0,0xffc");