A mask logical micro-operation keeps each data bit when the corresponding mask…
2021
A mask logical micro-operation keeps each data bit when the corresponding mask bit is 1 and clears it to 0 when the mask bit is 0. Which logic gate, applied bit by bit to the data and mask, performs this operation?
Answer: C. AND gate — ConceptIn computer organization, a micro-operation is an elementary operation carried out on the data held in a register during one clock pulse. A mask…
- A.
OR gate
- B.
NOR gate
- C.
AND gate
- D.
NAND gate
Attempted by 2790 students.
Show answer & explanation
Correct answer: C
Concept
In computer organization, a micro-operation is an elementary operation carried out on the data held in a register during one clock pulse. A mask micro-operation combines the data word with a second word called the mask, one bit position at a time.
A bit mask controls each data bit independently. At every bit position, mask 1 means preserve the data bit, while mask 0 means clear it to 0.
The required two-input function must therefore satisfy f(d, 1) = d and f(d, 0) = 0. This is the defining behavior of bitwise AND.
Data bit d | Mask bit m | d AND m |
|---|---|---|
0 | 0 | 0 |
0 | 1 | 0 |
1 | 0 | 0 |
1 | 1 | 1 |
Application
Let the data byte be D = 1011 0110 and the mask be M = 1111 0000.
Apply AND at each corresponding bit position: 1&1=1, 0&1=0, 1&1=1, 1&1=1, 0&0=0, 1&0=0, 1&0=0, and 0&0=0.
Thus D AND M = 1011 0000. The upper four data bits are preserved where M has 1s, and the lower four bits are cleared where M has 0s.
Cross-check and contrast
OR makes every mask-1 position equal to 1, so it does not preserve an arbitrary data bit there.
NOR makes every mask-1 position equal to 0 and complements data at mask-0 positions.
NAND complements the data at mask-1 positions and makes every mask-0 position equal to 1.
Result
The mask logical micro-operation is performed by the AND gate.