Please enable JavaScript.
Coggle requires JavaScript to display documents.
Logical Operations (Draw truth tables for Boolean expressions consisting…
Logical Operations
Draw truth tables for Boolean expressions consisting of AND, OR, NOT and XOR logical operations.
-
-
-
-
Apply logical operations to combinations of conditions in programming, including clearing registers and masking
Clearing Registers
Clearing a register uses the AND logical operator and it works by cancelling all the bits using a mask of all 0's.
For example, if you wanted to clear the register 1001 1101, you would use the AND operation along with eight 0's to get a result of 0000 0000.
Masking
This process uses the AND logical operator and works by selecting which bits to maintain selective 1's.
Example 1 - you have a number of 1101 1101 and you mask that (using the AND operation), with 1000 0000 and your end result would be 1000 0000. The impact of this is that it will determine whether the left-most bit is a 1 or 0.
Example 2 - you have a number of 1011 0010 and you mask that (using the AND operation), with 1111 0000 and your end result would be 1011 0000. The impact of this is that it will determine whether the four left-most bits are 1 or 0.
Example 3 - you have a number of 1011 0011 and you mask that (using the AND operation), with 0000 0001 and your end result would be 0000 0001. The impact of this is that it will determine whether the right-most bit is a 1 or 0.
-