Study Web

Week 1

Gates and Digital Logic

COS10004 Computer Systems · Lecture 1.5 Gates and Digital Logic

What is a Gate?

  • A gate is an electronic component (e.g. transistors connected together) whose output is determined by its input. gates on a chip
  • ….to 10 million

Boolean Algebra and Digital Logic ‘ (prime) is an alternative to > The foundation of digital design, using ‘logic gates’ the bar () a c to indicate > NOT gate: state

  • OR gate: a b c c = a + b 0 0 0 0 1 1 Operator ‘+’ preferred (cf ‘∨’) 1 0 1 as OR is simple binary addition 1 1 1

Boolean Algebra and Digital Logic

  • AND gate: a b c c = a. b 0 0 0 0 1 0 Note: operator ‘.’ preferred (cf ‘∧’) 1 0 0 as AND is binary multiplication 1 1 1
  • NAND: c = (a. b) a b c 0 0 1 0 1 1 1 0 1 Drawn as: 1 1 0

Boolean Algebra and Digital Logic

  • Can construct any gate or function from NAND gates (discovered by Charles Sanders Pierce in 1880)
  • Examples:
=

=

Boolean Algebra and Digital Logic

  • Exclusive OR (XOR): a b c 0 0 0 c = a ⊕ b 0 1 1 1 0 1 1 1 0 The XOR function is the basis for modulo-2 binary addition, hence the ‘⊕’ operator.
c = a ⊕ b = a.b + a.b

Boolean Algebra and Digital Logic

  • Switching circuits (switches and relays) can also be used for digital logic functions
  • Preceded the more modern digital electronic gates in computers.

Combinations of Logic Gates

  • By connecting logic gates into circuits any desired output can be created. Set each of the inputs to true or false and you can see the output. (You can do this in the laboratory classes on Logisim)
  • The circuit for A.B + C.D

A A+BA.B

B

A.B + C.D

C D C+D C.D N.B. For this circuit there is no memory of past condition.

8 8
Diagram conventions: • Wire (voltage the same along it)
  • Output of gate controls the voltage
  • on the wire
  • inputs, outputs to gates (may be A
  • “high” e.g. 4 volt or low eg < 0.5 volt) B
  • Not shown: a power source for the D
  • Output of gate controls the voltage on the wire
  • inputs, outputs to gates (may be A “high” e.g. 4 volt or low eg < 0.5 volt) B C
  • Not shown: a power source for the D gates, the “earth” or “ground” wires – voltages are measured against these. A “schematic” diagram.

De Morgan’s Law and Gates -1

  • AND: AB = A + B We are using picture NAND: AB = A + B symbols to do logic.
  • =

or

  • The inversion can often be moved to the previous gates:
  • XNOR: X = A ⊕ B
  • Equiv: X = AB + AB

We apply de Morgan twice.

= (A + B).(A + B)

Finally:

THE GATE SYMBOLS: 1. BASIC GATES

2. INVERT & CONNECT

  • 2-input AND gate. Output (RHS) is high only • AND, & when both inputs (LHS) are high.
  • 2-input OR gate. Output is high if either input is + OR, | high. Output is only low if both inputs are low.
  • Inverter. Output is high when input is low and ~ NOT,! vice-versa. Inverts the output of another gate
  • 2-input XOR. Output is high when either input is ⊕ XOR, ^ high but is low if both inputs are high or low.

THE NOT GATES: 1. BASIC GATES

  • An inverter can be added to the output of any gate to reverse it's output (making an N version)
  • NXOR >!^
  • NAND >!&
  • NOR >!|

THE GATE SYMBOLS REPRESENT BOOLEAN ARITHMETIC:

• 1 AND 1 1.1 = 1, 1.0 = 0, 0.0 = 0, 0.1 = 0 • AND, &

• 1 OR 1 1+1 = 1, 1+0 = 1, 0+0 = 0, 0+1 = 1 + OR, |

• 1 XOR 1 1^1 = 0, 1^0 = 1, 0^0 = 0, 0^1 = 1 ⊕ XOR, ^

INPUTS, OUTPUTS 3. INPUT AND OUTPUT

2. INVERT & CONNECT

Inputs can be square wave generators (clocks)

or binary switches

or buttons

Outputs can be lights (LEDs)

INPUTS, OUTPUTS 3. INPUT AND OUTPUT

2. INVERT & CONNECT

  • Wires (just drag from one gate pin to another) can connect pins on the gates to each other and to switches and lights.
  • The power supply is universal and invisible. We don't have to worry about it.
  • – In real life there will be a +ve rail (Vcc) and a -ve rail (GND) with a connection of each to every chip on the board.
  • Logisim introduction: Have a play!

SUMMARY

  • Gates are electrical components that allow us to perform but-wise operations:
  • AND, OR, XOR, NOT
  • NOR, NAND, NXOR (and others)
  • Logisim allows us to design, build and simulate digital circuit logic:
  • Get familiar with it!