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

Function decode

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

Source from the content-addressed store, hash-verified

696 imm: u_imm(word),
697 }),
698 0x6F => Ok(DecodedInsn::Jal {
699 rd: rd(word),
700 imm: j_imm(word),
701 }),
702 0x67 => Ok(DecodedInsn::Jalr {
703 rd: rd(word),
704 rs1: rs1(word),
705 imm: i_imm(word),
706 }),
707 0x63 => Ok(DecodedInsn::Branch {
708 funct3: funct3(word),
709 rs1: rs1(word),
710 rs2: rs2(word),
711 imm: b_imm(word),
712 }),
713 0x03 => Ok(DecodedInsn::Load {
714 funct3: funct3(word),
715 rd: rd(word),
716 rs1: rs1(word),
717 imm: i_imm(word),
718 }),
719 0x23 => Ok(DecodedInsn::Store {
720 funct3: funct3(word),
721 rs1: rs1(word),
722 rs2: rs2(word),
723 imm: s_imm(word),
724 }),
725 // OP-IMM: pass the full bits[31:25] as funct7 so the execute stage can
726 // disambiguate SRLI vs SRAI using bit 30 (and check for illegal encodings).
727 0x13 => Ok(DecodedInsn::AluImm {
728 funct3: funct3(word),
729 funct7: field(word, 31, 25) as u8,
730 rd: rd(word),
731 rs1: rs1(word),
732 imm: i_imm(word),
733 }),
734 0x1B => Ok(DecodedInsn::AluImm32 {
735 funct3: funct3(word),
736 funct7: field(word, 31, 25) as u8,
737 rd: rd(word),
738 rs1: rs1(word),
739 imm: i_imm(word),
740 }),
741 0x33 => Ok(DecodedInsn::Alu {
742 funct3: funct3(word),
743 funct7: funct7(word),
744 rd: rd(word),
745 rs1: rs1(word),
746 rs2: rs2(word),
747 }),
748 0x3B => Ok(DecodedInsn::Alu32 {
749 funct3: funct3(word),
750 funct7: funct7(word),
751 rd: rd(word),
752 rs1: rs1(word),
753 rs2: rs2(word),
754 }),
755 0x0F => decode_fence(word),

Callers 14

stage_idMethod · 0.70
render_disasmFunction · 0.50
rtype_decodeFunction · 0.50
itype_decodeFunction · 0.50
decode_luiFunction · 0.50
decode_addiFunction · 0.50
decode_addFunction · 0.50
decode_subFunction · 0.50
decode_mulFunction · 0.50
decode_lwFunction · 0.50
decode_swFunction · 0.50
decode_beqFunction · 0.50

Calls 14

rdFunction · 0.85
u_immFunction · 0.85
j_immFunction · 0.85
rs1Function · 0.85
i_immFunction · 0.85
funct3Function · 0.85
rs2Function · 0.85
b_immFunction · 0.85
s_immFunction · 0.85
fieldFunction · 0.85
funct7Function · 0.85
decode_fenceFunction · 0.85

Tested by 12

rtype_decodeFunction · 0.40
itype_decodeFunction · 0.40
decode_luiFunction · 0.40
decode_addiFunction · 0.40
decode_addFunction · 0.40
decode_subFunction · 0.40
decode_mulFunction · 0.40
decode_lwFunction · 0.40
decode_swFunction · 0.40
decode_beqFunction · 0.40
decode_ecallFunction · 0.40
decode_illegalFunction · 0.40