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
906// S-type immediate: bits[31:25] || bits[11:7], sign-extended to 12 bits.
907fn s_imm(word: u32) -> i64 {
908 let hi = field(word, 31, 25);
909 let lo = field(word, 11, 7);
910 sign_ext((hi << 5) | lo, 12)
911}
912
913// B-type immediate: [31]<<12 | [7]<<11 | [30:25]<<5 | [11:8]<<1, sign-extended to 13 bits.
914fn b_imm(word: u32) -> i64 {

Callers 1

decodeFunction · 0.85

Calls 2

fieldFunction · 0.85
sign_extFunction · 0.85

Tested by

no test coverage detected