An 8bit register contains the binary value 210011100 where t
An 8-bit register contains the binary value 2_1001.1100 where the 0^th bit (least significant) is 0 and the 7th bit (most significant) is 1. Note the dot (.) is added for readability of the binary value should be ignored. For a) and b) below, determine the 8-bit mask value and final register value after executing the mask: AND mask that will clear all even bits (assume bit-0 is even) OR mask that will set bits 3:0 (3 through 0) If we needed to force bits 5:4 (5 and 4) to logic low, what mask value and operation would we need to use?
Solution
Given binary word is
1001.1100
a) AND mask to clear even bits (i.e., set to low)
7654.3210 (bit position)
1001.1100
1010.1010 (AND operation)
1000.1000 (Result)
b) OR mask to 3 to 0 bits to set
7654.3210 (bit position)
1001.1100
0000. 1111(OR operation)
1001.1111(Result)
c) for resetting bits 5 and 4 we should use AND mask
7654.3210 (bit position)
1001.1100
1100.1111 (AND operation)
1000.1100 (Result)
