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

Function u_imm

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

U-type immediate: upper 20 bits placed at [31:12], lower 12 bits zero. We sign-extend from the 32-bit word so that large addresses work correctly.

(word: u32)

Source from the content-addressed store, hash-verified

900}
901
902// B-type immediate: [31]<<12 | [7]<<11 | [30:25]<<5 | [11:8]<<1, sign-extended to 13 bits.
903fn b_imm(word: u32) -> i64 {
904 let bit12 = field(word, 31, 31) << 12;
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;

Callers 1

decodeFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected