29
How circuits acquire memory: Sequential & Clocked Circuits. COS 116, Spring 2011 Sanjeev Arora

How circuits acquire memory: Sequential & Clocked Circuits....Fact: “Data Flip-Flop” or “D flip flop”; can be implemented using two R-S flip flops. No “undefined” outputs

  • Upload
    others

  • View
    6

  • Download
    0

Embed Size (px)

Citation preview

Page 1: How circuits acquire memory: Sequential & Clocked Circuits....Fact: “Data Flip-Flop” or “D flip flop”; can be implemented using two R-S flip flops. No “undefined” outputs

How circuits acquire memory: Sequential &

Clocked Circuits.COS 116, Spring 2011Sanjeev Arora

Page 2: How circuits acquire memory: Sequential & Clocked Circuits....Fact: “Data Flip-Flop” or “D flip flop”; can be implemented using two R-S flip flops. No “undefined” outputs

Midterm

Midterm exam scores

Formula for overall grade: 50% exam + 25% HW + labs, 25% participation

Page 3: How circuits acquire memory: Sequential & Clocked Circuits....Fact: “Data Flip-Flop” or “D flip flop”; can be implemented using two R-S flip flops. No “undefined” outputs

Recap: Combinational Circuits

← Crossed wires that are not connected are sometimes drawn like this.

No loops allowed (direct or indirect)

Wires: transmit voltage(and hence value)

Page 4: How circuits acquire memory: Sequential & Clocked Circuits....Fact: “Data Flip-Flop” or “D flip flop”; can be implemented using two R-S flip flops. No “undefined” outputs

Timing Diagram

5V

0VTime

X

5V

0VTime

output

NOT gate

delay

Page 5: How circuits acquire memory: Sequential & Clocked Circuits....Fact: “Data Flip-Flop” or “D flip flop”; can be implemented using two R-S flip flops. No “undefined” outputs

Recap: Combinational circuit for binary addition?

Want to design a circuit to add any two N-bit integers (say N =64).

25 11001

+29 11101

54 110110

Is the truth table method useful? Ideas?

Page 6: How circuits acquire memory: Sequential & Clocked Circuits....Fact: “Data Flip-Flop” or “D flip flop”; can be implemented using two R-S flip flops. No “undefined” outputs

Modular design

Have small numberof basic components.

Put them together to achieve desired functionality

Basic principle of modern industrial design; recurring theme in next few lectures.

Page 7: How circuits acquire memory: Sequential & Clocked Circuits....Fact: “Data Flip-Flop” or “D flip flop”; can be implemented using two R-S flip flops. No “undefined” outputs

1-bit adder

(Carry from previous adder)

Hand in on Mar 22: Truth table, circuit for 1-bit adder.

ak bk

ck1-ADDck+1

sk

Carry bit for next adder.

Page 8: How circuits acquire memory: Sequential & Clocked Circuits....Fact: “Data Flip-Flop” or “D flip flop”; can be implemented using two R-S flip flops. No “undefined” outputs

Modular Designfor boolean circuits

An N-bit adder using N 1-bit adders(will do Mar 22)

Page 9: How circuits acquire memory: Sequential & Clocked Circuits....Fact: “Data Flip-Flop” or “D flip flop”; can be implemented using two R-S flip flops. No “undefined” outputs

A Full Adder (from handout)

Page 10: How circuits acquire memory: Sequential & Clocked Circuits....Fact: “Data Flip-Flop” or “D flip flop”; can be implemented using two R-S flip flops. No “undefined” outputs

Memory

Rest of this lecture:How boolean circuits can have “memory”.

Page 11: How circuits acquire memory: Sequential & Clocked Circuits....Fact: “Data Flip-Flop” or “D flip flop”; can be implemented using two R-S flip flops. No “undefined” outputs

What do you understand by ‘memory”?

How can you tell that a 1-year old child has it?

Behaviorist’s answer: His/her actions depend upon past events.

Page 12: How circuits acquire memory: Sequential & Clocked Circuits....Fact: “Data Flip-Flop” or “D flip flop”; can be implemented using two R-S flip flops. No “undefined” outputs

Why combinational circuits have no “memory”

Wires: transmit voltage(and hence value)

Boolean gates connected by wires

Important: no loops allowed

Output is determined by current inputs;no “memory” of past values of the inputs.

Today: Circuits with loops; aka “Sequential Circuits”

Page 13: How circuits acquire memory: Sequential & Clocked Circuits....Fact: “Data Flip-Flop” or “D flip flop”; can be implemented using two R-S flip flops. No “undefined” outputs

Matt likes Sue but he doesn’t like changing his mind Represent with a circuit:

Matt will go to the party if Sue goes or if he already wanted to go

S

M Is this well-defined?

Page 14: How circuits acquire memory: Sequential & Clocked Circuits....Fact: “Data Flip-Flop” or “D flip flop”; can be implemented using two R-S flip flops. No “undefined” outputs

Sequential Circuits

Circuits with AND, OR and NOT gates.

Cycles are allowed (ie outputs can feedback into inputs)

