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

Function decode_sw

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

Source from the content-addressed store, hash-verified

115
116#[test]
117fn decode_sw() {
118 // Sw::new(base, src, offset)
119 let encoded = Sw::new(6, 7, -8).encode();
120 let decoded = decode(encoded).expect("should decode SW");
121 if let DecodedInsn::Store {
122 funct3,
123 rs1,
124 rs2,
125 imm,
126 } = decoded
127 {
128 assert_eq!(funct3, 2, "SW funct3 must be 2");
129 assert_eq!(rs1, 6);
130 assert_eq!(rs2, 7);
131 assert_eq!(imm, -8);
132 } else {
133 panic!("expected DecodedInsn::Store, got {decoded:?}");
134 }
135}
136
137#[test]
138fn decode_beq() {

Callers

nothing calls this directly

Calls 2

decodeFunction · 0.50
encodeMethod · 0.45

Tested by

no test coverage detected