You are on page 1of 46

BME303 Intro.

to Computing

Chapter 3:
Digital Logic Structures

BME303 Intro. to Computing

Devices, Circuits,

Data Path

Memory

Storage Elements

Decoder
Mux (multiplexer)
Adder

Logic Gates

R-S Latch
Gated D latch
Register

Logic Structures

Algorithms

NOT
OR
AND
Other gates

Transistors

Language
Bottom Up

Problem

Machine (ISA) Architecture

Micro-architecture

Circuits

Devices
4

BME303 Intro. to Computing

First transistor and beyond


First transistor was invented in 1947 by
John Bardeen, Walter Brattain, and William
Shockley at Bell Laboratories (the three
shared a Nobel prize later)
Shockley started a semiconductor
company in Palo Alto, and staff of folded
company invented the integrated circuit
(the "chip") and found Intel Corporation

By 1960, most computers used transistors


for logic, and ferrite cores for memory
(Shanghai-born American physicists, An
Wang and Way-Dong Woo )

Workbench of John Bardeen and Walter


Brattain at Bell Laboratories

Memory chips (digital circuits) replaced


cores in the 1970's
5

BME303 Intro. to Computing

Memory
primary access by the CPU or secondary (indirect)
access by the CPU. Based on the speed of access to the
memory.
volatile or non-volatile is a distinction based on
technology (magnetic vs. electrical, etc.). Volatile
memory requires power to maintain its stored
information.
Read-only memory, or read-write is a distinction based
on properties of the memory. Read only memory, or
"ROM", is not modifiable.
Random-Access or Sequential-Access, is a distinction
based on the mechanism of reading the memory.
http://en.wikipedia.org/wiki/Giant_magnetoresistive_effect
6

BME303 Intro. to Computing

Disclaimer
Not all electronic computers are made from
transistors. Electronic logic can be built from

vacuum tubes
magnetic amplifiers, core, bubbles
superconducting cryotrons
superconducting Josephson junctions

So, why transistors then


"Had the automobile developed at a pace (equal) to that of the
computer during the past twenty years, today a Rolls Royce would
cost less than $3.00, get 3 million miles to the gallon, deliver enough
power to drive (the ship) the Queen Elizabeth II, and six of them
would fit on the head of a pin!"
7

BME303 Intro. to Computing

Intel Processors

April 1972
Name of Processor: 8008
Clock speed: 200 kHz
Number of transistors: 3,500

March 1993
Name of Processor: Pentium
Clock speed: 60 MHz
Number of transistors: 3.1 million

September 1978
Name of Processor: 8086
Clock speed: 10 MHz
Number of transistors: 29,000

May 1997
Name of Processor: Pentium II
Clock speed: 300 MHz
Number of transistors: 3.3 million

February 1982
Name of Processor: 286
Clock speed: 12 MHz
Number of transistors: 134,000

August 1999
Name of Processor: Pentium III
Clock speed: 600 MHz
Number of transistors: 9.5 million

October 1985
Name of Processor: 386
Clock speed: 16 MHz
Number of transistors: 275,000

November 2000
Name of Processor: Pentium 4
Clock speed: 1.5 GHz
Number of transistors: 42 million

April 1989
Name of Processor: 486
Clock speed: 25 MHz
Number of transistors: 1,200,000

Nov 2002
Name of Processor: Pentium 4
Clock speed: 3.0 GHz
Number of transistors: 55 million
8

BME303 Intro. to Computing

Making the Processor

BME303 Intro. to Computing

Transistor as a Switch
Switches are devices with discrete state
changes that enable, disable, or direct a
flow.
Switch Closed
Switch Open
Open Circuit
No current through circuit
Light is OFF
Vout = 2.9V
1

Voltage is
a relative
quantity

Closed Circuit
Short circuit across switch
Current flows
Light is on
Vout is 0 V
0

0V
10

BME303 Intro. to Computing

Mos:Metal-Oxide-Semiconductor
Metal-Oxide-Semiconductor Field Effect Transistor (MOSFET).

The current from source to drain


depends on the voltage applied
to the gate

Sandwich: Metal, silicon oxide and semiconductor

11

BME303 Intro. to Computing

n-type MOS Transistor


MOS = Metal Oxide Semiconductor
two types: n-type and p-type

