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

Function s_imm

crates/virtual-machine/src/cpu/decoder.rs:907–911  ·  view source on GitHub ↗

S-type immediate: bits[31:25] || bits[11:7], sign-extended to 12 bits.

(word: u32)

Source from the content-addressed store, hash-verified

905 let bit11 = field(word, 7, 7) << 11;
906 let bits10_5 = field(word, 30, 25) << 5;
907 let bits4_1 = field(word, 11, 8) << 1;
908 sign_ext(bit12 | bit11 | bits10_5 | bits4_1, 13)
909}
910
911// J-type immediate: [31]<<20 | [19:12]<<12 | [20]<<11 | [30:21]<<1, sign-extended to 21 bits.
912fn j_imm(word: u32) -> i64 {
913 let bit20 = field(word, 31, 31) << 20;
914 let bits19_12 = field(word, 19, 12) << 12;

Callers 1

decodeFunction · 0.85

Calls 2

fieldFunction · 0.85
sign_extFunction · 0.85

Tested by

no test coverage detected