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

Function decode_lw

crates/virtual-machine/tests/vm_decoder.rs:96–114  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

94
95#[test]
96fn decode_lw() {
97 // Lw::new(rd, base, offset)
98 let encoded = Lw::new(5, 6, 100).encode();
99 let decoded = decode(encoded).expect("should decode LW");
100 if let DecodedInsn::Load {
101 funct3,
102 rd,
103 rs1,
104 imm,
105 } = decoded
106 {
107 assert_eq!(funct3, 2, "LW funct3 must be 2");
108 assert_eq!(rd, 5);
109 assert_eq!(rs1, 6);
110 assert_eq!(imm, 100);
111 } else {
112 panic!("expected DecodedInsn::Load, got {decoded:?}");
113 }
114}
115
116#[test]
117fn decode_sw() {

Callers

nothing calls this directly

Calls 2

decodeFunction · 0.50
encodeMethod · 0.45

Tested by

no test coverage detected