Lecture 24 Logistics Last lecture Today HW7 back today

Slides:



Advertisements
Similar presentations
ENGIN112 L23: Finite State Machine Design Procedure October 27, 2003 ENGIN 112 Intro to Electrical and Computer Engineering Lecture 23 Finite State Machine.
Advertisements

Chapter #8: Finite State Machine Design Contemporary Logic Design
FSM Word Problems Today:
Sequential logic examples
Chapter #10: Finite State Machine Implementation
Implementation Strategies
State-machine structure (Mealy)
No. 9-1 Chapter #9: Finite State Machine Optimization.
CS 151 Digital Systems Design Lecture 25 State Reduction and Assignment.
Modern VLSI Design 2e: Chapter 5 Copyright  1998 Prentice Hall PTR Topics n Sequential machine implementation: –clocking. n Sequential machine design.
ECE C03 Lecture 111 Lecture 11 Finite State Machine Optimization Hai Zhou ECE 303 Advanced Digital Design Spring 2002.
ECE C03 Lecture 101 Lecture 10 Finite State Machine Design Hai Zhou ECE 303 Advanced Digital Design Spring 2002.
Contemporary Logic Design Finite State Machine Design © R.H. Katz Transparency No Chapter #8: Finite State Machine Design 8.5 Finite State Machine.
Give qualifications of instructors: DAP
ECE C03 Lecture 121 Lecture 12 Finite State Machine Design Prith Banerjee ECE C03 Advanced Digital Design Spring 1998.
1 Synchronous Sequential Circuit Design. 2 Sequential circuit design In sequential circuit design, we turn some description into a working circuit – We.
ENGIN112 L25: State Reduction and Assignment October 31, 2003 ENGIN 112 Intro to Electrical and Computer Engineering Lecture 25 State Reduction and Assignment.
Lecture 23 Design example: Traffic light controller.

1 COMP541 State Machines Montek Singh Feb 8, 2012.
ECE C03 Lecture 101 Lecture 10 Finite State Machine Design Hai Zhou ECE 303 Advanced Digital Design Spring 2002.
EE434 ASIC & Digital Systems
Unit 14 Derivation of State Graphs
Chapter #8: Finite State Machine Design
ECNG1014 Digital Electronics
1 Lecture 22 State encoding  One-hot encoding  Output encoding State partitioning.
9-1 Introduction Chapter #9: Finite State Machine Optimization.
1 Lecture 13 Overview of sequential logic  Basic concepts  An example.
DLD Lecture 26 Finite State Machine Design Procedure.
Modern VLSI Design 4e: Chapter 5 Copyright  2008 Wayne Wolf Topics n Sequential machine implementation: –clocking. n Sequential machine design.
Finite State Machines Prof. Sirer COMP 303 Koç University.
IX - Sequential Logic Technology © Copyright 2004, Gaetano Borriello and Randy H. Katz 1 Sequential logic implementation Implementation  random logic.
IX - Sequential Logic TechnologyContemporary Logic Design1 Ch 9. Sequential Logic Technologies.
1 CSE370, Lecture 24 Lecture 26 u Logistics n HW8 due Friday n Ant extra credit due Friday n Final exam a week from today, 12/8 8:30am-10:20am here n Review.
Finite state machine optimization
Sequential Networks and Finite State Machines
Finite state machine optimization
Chapter #8: Finite State Machine Design Contemporary Logic Design Randy H. Katz University of California, Berkeley.
© Copyright 2004, Gaetano Borriello and Randy H. Katz
Lecture 26 Logistics Last lecture Today HW8 due Friday
Lecture 27 Logistics Last lecture Today: HW8 due Friday
COMP541 Sequential Logic – 2: Finite State Machines
Synchronous Sequential Circuit Design
Typical Timing Specifications
ELEC 1041 Digital Electronics Tutorial: Word Problems
Sequential logic examples
Lecture 27 Logistics Last lecture Today: HW8 due Friday
Lecture 13: Sequential Circuits, FSM
Lecture 25 Logistics Last lecture Today HW8 posted today, due 12/5
CSE 370 – Winter Sequential Logic - 1
Lecture 15 Logistics Last lecture Today HW4 is due today
Introduction to Sequential Circuits
CSE 370 – Winter Sequential Logic-2 - 1
Lecture 17 Logistics Last lecture Today HW5 due on Wednesday
Guest Lecture by David Johnston
Lecture 25 Logistics Last lecture Today HW8 posted today, due 12/5
Topics Verilog styles for sequential machines. Flip-flops and latches.
Sequential logic implementation
CSE 370 – Winter Sequential Logic-2 - 1
Lecture 20 Logistics Last lecture Today HW6 due Wednesday
Lecture 23 Logistics Last lecture Today HW8 due Wednesday, March 11
Lecture 17 Logistics Last lecture Today HW5 due on Wednesday
Instructor: Alexander Stoytchev
Lecture 18 Logistics Last Lecture Today HW6 due today Midterm 2
Lecture 18 Logistics Last lecture Today HW5 due today (with extra 10%)
CSE 370 – Winter Introduction -2- 1
Announcements Assignment 7 due now or tommorrow Assignment 8 posted
CSE 370 – Winter Sequential Logic-2 - 1
Implementation Strategies
Lecture 4: Finite State Machines
Presentation transcript:

Lecture 24 Logistics Last lecture Today HW7 back today Midterm2 back today (Average 80/100) Solution on-line this PM HW8 due Wednesday Ant extra credit due Friday Final exam, Wednesday March 18, 2:30-4:20 pm here Review session Monday, March 16, 4:30 pm, here Last lecture State encoding One-hot encoding Output encoding State partitioning Today Encoding & Partitioning examples

State-encoding strategies No guarantee of optimality An intractable problem Most common strategies Binary (sequential) – number states as in the state table Random – computer tries random encodings Heuristic – rules of thumb that seem to work well e.g. Gray-code – try to give adjacent states (states with an arc between them) codes that differ in only one bit position One-hot – use as many state bits as there are states Output – use outputs to help encode states Hybrid – mix of a few different ones (e.g. One-hot + heuristic)

One-hot encoding One-hot: Encode n states using n flip-flops Assign a single “1” for each state Example: 0001, 0010, 0100, 1000 Propagate a single “1” from one flip-flop to the next All other flip-flop outputs are “0” The inverse: One-cold encoding Assign a single “0” for each state Example: 1110, 1101, 1011, 0111 Propagate a single “0” from one flip-flop to the next All other flip-flop outputs are “1” “almost one-hot” encoding (modified one-hot encoding) Use no-hot (000…0) for the initial (reset state) Assumes you never revisit the reset state till reset again.

Another Encoding Example: Digital combination lock An output-encoded FSM Punch in 3 values in sequence and the door opens If there is an error the lock must be reset After the door opens the lock must be reset Inputs: sequence of number values, reset Outputs: door open/close reset value open/closed new clock

Separate data path and control Design datapath first After the state diagram Before the state encoding Control has 2 outputs Mux control to datapath Lock open/closed reset open/closed new C1 C2 C3 comparator value equal multiplexer controller mux control clock 4

Draw the state diagram closed mux=C1 start equal & new not equal & new not new S0 S1 S2 S3 ERR mux=C2 mux=C3 open

Design the datapath Choose simple control 3-wire mux for datapath comparator equal multiplexer mux control 4 value C1i C2i C3i mux control valuei equal Choose simple control 3-wire mux for datapath Control is 001, 010, 100 Open/closed bit for lock state Control is 0/1

Output encode the FSM FSM outputs State are: S0, S1, S2, S3, or ERR Mux control is 100, 010, 001 Lock control is 0/1 State are: S0, S1, S2, S3, or ERR Can use 3, 4, or 5 bits to encode Have 4 outputs, so choose 4 bits Encode mux control and lock control in state bits Lock control is first bit, mux control is last 3 bits S0 = 0001 (lock closed, mux first code) S1 = 0010 (lock closed, mux second code) S2 = 0100 (lock closed, mux third code) S3 = 1000 (lock open) ERR = 0000 (error, lock closed)

FSM has 4 state bits and 2 inputs... Output encoded! Outputs and state bits are the same How do we minimize the logic? FSM has 4 state bits and 2 inputs (equal, new) 6-variable K-map for all five states? Way too complicated Notice the state assignment is close to one-hot ERR state (0000) is only deviation Is there a clever design we can use?