Some n-type
when Gate has positive voltage,
short circuit between #1 and #2
(switch closed, light on)
when Gate has zero voltage,
open circuit between #1 and #2
(switch open, light off)

Gate = 1

Gate = 0
Terminal #2 must be
connected to GND (0V).
12

BME303 Intro. to Computing

p-type MOS Transistor


p-type is complementary to n-type
Some p-type
when Gate has positive voltage,
open circuit between #1 and #2
(switch open, light off)
when Gate has zero voltage,
short circuit between #1 and #2
(switch closed, light on)

Gate = 1

Gate = 0
Terminal #1 is
connected to +2.9V.
13

BME303 Intro. to Computing

MOS Transistor
MOS means Metal-Oxide Semiconductor

CMOS indicates use of Complementary types:


N(egative) and P(ositive)

0 volts at Gate: open


2.9 volts Gate: closed
n-type: Gate = 1 is on/closed

0 volts at Gate: closed


2.9 volts at Gate: open
p-type: Gate = 0 is on/closed
14

BME303 Intro. to Computing

The goal: Realizing Logical Operations

A AND B
B

A AND B

Circuits

Devices
15

BME303 Intro. to Computing

Logic Gates
Use switch behavior of MOS transistors to
implement logical functions: AND, OR, NOT
Digital symbols:
assign a range of analog voltages to each
digital (logic) symbol

assignment of voltage ranges depends on


electrical properties of transistors being used
typical values for "1": +5V, +3.3V, +2.9V
from now on we'll use +2.9V
16

BME303 Intro. to Computing

Inverter (NOT Gate)


In=0

Out=1

In=1

Out=0

ground

Out

In

Out

0 Volts

2.9 Volts

2.9 Volts

0 Volts

In

17

BME303 Intro. to Computing

NOR Gate
A=0
B=1

C=

A B C
0 0
0 1
1 0
1 1
Note: Serial structure on top, parallel on bottom.
18

BME303 Intro. to Computing

NOR Gate
A=0
B=1

C=0

A B C
0 0
0 1 0
1 0
1 1
Note: Serial structure on top, parallel on bottom.
19

BME303 Intro. to Computing

NOR Gate
A=1
B=1

C=

A B C
0 0
0 1
1 0
1 1
Note: Serial structure on top, parallel on bottom.
20

BME303 Intro. to Computing

NOR Gate
A=1
B=1

C=0

A B C
0 0
0 1
1 0
1 1 0
Note: Serial structure on top, parallel on bottom.
21

BME303 Intro. to Computing

NOR Gate
A=0
B=0

C=1

A B C
0 0 1
0 1 0
1 0 0
1 1 0
Note: Serial structure on top, parallel on bottom.
22

BME303 Intro. to Computing

NOR Gate
A=1
B=0

C=0

A B C
0 0 1
0 1 0
1 0 0
1 1 0
Note: Serial structure on top, parallel on bottom.
23

BME303 Intro. to Computing

OR Gate

A
0
0
1
1

NOR

B
0
1
0
1

C
0
1
1
1

NOT
24

BME303 Intro. to Computing

NAND Gate (NOT-AND)

A B C
0 0

0 1

1 0

1 1

Note: Parallel structure on top, serial on bottom.


25

BME303 Intro. to Computing

AND Gate

A B

0 0

0 1

1 0

1 1

1
26

BME303 Intro. to Computing

Basic Logic Gates

27

BME303 Intro. to Computing

DeMorgan's Law
Converting AND to OR (with some help from NOT)
Using only AND, NOT gate to implement OR

A+B = ? (using AND, NOT)


Hint: A+B = ?

28

BME303 Intro. to Computing

DeMorgan's Law
Converting AND to OR (with some help from NOT)
Consider the following gate:

A
0
0
1
1

B
0
1
0
1

A B

A B

1
1
0
0

1
0
1
0

1
0
0
0

0
1
1
1

To convert AND to OR
(or vice versa),
invert both inputs
and outputs.

Same as A+B

29

BME303 Intro. to Computing

More than 2 Inputs?


AND/OR can take any number of inputs.
AND = 1 if all inputs are 1.
OR = 1 if any input is 1.
Similar for NAND/NOR.

