The mask logical micro operation is equivalent to which logical gate?
2021
The mask logical micro operation is equivalent to which logical gate?
- A.
OR gate
- B.
NOR gate
- C.
AND gate
- D.
NAND gate
Attempted by 2182 students.
Show answer & explanation
Correct answer: C
Masking is a bitwise operation that selectively keeps or clears the bits of a data word using a fixed mask pattern: wherever the mask bit is 1, the data bit is retained unchanged, and wherever the mask bit is 0, the data bit is forced to 0. This “output 1 only when both the data bit and the mask bit are 1” rule is exactly the AND gate's truth table, so masking is implemented as a bitwise AND between the data and the mask.
Take the data byte 1011 0110 and the mask byte 1111 0000 - the mask marks the upper nibble to be kept and the lower nibble to be cleared.
AND each bit position: for the upper nibble, 1&1, 0&1, 1&1, 1&1 all equal the original data bits (1, 0, 1, 1); for the lower nibble, 0&0, 1&0, 1&0, 0&0 all equal 0.
The result is 1011 0000 - the upper nibble survives unchanged and the lower nibble is cleared to zero, exactly the masking behaviour described above.
An OR gate can only push bits toward 1, so it can never clear the masked-out bits to 0 - it fails the 'clear on mask=0' requirement.
A NOR gate inverts the OR result, so it would flip the retained bits instead of leaving them unchanged - it fails the 'keep on mask=1' requirement.
A NAND gate inverts the AND result, so it would invert exactly the bits masking is supposed to preserve - the opposite of what is needed.
Only the AND gate's truth table satisfies both rules - retain the bit when the mask is 1, clear it when the mask is 0 - so the mask logical micro operation is equivalent to an AND gate.