Beruflich Dokumente
Kultur Dokumente
Lecture 13
Lecture 13
Page 2
The set of states correspond to all the possible values of the internal storage.
n bits of storage results in 2n states.
next-state function - a combinatorial function that, given the inputs and the current state, determines the next state of the system. output function - produces a set of outputs from the current state and the inputs.
Lecture 13 52.139 Computer Organisation and Design Page 3
Output function
Outputs
A state machine consists of internal storage that contains the state and two combinatorial functions: the next-state function and the output function
Lecture 13 52.139 Computer Organisation and Design Page 4
Mealy machine
Where the output function of the FSM depends on both the current state and the current input May be smaller
These two machines are equivalent in their capabilities and one can easily be transformed into the other.
Lecture 13 52.139 Computer Organisation and Design Page 5
Rules: 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 junction.
Lecture 13 52.139 Computer Organisation and Design Page 7
Lecture 13
Page 8
Next State NSGreen EWGreen NSGreen EWGreen EWGreen EWGreen NSGreen NSGreen
Page 9
Lecture 13
Page 10
FSM - Implementation
State assignment - State numbers must be assigned to states. For example
NSgreen is assigned to state 0 and EWgreen to state 1.
The state register in this case would contain a single bit. The next-state function would be given as:
nextState=(!currentStateEWcar)+(currentState!NScar)
currentState:
the contents of the state register (0 or 1)
nextState:
the output of the next-state function that will be written into the state register at the end of the clock cycle.
Lecture 13
Page 11
FSM - Implementation
A FSM can be implemented with a register to hold the current state and a block of combinatorial logic that computes the next-state functions and the output function.
Outputs Combinational logic Next state State register
Inputs
Lecture 13
Page 12
FSM - Implementation
The output function is also simple:
NSlight = !currentState EWlight = currentState
The combinatorial logic block is often implemented using structured logic, such as a PLA.
A PLA can be constructed automatically from the next-state and output-function tables and using computer-aided design (CAD) tools.
Lecture 13 52.139 Computer Organisation and Design Page 13
EWcar
______ EWcar
______ NScar
Lecture 13
Page 14
dayTimeBolt
GreenLED off YellowLED off RedLED off
rP
nHaPrP
eveningBolt
GreenLED off YellowLED on RedLED off
rP
rP
nHaPrP
Page 15
dayTimeBolt
GreenLED off YellowLED off RedLED off
rP
nHaPrP
eveningBolt
GreenLED off YellowLED on RedLED off
rP
rP
nHaPrP
Page 16