Prof. Hakim Weatherspoon CS 3410, Spring 2015 Computer Science Cornell University See P&H Appendix B.7. B.8, B.10, B.11.

Slides:



Advertisements
Similar presentations
Lab 2: Finite State Machines CS 3410 Spring 2015.
Advertisements

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.
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.
1 Lecture 14 Memory storage elements  Latches  Flip-flops State Diagrams.
Digital Design - Sequential Logic Design Chapter 3 - Sequential Logic Design.
ECE 331 – Digital System Design Latches and Flip-Flops (Lecture #17) The slides included herein were taken from the materials accompanying Fundamentals.
Classification of Digital Circuits  Combinational. Output depends only on current input values.  Sequential. Output depends on current input values and.
CPS3340 COMPUTER ARCHITECTURE Fall Semester, /23/2013 Lecture 7: Computer Clock & Memory Elements Instructor: Ashraf Yaseen DEPARTMENT OF MATH &
Sequential Circuits1 DIGITAL LOGIC DESIGN by Dr. Fenghui Yao Tennessee State University Department of Computer Science Nashville, TN.
Multiplexors Sequential Circuits and Finite State Machines Prof. Sin-Min Lee Department of Computer Science.
Circuits require memory to store intermediate data
State and Finite State Machines
Sequential Circuit Analysis & Design Dr. Aiman H. El-Maleh Computer Engineering Department King Fahd University of Petroleum & Minerals Dr. Aiman H. El-Maleh.
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.
Hakim Weatherspoon CS 3410, Spring 2011 Computer Science Cornell University Memory See: P&H Appendix C.8, C.9.
ECE 331 – Digital System Design Introduction to and Analysis of Sequential Logic Circuits (Lecture #20) The slides included herein were taken from the.
ENGIN112 L20: Sequential Circuits: Flip flops October 20, 2003 ENGIN 112 Intro to Electrical and Computer Engineering Lecture 20 Sequential Circuits: Flip.
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.
ENEE 408C Lab Capstone Project: Digital System Design Fall 2005 Sequential Circuit Design.
ECE 301 – Digital Electronics Introduction to Sequential Logic Circuits (aka. Finite State Machines) and FSM Analysis (Lecture #17)
COMPUTER ARCHITECTURE & OPERATIONS I Instructor: Hao Ji.
ECE 331 – Digital Systems Design Introduction to Sequential Logic Circuits (aka. Finite State Machines) and FSM Analysis (Lecture #19)
CS61C L15 Synchronous Digital Systems (1) Beamer, Summer 2007 © UCB Scott Beamer, Instructor inst.eecs.berkeley.edu/~cs61c CS61C : Machine Structures Lecture.
Fall 2007 L16: Memory Elements LECTURE 16: Clocks Sequential circuit design The basic memory element: a latch Flip Flops.
1 Sequential Circuits Registers and Counters. 2 Master Slave Flip Flops.
Prof. Hakim Weatherspoon CS 3410, Spring 2015 Computer Science Cornell University See: P&H Chapter 2.4, 3.2, B.2, B.5, B.6.
1 CSE370, Lecture 14 Lecture 14 u Logistics n Midterm 1: Average 90/100. Well done! n Midterm solutions online n HW5 due date delayed until this Friday.
Lecture 10 Topics: Sequential circuits Basic concepts Clocks
Prof. Hakim Weatherspoon CS 3410, Spring 2015 Computer Science Cornell University See P&H Appendix B.8 (register files) and B.9.
COE 202: Digital Logic Design Sequential Circuits Part 1
1 COMP541 State Machines Montek Singh Feb 8, 2012.
Flip-flops, Latches and State Prof. Sirer COMP 303 Koç University.
Sequential Logic Materials taken from: Digital Design and Computer Architecture by David and Sarah Harris & The Essentials of Computer Organization and.
Prof. Hakim Weatherspoon CS 3410, Spring 2015 Computer Science Cornell University See P&H Chapter: , 1.6, Appendix B.
Hakim Weatherspoon CS 3410, Spring 2012 Computer Science Cornell University Memory See: P&H Appendix C.8, C.9.
Memory Hakim Weatherspoon CS 3410, Spring 2013 Computer Science Cornell University.
Sequential Circuits. Two primary differences between combinational circuits and sequential circuits –Sequential circuits are synchronous (use a clock)
1 CSE370, Lecture 15 Lecture 15 u Logistics n HW5 due this Friday n HW6 out today, due Friday Feb 20 n I will be away Friday, so no office hour n Bruce.
1 CSE370, Lecture 17 Lecture 17 u Logistics n Lab 7 this week n HW6 is due Friday n Office Hours íMine: Friday 10:00-11:00 as usual íSara: Thursday 2:30-3:20.
Introduction to Sequential Logic Design Bistable elements.
Computer Architecture and Organization Unit -1. Digital Logic Circuits – Logic Gates – Boolean Algebra – Map Simplification – Combinational Circuits –
Finite State Machines Prof. Sirer COMP 303 Koç University.
Synchronous Sequential Logic A digital system has combinational logic as well as sequential logic. The latter includes storage elements. feedback path.
Lecture 5. Sequential Logic 1 Prof. Taeweon Suh Computer Science Education Korea University 2010 R&E Computer System Education & Research.
Numbers and Arithmetic Hakim Weatherspoon CS 3410, Spring 2013 Computer Science Cornell University See: P&H Chapter , 3.2, C.5 – C.6.
© 2009 Pearson Education, Upper Saddle River, NJ All Rights ReservedFloyd, Digital Fundamentals, 10 th ed Digital Logic Design Dr. Oliver Faust.
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.
Chapter #6: Sequential Logic Design
Computer Architecture & Operations I
State & Finite State Machines
Digital Design Lecture 9
Dr. Clincy Professor of CS
Assistant Prof. Fareena Saqib Florida Institute of Technology
ECE Digital logic Lecture 16: Synchronous Sequential Logic
CS Fall 2005 – Lec. #5 – Sequential Logic - 1
Hakim Weatherspoon CS 3410 Computer Science Cornell University
Hakim Weatherspoon CS 3410 Computer Science Cornell University
Instructor: Alexander Stoytchev
Dr. Clincy Professor of CS
CSE 370 – Winter Sequential Logic - 1
CSE 370 – Winter Sequential Logic-2 - 1
Lecture 17 Logistics Last lecture Today HW5 due on Wednesday
Lecture 17 Logistics Last lecture Today HW5 due on Wednesday
SEQUENTIAL CIRCUITS __________________________________________________
Hakim Weatherspoon CS 3410 Computer Science Cornell University
Presentation transcript:

Prof. Hakim Weatherspoon CS 3410, Spring 2015 Computer Science Cornell University See P&H Appendix B.7. B.8, B.10, B.11

Make sure you are Registered for class, can access CMS Have a Section you can go to. Lab Sections are required. “Make up” lab sections only 8:40am Wed, Thur, or Fri Bring laptop to Labs Project partners are required for projects. Have project partner in same Lab Section, if possible HW1 and Lab1 available today, after lecture Do HW1 problems with lecture, i.e. finish part1 and 2 this week Work alone on both But, use your resources ₋Lab Section, Piazza.com, Office Hours, Homework Help Session, ₋Class notes, book, Sections, CSUGLab

Make sure to go to your Lab Section this week Completed Lab1 due before winter break, Friday, Feb 13th Note, a Design Document is due when you submit Lab1 final circuit Work alone Homework1 is out Due a week before prelim1, Monday, February 23rd Work on problems incrementally, as we cover them in lecture Office Hours for help Work alone Work alone, BUT use your resources Lab Section, Piazza.com, Office Hours Class notes, book, Sections, CSUGLab

Check online syllabus/schedule Slides and Reading for lectures Office Hours Pictures of all TAs Homework and Programming Assignments Dates to keep in Mind Prelims: Tue Mar 3rd and Thur April 30th Lab 1: Due next Friday, Feb 13th before Winter break Proj2: Due Thur Mar 26th before Spring break Final Project: Due when final would be (not known until Feb 14th) Schedule is subject to change

“Black Board” Collaboration Policy Can discuss approach together on a “black board” Leave and write up solution independently Do not copy solutions Late Policy Each person has a total of four “slip days” Max of two slip days for any individual assignment Slip days deducted first for any late assignment, cannot selectively apply slip days For projects, slip days are deducted from all partners 25% deducted per day late after slip days are exhausted Regrade policy Submit written request to lead TA, and lead TA will pick a different grader Submit another written request, lead TA will regrade directly Submit yet another written request for professor to regrade.

Until now is combinationial logic Output is computed when inputs are present 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 Finite State Machines Inputs Combinational circuit Outputs N M

State How do we store one bit? Attempts at storing (and changing) one bit –Set-Reset Latch –D Latch –D Flip-Flops –Master-Slave Flip-Flops Register: storing more than one bit, N-bits Basic Building Blocks Decoders and Encoders Finite State Machines (FSM) How do we design logic circuits with state? Types of FSMs: Mealy and Moore Machines Examples: Serial Adder and a Digital Door Lock

How do we store store one bit?

B A C

A B A Simple Device Stable and unstable equilibria?

B R Q A S

Set-Reset (S-R) Latch Stores a value Q and its complement SRQ S R Q ABORNOR

Set-Reset (S-R) Latch Stores a value Q and its complement S R Q S R Q SRQ

Set-Reset (SR) Latch can store one bit and we can change the value of the stored bit. But, SR Latch has a forbidden state.

How do we avoid the forbidden state of S-R Latch?

Fill in the truth table? D S R Q Q D DQ 0 1 S R Q ABORNOR

Set-Reset (SR) Latch can store one bit and we can change the value of the stored bit. But, SR Latch has a forbidden state. (Unclocked) D Latch can store and change a bit like an SR Latch while avoiding the forbidden state.

How do we coordinate state changes to a D Latch?

Clock helps coordinate state changes Usually generated by an oscillating crystal Fixed period; frequency = 1/period 1 0 clock period clock high clock low rising edge falling edge

Level sensitive State changes when clock is high (or low) Edge triggered State changes at clock edge positive edge-triggered negative edge-triggered

Clock Methodology Negative edge, synchronous –Edge-Triggered: Signals must be stable near falling clock edge Positive edge synchronous clk computesave t setup t hold computesavecompute t combinational

S R D Q

S R D clk Q DQ Fill in the truth table

clkDQ S R D Q SRQ 00 Q hold reset set 11 forbidden clkDQ Fill in the truth table

S R D clk Q D Q Level Sensitive D Latch Clock high: set/reset (according to D) Clock low: keep state (ignore D) clkDQ Fill output signal for Q

D Flip-Flop Edge-Triggered Data captured when clock is high Output changes only on falling edges DQDQ LL clk D X Q c X c Q D Activity#1: Fill in timing graph and values for X and Q

Set-Reset (SR) Latch can store one bit and we can change the value of the stored bit. But, SR Latch has a forbidden state. (Unclocked) D Latch can store and change a bit like an SR Latch while avoiding a forbidden state. An Edge-Triggered D Flip-Flip (aka Master-Slave D Flip- Flip) stores one bit. The bit can be changed in a synchronized fashion on the edge of a clock signal.

How do we store more than one bit, N bits?

Register D flip-flops in parallel shared clock extra clocked inputs: write_enable, reset, … clk D0 D3 D1 D bit reg clk

Set-Reset (SR) Latch can store one bit and we can change the value of the stored bit. But, SR Latch has a forbidden state. (Unclocked) D Latch can store and change a bit like an SR Latch while avoiding a forbidden state. An Edge-Triggered D Flip-Flip (aka Master-Slave D Flip- Flip) stores one bit. The bit can be changed in a synchronized fashion on the edge of a clock signal. An N-bit register stores N-bits. It is be created with N D-Flip-Flops in parallel along with a shared clock.

4-bit reg Clk Decoder

7-Segment LED photons emitted when electrons fall into holes d7d6 d5d4 d3d2 d1d0

3 inputs encode 0 – 7 in binary 7 outputs one for each LED 7LED decode

b2b1b0d6d5d4d3d2d1d d1 d2 d3 d4 d5 d6 b2b1b0d6d5d4d3d2d1d

d1 d2 d3 d4 d5 d6 b2b1b0d6d5d4d3d2d1d

binary encoder 2N2N N binary decoder N 2N2N Multiplexor N M N N N N M -1

encoder N... Log 2 (N) outputs wires N Input wires e.g. Voting: Can only vote for one out of N candidates, so N inputs. But can encode vote efficiently with binary encoding.

a b 1 c d o1o1 A 3-bit encoder with 4 inputs for simplicity abcd o0o0 o1o1 o2o2

Ballots The 3410 optical scan vote reader machine detect enc LED decode

We can now build interesting devices with sensors Using combinationial logic We can also store data values (aka Sequential Logic) In state-holding elements Coupled with clocks

State How do we store one bit? Attempts at storing (and changing) one bit –Set-Reset Latch –D Latch –D Flip-Flops –Master-Slave Flip-Flops Register: storing more than one bit, N-bits Basic Building Blocks Decoders and Encoders Finite State Machines (FSM) How do we design logic circuits with state? Types of FSMs: Mealy and Moore Machines Examples: Serial Adder and a Digital Door Lock

How do we design logic circuits with state?

An electronic machine which has external inputs externally visible outputs internal state Output and next state depend on inputs current state

Machine is M = ( S, I, O,  ) S:Finite set of states I:Finite set of inputs O:Finite set of outputs  :State transition function Next state depends on present input and present state

Finite State Machine inputs from external world outputs to external world internal state combinational logic Next State Current State Input Output Registers Comb. Logic

Legend state input/output start state A B CD down/on up/off down/on down/off up/off down/off up/off Input: up or down Output: on or off States: A, B, C, or D

Legend state input/output start state A B CD down/on up/off down/on down/off up/off down/off up/off Input: = up or = down Output: = on or = off States: = A, = B, = C, or = D

Legend S1S0S1S0 i0i1i2…/o0o1o2…i0i1i2…/o0o1o2… S1S0S1S /11/1 0/00/0 1/11/1 1/01/0 0/00/0 1/01/0 0/00/0 0/00/0 Input: 0=up or 1=down Output: 1=on or 0=off States: 00=A, 01=B, 10=C, or 11=D

General Case: Mealy Machine Outputs and next state depend on both current state and input Next State Current State Input Output Registers Comb. Logic

Special Case: Moore Machine Outputs depend only on current state Next State Current State Input Output Registers Comb. Logic

Legend state out input start out A off B on C off D off down up down up down up Input: up or down Output: on or off States: A, B, C, or D

Legend state input/output start state A B CD down/on up/off down/on down/off up/off down/off up/off Input: up or down Output: on or off States: A, B, C, or D

Add two infinite input bit streams streams are sent with least-significant-bit (lsb) first How many states are needed to represent FSM? Draw and Fill in FSM diagram …10110 …01111 …00101 Strategy: (1) Draw a state diagram (e.g. Mealy Machine) (2) Write output and next-state tables (3) Encode states, inputs, and outputs as bits (4) Determine logic equations for next state and outputs

states: Inputs: ??? and ??? Output: ???. …10110 …01111 …00101

states: Inputs: ??? and ??? Output: ???. S0 S1 __/_ …10110 …01111 …00101

?? Current state ? Next state (2) Write down all input and state combinations S0 S1 __/_

?? Current state ? Next state (3) Encode states, inputs, and outputs as bits S0 S1 __/_

?? Current state ? Next state (4) Determine logic equations for next state and outputs

We can now build interesting devices with sensors Using combinational logic We can also store data values Stateful circuit elements (D Flip Flops, Registers, …) Clock to synchronize state changes State Machines or Ad-Hoc Circuits