Can implement with multiple two-input gates,


or with single CMOS circuit.

30

BME303 Intro. to Computing

Summary
MOS transistors are used as switches to implement
logic functions.
Some n-type: connect to GND, in=0, out=1
Some p-type: connect to +2.9V, in=1, out =1
Basic gates: NOT, NOR, NAND
Basic logic functions are AND, OR, and NOT
DeMorgan's Law
Convert AND to OR (and vice versa) by inverting inputs and
output

31

BME303 Intro. to Computing

2 Types of Logic Structures


1.

Combinational Logic Circuit


output depends only on the current inputs
Decision element
Stateless

2.

Sequential Logic Circuit


output depends on the sequence of inputs (past and
present)
stores information (state) from past inputs

32

BME303 Intro. to Computing

Combinational Logic Structures


Some important combinational logic structures are
Decoder
MUX (Multiplexer)
Full adder

We describe each of these as a logic structure or a


logic gate network

Each gate is physically realized by a circuit, such


as the MOS-circuit implementation
33

BME303 Intro. to Computing

Representation of Logic Function


Truth table
Logic expression

A NAND B = A B

A
0
0
1
1

B
0
1
0
1

C
1
1
1
0

Logic circuit

34

BME303 Intro. to Computing

Decoder

Code

Decoder

(e.g. 0110)

Your Surround Sound System

35

BME303 Intro. to Computing

2-bit Decoder
A
0
0
1
1

B output
0 1000
1 0100
0 0010
1 0001

36

BME303 Intro. to Computing

Decoder
A n-input decoder has 2n outputs.
4 input, how many outputs?

For each input word, exactly one output is 1, and


all others are 0

Consider the set of input patterns as a code:


each output detects one (unique) code word
Each input code word asserts one output
37

BME303 Intro. to Computing

2-bit Decoder
MMLogic: Multimedia Logic
http://www.softronix.com/logic.html

38

BME303 Intro. to Computing

Multiplexer (MUX)
n-bit selector and 2n inputs, one output
output equals one of the inputs, depending on selector

4-to-1 MUX

Out = A S0 S1 + B S0 S1 + C S0 S1 + D S0 S1
39

BME303 Intro. to Computing

MUX

40

BME303 Intro. to Computing

Multiplexer (MUX)
n-bit selector and 2n inputs, one output
output equals one of the inputs, depending on selector

4-to-1 MUX

Out = A S0 S1 + B S0 S1 + C S0 S1 + D S0 S1
41

BME303 Intro. to Computing

Multiplexer (MUX)
A MUX has 2n data inputs, n control
inputs (select lines), and 1 output

A multiplexer thus behaves like a multiposition channel select switch, permitting


any selected channel (one at a time) to be
switched to a common output (earphone,
TV screen, )
42

BME303 Intro. to Computing

MUX Example
Printing in a computer lab with 4 computers

4-to-1 MUX

43

BME303 Intro. to Computing

Adder
Generally, addition results in
sum and carry, where carry is
used for next bit addition

Example: A + B
1 11
01010 11 1
00100 11 1

Full Adder
3 inputs
2 outputs: sum and carry

01111 11 0

44

BME303 Intro. to Computing

Full Adder
Add two bits and carry-in, produce one-bit sum and
carry-out
Examples
0+0+1
sum = 1, carry = 0
1+1+0
sum = 0, carry = 1

Truth table for full-adder

A B Cin S Cout
0 0 0 0 0
0 0 1 1 0

0 1
0 1

0
1

1
0

0
1

1
1
1
1

0
1
0
1

1
0
0
1

0
1
1
1

0
0
1
1

45

BME303 Intro. to Computing

Full Adder
Add two bits and carry-in, produce one-bit sum and carryout

A B Cin S Cout
0 0 0 0 0 0

1
2

0 0
0 1

1
0

1
1

0
0

0 1

1 0

1 0

1 1

1 1

Row

46

BME303 Intro. to Computing

Full Adder

47

BME303 Intro. to Computing

Four-bit Adder
Example: add two 4-bit
binary numbers A and B

1 1 1 0

Cin

0 1 1 1
0 1 1 1

A[3:0]
B[3:0]

1 1 1 0

S[3:0]

0 1 1 1

Cout

48

You might also like