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

Function j_imm

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

J-type immediate: [31]<<20 | [19:12]<<12 | [20]<<11 | [30:21]<<1, sign-extended to 21 bits.

(word: u32)

Source from the content-addressed store, hash-verified

921
922// J-type immediate: [31]<<20 | [19:12]<<12 | [20]<<11 | [30:21]<<1, sign-extended to 21 bits.
923fn j_imm(word: u32) -> i64 {
924 let bit20 = field(word, 31, 31) << 20;
925 let bits19_12 = field(word, 19, 12) << 12;
926 let bit11 = field(word, 20, 20) << 11;
927 let bits10_1 = field(word, 30, 21) << 1;
928 sign_ext(bit20 | bits19_12 | bit11 | bits10_1, 21)
929}

Callers 1

decodeFunction · 0.85

Calls 2

fieldFunction · 0.85
sign_extFunction · 0.85

Tested by

no test coverage detected