Winter 1998 Computers and Society
GST 2710, Section 90571
AGS 3360, Section 95198

Last updated: 3/1/98
Link back to course Welcome...

Worksheet: Logic Gates

The worksheet on Binary Arithmetic With Switches showed that simple mechanical switches can carry out arithmetic. While switches are easy to understand, and were actually used in some early computers, they are, however, slow. Even though switches are no longer used, computers are still built with these and similar functions. There have been many technologies used in computers to replace switches, including vacuum tubes, transistors and different generations of microchips. However, the basic functions have remained constant. Because the technology and construction details change while the function remains constant, it is very useful to have representation or symbols for the functions, independent of the technology used to implement the function. This set of representations or symbols is called logic gates. The logic part because they represent classical logical relationships, and gates because they can steer signals to different parts of a large circuit. Logic gates are drawn with

The logical function is made explicit with a truth table. In the truth table, 0 represents false and 1 represents true.

Here are the most important examples. The name of the gate is its logical function that relates the inputs to the outputs. Take an AND gate, for example. Its output is true (1) if input A is true AND input A is true.

A

B

C

0

0

 

0

1

 

1

0

 

1

1

 

andgate.gif (1305 bytes)

1. AND gate. So named because the output is true if Input A is true and Input B is true. In the switch worksheet, this was the series connection. This function carries out binary multiplication.

 



A

B

C

0

0

 

0

1

 

1

0

 

1

1

 

orgate.gif (1310 bytes)

2. OR gate. This is the normal inclusive or; the output is true if A is true, or if B is true, or if both are true. Inclusive means that the case where both inputs are true is included in making the output true.

 



A

B

C

0

0

 

0

1

 

1

0

 

1

1

 

xorgate.gif (1353 bytes)

3. Exclusive or, or XOR (pronounced "zor"); the output is true if A is true, or if B is true, but not if both are true. This function carries out binary addition, except for the carry in the case of 1 + 1.





A

B

C

D

0

0

   

0

1

   

1

0

   

1

1

   

addgate.gif (1824 bytes)

4. Combining the XOR and AND gates carries out binary addition with the carry.


To illustrate the steering capabilities of gates, we need one more feature, inversion. Any signal line (an input or output) can be inverted by placing a circle on its connection to the body of the logic gate. The circle inverts the truth of that input. This means that it changes true to false or false to true, before it gets used by the gate itself.

A

B

C

D

0

0

   

0

1

   

1

0

   

1

1

   

gate.gif (1740 bytes)

5. Using the inversion function, the circuit to the right steers input B to output C if input A = 1, or to output D if A = 0.