Flip-flops, Latches and State Prof. Sirer COMP 303 Koç University.

Slides:



Advertisements
Similar presentations
Prof. Kavita Bala and Prof. Hakim Weatherspoon CS 3410, Spring 2014 Computer Science Cornell University See P&H Appendix B.7. B.8, B.10, B.11.
Advertisements

State & Finite State Machines Hakim Weatherspoon CS 3410, Spring 2012 Computer Science Cornell University See P&H Appendix C.7. C.8, C.10, C.11.
Changes in input values are reflected immediately (subject to the speed of light and electrical delays) on the outputs Each gate has an associated “electrical.
COE 202: Digital Logic Design Sequential Circuits Part 1 Dr. Ahmad Almulhem ahmadsm AT kfupm Phone: Office: Ahmad Almulhem, KFUPM.
Computer Science 210 Computer Organization Clocks and Memory Elements.
Sequential Logic Building Blocks – Flip-flops
Digital Design - Sequential Logic Design Chapter 3 - Sequential Logic Design.
Flip-Flops Computer Organization I 1 June 2010 © McQuain, Feng & Ribbens A clock is a free-running signal with a cycle time. A clock may be.
Storey: Electrical & Electronic Systems © Pearson Education Limited 2004 OHT 10.1 Sequential Logic  Introduction  Bistables  Memory Registers  Shift.
CHAPTER 3 Sequential Logic/ Circuits.  Concept of Sequential Logic  Latch and Flip-flops (FFs)  Shift Registers and Application  Counters (Types,
Flip-Flops, Registers, Counters, and a Simple Processor
Digital Logic Chapter 5 Presented by Prof Tim Johnson
Fall 2004EE 3563 Digital Systems Design EE 3563 Sequential Logic Design Principles  A sequential logic circuit is one whose outputs depend not only on.
1 Chapter 8 Flip-Flops and Related Devices. 2 Figure 8--1 Two versions of SET-RESET (S-R) latches S-R (Set-Reset) Latch.
Dr. ClincyLecture1 Appendix A – Part 2: Logic Circuits Current State or output of the device is affected by the previous states Circuit Flip Flops New.
EET 1131 Unit 10 Flip-Flops and Registers
EKT 124 / 3 DIGITAL ELEKTRONIC 1
Figure 7–1 Two versions of SET-RESET (S-R) latches
Prof. Hakim Weatherspoon CS 3410, Spring 2015 Computer Science Cornell University See P&H Appendix B.7. B.8, B.10, B.11.
Prof. Hakim Weatherspoon CS 3410, Spring 2015 Computer Science Cornell University See P&H Appendix B.7. B.8, B.10, B.11.
Arithmetic Hakim Weatherspoon CS 3410, Spring 2012 Computer Science Cornell University See P&H 2.4 (signed), 2.5, 2.6, C.6, and Appendix C.6.
Kevin Walsh CS 3410, Spring 2010 Computer Science Cornell University State & Finite State Machines See: P&H Appendix C.7. C.8, C.10, C.11.
Numbers & Arithmetic Hakim Weatherspoon CS 3410, Spring 2011 Computer Science Cornell University See: P&H Chapter , 3.2, C.5 – C.6.
Kevin Walsh CS 3410, Spring 2010 Computer Science Cornell University Circuits & Numbers See: P&H Chapter 2.4, 2.5, 3.2, C.5.
Sequential Logic Flip-Flops and Related Devices Dr. Rebhi S. Baraka Logic Design (CSCI 2301) Department of Computer Science Faculty.
Homework Reading Machine Projects Labs Tokheim Chapter 9.1 – 9.6
CS 151 Digital Systems Design Lecture 20 Sequential Circuits: Flip flops.
State & Finite State Machines Hakim Weatherspoon CS 3410, Spring 2011 Computer Science Cornell University See P&H Appendix C.7. C.8, C.10, C.11.
COMPUTER ARCHITECTURE & OPERATIONS I Instructor: Hao Ji.
Gates and Logic Hakim Weatherspoon CS 3410, Spring 2011 Computer Science Cornell Universty See: P&H Appendix C.0, C.1, C.2.
Electronic Instrumentation 1 Experiment 7 Digital Logic Devices and the 555 Timer Part A: Basic Logic Gates Part B: Flip Flops Part C: Counters Part D:
Comparators  A comparator compares two input words.  The following slide shows a simple comparator which takes two inputs, A, and B, each of length 4.
Fall 2007 L16: Memory Elements LECTURE 16: Clocks Sequential circuit design The basic memory element: a latch Flip Flops.
Chapter 3: Sequential Logic Circuit EKT 121 / 4 ELEKTRONIK DIGIT 1.
Numbers & Arithmetic Hakim Weatherspoon CS 3410, Spring 2012 Computer Science Cornell University See: P&H Chapter , 3.2, C.5 – C.6.
Sequential Circuits Chapter 4 S. Dandamudi To be used with S. Dandamudi, “Fundamentals of Computer Organization and Design,” Springer,  S.
Registers and Counters
ReVieW Combinational & Sequential Logic Circuit EKT 221 / 4 DIGITAL ELECTRONICS II.
Astable: Having no stable state. An astable multivibrator oscillates between two quasistable states. Asynchronous Having no fixed time relationship Bistable.
COE 202: Digital Logic Design Sequential Circuits Part 1
Flip Flop
Introduction to Computing Systems from bits & gates to C & beyond Chapter 3 Digital Logic Structures Transistors Logic gates & Boolean logic Combinational.
CS1Q Computer Systems Lecture 11 Simon Gay. Lecture 11CS1Q Computer Systems - Simon Gay2 The D FlipFlop A 1-bit register is called a D flipflop. When.
COM181 Computer Hardware Ian McCrumRoom 5B18, Lecture 2: Circuits.
CHAPTER 3 Sequential Logic/ Circuits.  Concept of Sequential Logic  Latch and Flip-flops (FFs)  Shift Registers and Application  Counters (Types,
Numbers & Arithmetic Hakim Weatherspoon CS 3410, Spring 2012 Computer Science Cornell University See: P&H Chapter , 3.2, C.5 – C.6.
FLIP FLOP By : Pn Siti Nor Diana Ismail CHAPTER 1.
1 Digital Fundamentals Chapter 8 Flip-Flops and Related Devices Resource: CYU / CSIE / Yu-Hua Lee / Not made by Engr. Umar Talha,
Floyd, Digital Fundamentals, 10 th ed Digital Fundamentals Tenth Edition Floyd © 2008 Pearson Education Chapter 1.
© 2009 Pearson Education, Upper Saddle River, NJ All Rights ReservedFloyd, Digital Fundamentals, 10 th ed Digital Logic Design Dr. Oliver Faust.
Sequential Logic Computer Organization II 1 © McQuain A clock is a free-running signal with a cycle time. A clock may be either high or.
EKT 121 / 4 ELEKTRONIK DIGIT I
Numbers and Arithmetic Hakim Weatherspoon CS 3410, Spring 2013 Computer Science Cornell University See: P&H Chapter , 3.2, C.5 – C.6.
Prof. Kavita Bala and Prof. Hakim Weatherspoon CS 3410, Spring 2014 Computer Science Cornell University See P&H Appendix B.7. B.8, B.10, B.11.
A latch is a temporary storage device that has two stable states (bistable). It is a basic form of memory. The S-R (Set-Reset) latch is the most basic.
Flip Flops Engr. Micaela Renee Bernardo. A latch is a temporary storage device that has two stable states (bistable). It is a basic form of memory. Latches.
Sequential Devices Sequential concept: output depends on present as well as past inputs Past inputs influence operations via memory elements.
7. Latches and Flip-Flops Digital Computer Logic.
Computer Science 210 Computer Organization
FLIP FLOPS Binary unit capable of storing one bit – 0 or 1
LATCHED, FLIP-FLOPS,AND TIMERS
Clocks A clock is a free-running signal with a cycle time.
State & Finite State Machines
Computer Science 210 Computer Organization
ECE Digital logic Lecture 16: Synchronous Sequential Logic
Hakim Weatherspoon CS 3410 Computer Science Cornell University
Computer Science 210 Computer Organization
Digital Fundamentals Floyd Chapter 1 Tenth Edition
8253 – PROGRAMMABLE INTERVAL TIMER (PIT). What is a Timer? Timer is a specialized type of device that is used to measure timing intervals. Timers can.
Hakim Weatherspoon CS 3410 Computer Science Cornell University
Presentation transcript:

Flip-flops, Latches and State Prof. Sirer COMP 303 Koç University

Early Transistors The first transistor, on a workbench at AT&T Bell Laboratories in 1947

Logic Gates One can buy gates separately ex. 74xxx series of integrated circuits cost ~$1 per chip, mostly for packaging and testing Cumbersome, but possible to build devices using gates put together manually

Integrated Circuits Or one can manufacture a complete design using a custom mask An Intel Pentium has approximately 125 million transistors

Special-Purpose Transistors A photo-sensitive transistor can be used to detect the presence of light Photo-sensitive material triggers the gate

Recap We have enough tools in our arsenal to start build interesting devices Let’s build a Scantron device Background: A vote is recorded on a piece of paper, by punching out a hole, there are at most 7 choices we will not worry about “hanging chads” or “invalids” For now, let’s just display the numerical identifier to the ballot supervisor we won’t do counting yet, just decoding we can use four photo-sensitive transistors to find out which hole is punched out

Ballot Reading All we want to do is go from a paper with a hole in it to a number the ballot supervisor can record Ballots The super-duper COMP303 vote decoding machine

Demultiplexors/Encoders N sensors in a row We want to distinguish which sensor of the N sensors has fired Want to represent the firing sensor number in compact form N might be large, I want to sell this device to Italy Only one wire is on at any time Silly to route N wires everywhere, better to encode in log N wires a b o0o0 1 c d o1o1 A 3-bit (7-to-3) encoder (4 inputs shown) o2o2

Number Representations Decimal numbers are written in base 10 3 x x 10 0 = 37 Can just as easily use other bases Base 2 - “Binary” Base 8 - “Octal” Base 16 – “Hexadecimal” Base conversion via repetitive division Divide by base, write remainder, move left with quotient Sanity check with 37 and

Binary Representation =

Hexadecimal Representation 37 decimal = (25) 16 Convention Base 16 is written with a leading 0x 37 = 0x25 Need extra digits! 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, A, B, C, D, E, F Binary to hexadecimal is easy Divide into groups of 4, translate groupwise into hex digits

Encoder Truth Table a b 1 c d o1o1 A 3-bit encoder with 4 inputs for simplicity abcdo2o1o o0o0 o1o1 o2o2 o2 = abcd o1 = abcd + abcd o0 = abcd + abcd

Ballot Reading Ok, we built first half of the machine Need to display the result Ballots The super-duper COMP303 vote decoding machine

7-Segment LED Decoder 4 inputs encoded in binary 8 outputs, each driving an independent, rectangular LED Can display numbers Just a simple logic circuit Write the truth table

7-Segment LED Decoder 4 inputs encoded in binary 8 outputs, each driving an independent, rectangular LED Can display numbers

7-Segment LED Decoder 4 inputs encoded in binary 8 outputs, each driving an independent, rectangular LED Can display numbers

7-Segment Decoder Truth Table i3i3 i2i2 i1i1 i0i0 o0o0 o1o1 o2o2 o3o3 o4o4 o5o5 o6o o0o0 o1o1 o2o2 o3o3 o4o4 o5o5 o6o6 Exercise: find the error(s) in this truth table

7-Segment Decoder Truth Table i3i3 i2i2 i1i1 i0i0 o0o0 o1o1 o2o2 o3o3 o4o4 o5o5 o6o o0o0 o1o1 o2o2 o3o3 o4o4 o5o5 o6o6

Ballot Reading Done! Off to the patent office! Ballots The super-duper COMP303 vote decoding machine

Keyboard Let’s build a keyboard Lots of mechanical switches Need to convert to a compact form (binary) We’ll use a special mechanical switch that, when pressed, connects two wires simultaneously

Keyboard When a key is pressed, a 7-bit key identifier is computed + 3-bit encoder (4 to 3) 4-bit encoder (16 to 4) not all 16 wires are shown

Stateful Components Everything we did until now is combinatorial logic Output is computed when inputs are present The system has no internal state Nothing computed in the present can depend on what happened in the past! Need a way to record data Need a way to build stateful circuits Need a state-holding device

Bistable Devices In stable state, A = B How do we change the state? A B A B 1 A B A Simple Device

SR Latch Set-Reset (S-R) Latch Q: Stored value and its complement S=1 and R=1 ? S R Q Q SRQQ 00QQ ??

D Latch Data Latch Easier to use than an SR latch No possibility of entering an undefined state When D changes, Q changes  … immediately Need to control when the output changes S R Q Q D

Clocks Clocks help with modifying the contents of state-holding elements A free running signal Generated by an oscillating crystal Clock signal has a fixed cycle time (aka cycle period) Clock frequency = 1/cycle time clock period clock high clock low 1 0 falling edge rising edge

Edge-triggering Can design circuits to change on the rising or falling edge Trigger on rising edge = positive edge-triggered Trigger on falling edge = negative edge-triggered Inputs must be stable just before the triggering edge input clock

First Attempt How does the output behave? S R D clk D Q Q Q Q DQ Q

First Attempt How does the output behave? S R D clk Q Q D Q

First Attempt How does the output behave? Changes in D that occur when the clock is low are deferred until clock high Changes when clock is high are registered immediately S R D clk D Q Q Q Q DQ Q

Master-Slave Flip-Flop Outputs change only on falling edges Data is captured on rising edges 1/2 cycle delay but works out perfectly – data for the next stage is ready 1/2 cycle ahead of time DQ Q DQ Q clk D X Q X

Keyboard When a key is pressed, a 7-bit key identifier is computed Let’s store this keycode The computer may not be ready to read it right away + 3-bit encoder (4 to 3) 4-bit encoder (16 to 4) not all 16 wires are shown

Registers A register is simply a set of master-slave flip-flops in parallel with a shared clock DQDQ DQDQ DQDQ DQDQ clk D0 D3 D1 D bit reg

One-Shot A simple device that, when triggered, produces a pulse of the specified width in one shot X ms out in out X ms

Keyboard with Last Key Display + 3-bit encoder (4 to 3) 4-bit encoder (16 to 4) not all 16 wires are shown 4-bit reg 7 seg deco 7 seg deco 4-bit reg one-shot 1ms

Summary We can now build interesting devices with sensors Using combinatorial logic We can also store data values In state-holding elements Coupled with clocks