Skip to content

Bit Operation ​

Bit Extract, Mask, Shift Left or Shift Right on an integer signal, chosen with the Operation parameter. Bit Extract: out = (in >> bit) & 1, for picking one flag out of a status word. Mask: out = in & mask, for isolating a bit field. Shift Left: out = in << shift (multiply by 2^shift, bits past the MSB are discarded). Shift Right: out = in >> shift, zero-filled (logical) or sign-extended (arithmetic).

Category: Digital Logic / Bits

Ports ​

PortKindSignalNotes
inControl inputInteger
outControl outputInteger

Parameters ​

ParameterTypeDefaultUnitsDescriptionID
OperationChoice: Bit Extract / Mask / Shift Left / Shift RightBit Extract—Bit Extract: out = (in >> bit) & 1. Mask: out = in & mask. Shift Left: out = in << shift. Shift Right: out = in >> shift.op
BitInteger0—Bit position to extract (0 = LSB, clamped to 0-31). Result is 0 or 1.bit_index
MaskInteger255—Bit mask AND-ed with the input. Default 255 (0xFF) keeps the low 8 bits. Use any int — e.g. 0xF0 to extract the high nibble of a byte, 0x80000000 to isolate the sign bit.mask
ShiftInteger1—Number of bit positions to shift (clamped to 0-31).shift
ModeChoice: logical (zero-fill) / arithmetic (sign-extend)logical (zero-fill)—Logical right shift fills with zeros from the left. Arithmetic right shift replicates the sign bit, so negative numbers stay negative (divide by 2^shift).arithmetic