MCPcopy Create free account
hub / github.com/LPC4/Full-Stack / decode_system

Function decode_system

crates/virtual-machine/src/cpu/decoder.rs:819–842  ·  view source on GitHub ↗
(word: u32)

Source from the content-addressed store, hash-verified

817 0x102 => Ok(DecodedInsn::Sret),
818 0x120 => Ok(DecodedInsn::SfenceVma), // SFENCE.VMA
819 0x105 => Ok(DecodedInsn::Wfi), // WFI
820 _ => Err(VmError::IllegalInstruction(word)),
821 }
822 } else {
823 // CSR instructions
824 Ok(DecodedInsn::Csr {
825 funct3: funct3(word),
826 rd: rd(word),
827 rs1_uimm: rs1(word), // for CSRRWI/CSRRSI/CSRRCI this is the uimm[4:0]
828 csr: field(word, 31, 20) as u16,
829 })
830 }
831}
832
833fn fmac(word: u32, op: FMacOp) -> DecodedInsn {
834 DecodedInsn::FMac {
835 op,
836 rs3: field(word, 31, 27) as usize,
837 fmt: field(word, 26, 25) as u8,
838 rm: funct3(word),
839 rd: rd(word),
840 rs1: rs1(word),
841 rs2: rs2(word),
842 }
843}
844
845// --- Field extraction helpers ---

Callers 1

decodeFunction · 0.85

Calls 4

funct3Function · 0.85
fieldFunction · 0.85
rdFunction · 0.85
rs1Function · 0.85

Tested by

no test coverage detected