Skip to content

Mask

Bitwise AND of an integer signal with a constant mask: out = in & mask. Use to isolate individual bit fields or strip flags from a status word.

Category: Digital Logic / Bits

Keywords: bit, AND, filter, field, flag, bitmask, bit mask, bitwise

Ports

NameDirectionValue typeNotes
ininputint
outoutputint

Parameters

NameLabelTypeDefaultUnitsDescription
maskMaskint255Bit 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.

Implemented in C++ class SimCompCtlMask (components/control/CSim_comp_ctl_mask/sim_comp_ctl_mask.h).

Released under the MIT License.