Encode 4 state bits closed mux=C1 start equal & new not equal & new not new S0 S1 S2 S3 ERR mux=C2 mux=C3 open A clever way for ERR is to use both Preset/Clear in existing flipflops. Not equal & new S0+ = S0N’ S1+ = S0EN + S1N’ S2+ = S1EN + S2N’ S3+ = S2EN + S3 Preset0 = start Preset1,2,3 = 0 Reset0 = start’(E’N + (Q0+Q1+Q2+Q3)’) Reset1,2,3 = start + (E’N + (Q0+Q1+Q2+Q3)’) Already in ERR

Reset0 = start’(E’N + (Q0+Q1+Q2+Q3)’) D0 = Q0N’ D1 = Q0EN + Q1N’ D2 = Q1EN + Q2N’ D3 = Q2EN + Q3 S0 E N S1 N’ S1 Preset0 = start Preset1,2,3 = 0 Reset0 = start’(E’N + (Q0+Q1+Q2+Q3)’) Reset1,2,3 = start + (E’N + (Q0+Q1+Q2+Q3)’) S1 E N S2 N’ S2 S0 S1 S2 S3 S2 E N S3

State Partitioning Add idles states to handoff control between machines C1 C2 C3 C4 C5 S1 S3 S2 S6 S4 S5 S1 S6 C1 C1•S1 (C2•S6)’ C2•S6 C2 (C1•S1+ C3•S2+ C4•S3+ C5•S2)’ S2 SA SB C3•S2+ C4•S3 S5 C3+C5 S3 C4 S4 C5•S2

Example: Traffic light controller Highway/farm road intersection farm road car sensors highway

Example: traffic light controller A busy highway is intersected by a little used farm road Detectors C sense the presence of cars waiting on the farm road with no car on farm road, lights remain Green in highway direction if vehicle on farm road, highway lights go from Green to Yellow to Red, allowing the farm road lights to become Green these stay Green only as long as a farm road car is detected but never longer than a set interval when these are met, farm lights transition from Green to Yellow to Red, allowing highway to return to Green even if farm road vehicles are waiting, highway gets at least a set interval as Green

Example: traffic light controller Assume you have an interval timer that in response to a set (ST) signal generates both: a short time pulse (TS) and a long time pulse (TL) TS is to be used for timing yellow lights and TL for green lights Interval Timer Traffic Light Controller ST TL TS ST TS TL short long

Example: traffic light controller Inputs Description reset place FSM in initial state C detect vehicle on the farm road TS short time interval expired TL long time interval expired Outputs Description HG, HY, HR assert green/yellow/red highway lights FG, FY, FR assert green/yellow/red farm road lights ST start timing a short or long interval States – some light configurations imply others State Description HG highway green (farm road red) HY highway yellow (farm road red) FG farm road green (highway red) FY farm road yellow (highway red)

Example: traffic light controller reset C HG HY HR ST Traffic Light Controller Interval Timer TS TL FG FY FR

Example: traffic light controller State diagram Reset Outputs not shown: FR=HG+HY HR=FG+FY (TL•C)' HG TL•C / ST TS / ST HY FY TS' TS' TS / ST TL+C' / ST FG (TL+C')'

Example: State Partitioning TS / ST Reset TL•C / ST TS' HY (TL•C)' HG TS / ST (TL+C')' TL+C' / ST FG FY TS'

State partitioning for traffic light controller Reset TL•C / ST TS' HY (TL•C)' HG Add idle states Add return arcs Label idle wait loops TS•FY (TS•HY)’ FR Reset TS / ST HR TS / ST FY TS' (TS•FY)’ TS•HY TL+C' / ST FG (TL+C')'

Minimize communication between partitions Ideal world: Two machines handoff control Separate I/O, states, etc. Real world: Minimize handoffs and common I/O Minimize number of state bits that cross boundary Merge common outputs Look for: Disjoint inputs used in different regions of state diagram Outputs active in only one region of state diagram Isomorphic portions of state diagram Add states, if necessary, to make them so Regions of diagram with a single entry and single exit point

FSM design: A multi-step process 1. Understand the problem – State diagram and state-transition table 2. Determine the machine’s states – Consider missing transitions: Will the machine start? – Minimize the state diagram: Reuse states where possible 3. Encode the states – Encode states, outputs with a reasonable encoding choice – Consider the implementation target 4. Design the next-state logic – Minimize the combinational logic – Choices made in steps 2 & 3 affect the logic complexity 5. Implement the FSM