 Logic

# Building With Logic Gates

Remember, XOR stands for "exclusive or," and for each gate if the input consists of a single 0 and a single 1, then the output is 1, otherwise the output is 0. You want this set of logic gates with inputs $A,$ $B,$ and $C,$ to output $Z = 1$ only if there's an odd number of inputs that equal 1.

What kind of gate should go at the question mark?

A palindrome reads the same forwards and backwards. (For example, 10101 and 1001 are palindromes.) Suppose you want a machine that takes a number with the four binary digits $A,$ $B,$ $C,$ and $D$ and outputs a 1 only if the number is a palindrome.

You can build this with two XOR gates, one NOT gate, and which other extra kind of gate?

Suppose you want a machine that takes a binary number with four digits $A,$ $B,$ $C,$ and $D$ and outputs 1 if the number is even. How many logic gates does this require?

Note: 0 is even.

A binary number is a number written in base 2. These numbers are similar to "normal" numbers, but they only use the digits 0 and 1 and are based on powers of 2 rather than powers of 10. For example, a "normal" base-10 arithmetic example would be something like $1234_{10} = 1 \cdot 10^3 + 2 \cdot 10^2 + 3 \cdot 10^1 + 4 \cdot 10^0.$ Here's a different number, but in binary: $1110_2 = 1 \cdot 2^3 + 1 \cdot 2^2 + 1 \cdot 2^1 + 0 \cdot 2^0 = 14_{10}.$ You are designing a calculator display with digits like the ones shown above.

Consider the logic gates leading to the portion of the display marked: The inputs are binary four digit numbers represented by the digits $A ,$ $B ,$ $C ,$ and $D .$ Which gates go in the red boxes?

Logic gates are used by computers to perform all sorts of operations, but designing the circuits can be tricky. We'll tackle addition of numbers (which requires many gates) in a later quiz, but for now let's consider a simpler problem:

We would like a machine that takes three inputs $A,$ $B,$ and $C$ and returns 1 if and only if all the inputs are 1.

This can be done with two logic gates that are identical. Which type of logic gate works?

×