Can exhibit “memory”.

Sometimes may have “undefined” values

How to write the “truth table”? Suggestions?

Page 15: How circuits acquire memory: Sequential & Clocked Circuits....Fact: “Data Flip-Flop” or “D flip flop”; can be implemented using two R-S flip flops. No “undefined” outputs

Enter Rita

Matt will go to the party if Sue goes OR if the following holds: if Rita does not go andhe already wanted to go.

?

M

S

R

MR, S: “control”inputs

What combination of R, S changes M?

Page 16: How circuits acquire memory: Sequential & Clocked Circuits....Fact: “Data Flip-Flop” or “D flip flop”; can be implemented using two R-S flip flops. No “undefined” outputs

R-S Latch SR

M

Page 17: How circuits acquire memory: Sequential & Clocked Circuits....Fact: “Data Flip-Flop” or “D flip flop”; can be implemented using two R-S flip flops. No “undefined” outputs

A more convenient form of memory

Fact: “Data Flip-Flop” or “D flip flop”;can be implemented using two R-S flip flops.

No“undefined”outputs ever!

Page 18: How circuits acquire memory: Sequential & Clocked Circuits....Fact: “Data Flip-Flop” or “D flip flop”; can be implemented using two R-S flip flops. No “undefined” outputs

“Register” with 4 bits of memory

Page 19: How circuits acquire memory: Sequential & Clocked Circuits....Fact: “Data Flip-Flop” or “D flip flop”; can be implemented using two R-S flip flops. No “undefined” outputs

What controls the “Write” signal?

Page 20: How circuits acquire memory: Sequential & Clocked Circuits....Fact: “Data Flip-Flop” or “D flip flop”; can be implemented using two R-S flip flops. No “undefined” outputs

The “symphony” inside a computer

Clock

Combinational circuit

Memory

ClockedSequentialCircuit(akaSynchronousCircuits)

Page 21: How circuits acquire memory: Sequential & Clocked Circuits....Fact: “Data Flip-Flop” or “D flip flop”; can be implemented using two R-S flip flops. No “undefined” outputs

Timing diagram (analog of truth table for sequential circuits)

R S M(t) M(t+1)0 0 00 0 10 1 00 1 11 0 01 0 11 1 01 1 1

Fill in timing diagram for RS latch and hand in on a piece of paper.

Page 22: How circuits acquire memory: Sequential & Clocked Circuits....Fact: “Data Flip-Flop” or “D flip flop”; can be implemented using two R-S flip flops. No “undefined” outputs

Clocked Sequential Circuits

Page 23: How circuits acquire memory: Sequential & Clocked Circuits....Fact: “Data Flip-Flop” or “D flip flop”; can be implemented using two R-S flip flops. No “undefined” outputs

Synchronous Sequential Circuit(aka Clocked Sequential Circuit)

CLOCK

INPUTSCombinational

CircuitMemory

(flip-flops)

Page 24: How circuits acquire memory: Sequential & Clocked Circuits....Fact: “Data Flip-Flop” or “D flip flop”; can be implemented using two R-S flip flops. No “undefined” outputs

Shorthand

Combinational Circuit

Memory(flip-flops)

CLK

This stands for “lots of wires”(aka “bus”)

Page 25: How circuits acquire memory: Sequential & Clocked Circuits....Fact: “Data Flip-Flop” or “D flip flop”; can be implemented using two R-S flip flops. No “undefined” outputs

Clock Speeds

Heinrich Hertz1857-94

1974 Intel 8080 2 MHz(Mega = Million)

1981 Original IBM PC 4.77 MHz

1993 Intel Pentium 66 MHz

2005 Pentium 4 3.4 GHz(Giga = Billion)

Page 26: How circuits acquire memory: Sequential & Clocked Circuits....Fact: “Data Flip-Flop” or “D flip flop”; can be implemented using two R-S flip flops. No “undefined” outputs

What limits clock speed?

Combinational Circuit

Memory(flip-flops)

CLK

Delays in combinational logic (remember the adder). Clock cycle = time needed for circuit value to settle.During 1 clock cycle of Pentium 4, light travels: 4 inches

Page 27: How circuits acquire memory: Sequential & Clocked Circuits....Fact: “Data Flip-Flop” or “D flip flop”; can be implemented using two R-S flip flops. No “undefined” outputs

Finite State Machines

Read handout (Brian Hayes article) for next time.

Page 28: How circuits acquire memory: Sequential & Clocked Circuits....Fact: “Data Flip-Flop” or “D flip flop”; can be implemented using two R-S flip flops. No “undefined” outputs

Example: State diagram for automatic door

Closed Open

Detected PersonNo Person Detected

Detected Person

No Person Detected

Finite # of “states”;Transition rules between states

Page 29: How circuits acquire memory: Sequential & Clocked Circuits....Fact: “Data Flip-Flop” or “D flip flop”; can be implemented using two R-S flip flops. No “undefined” outputs

Next lectures…

FSMs Computer organization: CPUs and RAM Lessons from computer architecture.