Presentation is loading. Please wait.

Presentation is loading. Please wait.

FSMs 1 Computer Organization I September 2009 ©2006-09 McQuain, Feng & Ribbens Motivation Combinational logic functions can be represented, and defined,

Similar presentations


Presentation on theme: "FSMs 1 Computer Organization I September 2009 ©2006-09 McQuain, Feng & Ribbens Motivation Combinational logic functions can be represented, and defined,"— Presentation transcript:

1 FSMs 1 Computer Organization I CS@VT September 2009 ©2006-09 McQuain, Feng & Ribbens Motivation Combinational logic functions can be represented, and defined, by truth tables. Sequential logic function cannot, because their behavior depends upon both the state of their inputs and their current state. Implementing the control logic for a CPU will require using sequential logic functions, and we need a tool to express and model those functions mathematically.

2 FSMs 2 Computer Organization I CS@VT September 2009 ©2006-09 McQuain, Feng & Ribbens Finite State Machine A finite state machine (FSM) is… -a finite set of states Q = {S 0, S 1,..., S N }, and -a set of possible input values I = {i 0, i 1,..., i K }, and -a set of possible output values O = {o 0, o 1,..., o M }, and -a next state function F:QxI  S, and -an output function G:QxI  O The next state function maps the current inputs and the current state the next state of the FSM. The output function maps the current state and possibly the current inputs to a set of asserted outputs.

3 FSMs 3 Computer Organization I CS@VT September 2009 ©2006-09 McQuain, Feng & Ribbens Simple Example E O start halt 1 1 0 0 end/E end/O Here's a simple FSM representing a basic digital function. We have: Q= {E, O} I= {0, 1, end} O= {'E', 'O'} What's the next state function? What does it DO? Current StateInputNext StateOutput E0E E1O Eendhalt'E' O0O O1E Oendhalt'O'

4 FSMs 4 Computer Organization I CS@VT September 2009 ©2006-09 McQuain, Feng & Ribbens Traffic Light Controller Consider a traffic light (red/green only) at an intersection of a north-south street with an east-west street; there are two input signals: NScar: Indicates that a car is over the detector placed in the roadbed in front of the light on the north- south road (going north or south). EWcar: Indicates that a car is over the detector placed in the roadbed in front of the light on the east-west road (going east or west). The traffic light should change from one direction to the other only if a car is waiting to go in the other direction; otherwise the light should continue to show green in the same direction as the last car that crossed the intersection.

5 FSMs 5 Computer Organization I CS@VT September 2009 ©2006-09 McQuain, Feng & Ribbens Traffic Light Controller Output Signals There are two output signals: NSlite: When this signal is asserted (1), the light on the north-south road is green; when this signal is deasserted (0), the light on the north-south road is red. Arguably, it is acceptable if both output signals are deasserted at the same time, but clearly they must never both be asserted at the same time. EWlite: When this signal is asserted (1), the light on the east-west road is green; when this signal is deasserted (0), the light on the east-west road is red.

6 FSMs 6 Computer Organization I CS@VT September 2009 ©2006-09 McQuain, Feng & Ribbens Traffic Light Controller States We need two states: NSgreen: the traffic light is green in the north-south direction Arguably, it is acceptable if both output signals are deasserted at the same time, but clearly they must never both be asserted at the same time. EWgreen: the traffic light is green in the east-west direction

7 FSMs 7 Computer Organization I CS@VT September 2009 ©2006-09 McQuain, Feng & Ribbens TL Controller Next-State & Output Fns

8 FSMs 8 Computer Organization I CS@VT September 2009 ©2006-09 McQuain, Feng & Ribbens TL Controller Schematic

9 FSMs 9 Computer Organization I CS@VT September 2009 ©2006-09 McQuain, Feng & Ribbens TL Controller Next-State Analysis Let's represent the states NSGreen and EWGreen by 0 and 1, respectively. Then:

10 FSMs 10 Computer Organization I CS@VT September 2009 ©2006-09 McQuain, Feng & Ribbens TL Controller Output Analysis

11 FSMs 11 Computer Organization I CS@VT September 2009 ©2006-09 McQuain, Feng & Ribbens TL Controller Implementation

12 FSMs 12 Computer Organization I CS@VT September 2009 ©2006-09 McQuain, Feng & Ribbens Relationship to Hardware Common design issues in hardware control can be efficiently represented and analyzed using FSMs.


Download ppt "FSMs 1 Computer Organization I September 2009 ©2006-09 McQuain, Feng & Ribbens Motivation Combinational logic functions can be represented, and defined,"

Similar presentations


Ads by Google