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

Function decode_addi

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

Source from the content-addressed store, hash-verified

28
29#[test]
30fn decode_addi() {
31 let encoded = Addi::new(1, 2, -42).encode();
32 let decoded = decode(encoded).expect("should decode ADDI");
33 if let DecodedInsn::AluImm {
34 rd,
35 rs1,
36 imm,
37 funct3,
38 ..
39 } = decoded
40 {
41 assert_eq!(rd, 1);
42 assert_eq!(rs1, 2);
43 assert_eq!(imm, -42);
44 assert_eq!(funct3, 0);
45 } else {
46 panic!("expected DecodedInsn::AluImm, got {decoded:?}");
47 }
48}
49
50#[test]
51fn decode_add() {

Callers

nothing calls this directly

Calls 2

decodeFunction · 0.50
encodeMethod · 0.45

Tested by

no test coverage detected