Lecture 23 Design example: Traffic light controller.

Slides:



Advertisements
Similar presentations
Chapter #8: Finite State Machine Design Contemporary Logic Design
Advertisements

FSM Word Problems Today:
Traffic light contoller using FSM
Sequential logic examples
Chapter #10: Finite State Machine Implementation
Implementation Strategies
Lecture 22: Sequential Circuits Today’s topic –Clocks and sequential circuits –Finite state machines 1.
FSMs 1 Computer Organization I September 2009 © McQuain, Feng & Ribbens Motivation Combinational logic functions can be represented, and defined,
No. 9-1 Chapter #9: Finite State Machine Optimization.
ECE 331 – Digital System Design
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.
ECE C03 Lecture 121 Lecture 12 Finite State Machine Design Prith Banerjee ECE C03 Advanced Digital Design Spring 1998.
1 Lecture 14: FSM and Basic CPU Design Today’s topics:  Finite state machines  Single-cycle CPU Reminder: midterm on Tue 10/24  will cover Chapters.
1 Synchronous Sequential Circuit Design. 2 Sequential circuit design In sequential circuit design, we turn some description into a working circuit – We.
Lecture #5 In this lecture we will introduce the sequential circuits.
FPGA-Based System Design: Chapter 5 Copyright  2004 Prentice Hall PTR Verilog for sequential machines.
Lecture 17 General finite state machine (FSM) design
11/10/ :53:59 AMweek12-3.ppt1 Intelligent Traffic Controller We want to use a finite state machine to control the traffic lights at an intersection.

1 COMP541 State Machines Montek Singh Feb 8, 2012.
FPGA-Based System Design: Chapter 5 Copyright  2004 Prentice Hall PTR Topics n Verilog styles for sequential machines. n Flip-flops and latches.
ECE C03 Lecture 101 Lecture 10 Finite State Machine Design Hai Zhou ECE 303 Advanced Digital Design Spring 2002.
EE434 ASIC & Digital Systems
Chapter #8: Finite State Machine Design
Chapter #8: Finite State Machine Design
ECNG1014 Digital Electronics
Lecture 18 More Moore/Mealy machines.
1 Lecture 22 State encoding  One-hot encoding  Output encoding State partitioning.
1 CSE370, Lecture 19 Lecture 19 u Logistics n Lab 8 this week to be done in pairs íFind a partner before your lab period íOtherwise you will have to wait.
Lab7-1 Lab 6: FSM Description Separate combinational and memory circuits –State memory uses FFs –Others are combinational circuits.
Module : FSM Topic : types of FSM. Two types of FSM The instant of transition from the present to the next can be completely controlled by a clock; additionally,
9-1 Introduction Chapter #9: Finite State Machine Optimization.
1 CSE370, Lecture 18 Lecture 20 u Logistics n HW6 due Wednesday n Lab 7 this week (Tuesday exception) n Midterm 2 Friday (covers material up to simple.
Lecture 5. Sequential Logic 2 Prof. Taeweon Suh Computer Science Education Korea University 2010 R&E Computer System Education & Research.
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 COMP541 Finite State Machines - 1 Montek Singh Sep 22, 2014.
Finite State Machine. Clock Clock cycle Sequential circuit Digital logic systems can be classified as combinational or sequential. – Combinational circuits.
1 COMP541 Sequential Logic – 2: Finite State Machines Montek Singh Feb 29, 2016.
1 Lecture 13: Sequential Circuits, FSM Today’s topics:  Sequential circuits  Finite state machines  Single-cycle CPU Reminder: midterm on Tue 10/20.
Finite State Machines Mealy machine inputs Outputs next state function
Project 2: Ultra Traffic Light Controller
Finite state machine optimization
Sequential Networks and Finite State Machines
Lecture 4. Sequential Logic #2
Finite state machine optimization
Chapter #8: Finite State Machine Design Contemporary Logic Design Randy H. Katz University of California, Berkeley.
ECEN 248 Lab 9: Design of a Traffic Light Controller
Synchronous Sequential Circuit Design
Sequential logic examples
Lecture 13: Sequential Circuits, FSM
State Diagrams.
Lecture 17 Logistics Last lecture Today HW5 due on Wednesday
Topics Verilog styles for sequential machines. Flip-flops and latches.
Sequential logic implementation
CSE 370 – Winter Sequential Logic-2 - 1
Lecture 24 Logistics Last lecture Today HW7 back today
Lecture 20 Logistics Last lecture Today HW6 due Wednesday
Lecture 17 Logistics Last lecture Today HW5 due on Wednesday
CSE 140 Lecture 9 Sequential Networks
Lecture 22 Logistics Last lecture Today HW7 is due on Friday
Lecture 22 Logistics Last lecture Today HW7 is due on Friday
Announcements Assignment 7 due now or tommorrow Assignment 8 posted
Implementation Strategies
Presentation transcript:

Lecture 23 Design example: Traffic light controller

FSM design 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

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

Example: Traffic light controller A busy highway is intersected by a little used farm road Detectors C sense the presence of cars 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 (say, 20 time units) 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 (say, 20 time units)

What are inputs and outputs? Reset C (farm road car detector) Outputs HG (highway green) HY (highway yellow) HR (highway red) FG (farm road green) FY (farm road yellow) FR (farm road red)

What are the states? How about color of the lights? HG (highway green) HY (highway yellow) HR (highway red) FG (farm road green) FY (farm road yellow) FR (farm road red)

Any redundancy? If the highway light is green or yellow, the farm road light must be red. States HG (highway green) HY (highway yellow) FG (farm road green) FY (farm road yellow)

Partial traffic light controller Useful to walk through typical execution sequence What's the problem? HG HY0 HY1 HY2 HY3 HY4 C C'

FSM can get very big! Utilize external timer like a subroutine HG HYb TL·C HG HYa [ST] HYb TS FG [ST] (TL·C)' TS'

Traffic Light Controller External timer ST resets timer and starts counting Timer generates 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 short long

Revised FSM specification Inputs reset place FSM in initial state C detect vehicle on the farm road TS short time interval expired TL long time interval expired Outputs 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 State HG highway green (farm road red) HY highway yellow (farm road red) FG farm road green (highway red) FY farm road yellow (highway red)

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

Moore/Mealy hybrid Reset (TL•C)' HG TL•C / ST TS / ST HY FY TS' TS' FG (TL+C')'

State encoding Let's use a one-hot encoding: HG = 0001 HY = 0010 FG = 0100 FY = 1000

Next-state logic P3 = (C'·Q2) + (TL·Q2) + (TS'·Q3) P2 = (TS·Q1) + (C·TL'·Q2) P1 = (C·TL·Q0) + (TS'·Q1) P0 = (C'·Q0) + (TL'·Q0) + (TS·Q3) ST = (C·TL·Q0) + (TS·Q1) + (C'·Q2) + (TL·Q2) + (TS·Q3)

Outputs Green = 00 Yellow = 01 Red = 10 Two sets of outputs: H1H0 and F1F0 H1 = Q3 + Q2 H0 = Q1 F1 = Q1 + Q0 F0 = Q3

State partitioning TS / ST Reset TL•C / ST TS' HY (TL•C)' HG TS / ST FG FY TS'

State partitioning Add idle states Add return arcs 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')'