5.3. Applying Logic Rules

Computers generally work with bit patterns like 01011100 to represent information. That means that often times, we need to apply a rule like AND or OR to not just two-bits, but to two-bit patterns. To apply a rule like AND to two-bit patterns like 1010 and 1110, we simply apply the rule to each successive pair of bits in the two patterns as shown in the diagram below:


../_images/ApplyingAND0.png

We are going to apply the AND rule to combine the bit pattern 1010 with the pattern 1110. To do so, we will apply the rule to each “column” of bits in the two patterns.

../_images/ApplyingAND1.png

The AND rule states that if both input bits are 1, the output is 1. The first bit of both patterns is 1, so we record a 1 for the first bit of our answer.

../_images/ApplyingAND2.png

Looking at the second bit of each pattern, we see a 0 in the first pattern and a 1 in the second. The AND rule says that the output is 0 unless both inputs are 1. So this means the second bit of our answer will be 0.

../_images/ApplyingAND3.png

A 1 in the third bit of both input patterns means the third bit of our answer is 1 as well.

../_images/ApplyingAND4.png

Finally, in the last position, two 0’s result in 0 according to the AND rule. Our final answer is 1010. In any digit where both patterns had a 1 our answer has a 1; otherwise, it has a 0.

Here is the result of applying the OR rule to the same two patterns:

Pattern 1

1

0

1

0

Pattern 2

1

1

1

0

OR

1

1

1

0

Self Check

You have attempted of activities on this page