-
In a Mealy machine, the output depends on both the current state and the current inputs.
-
A general model of a Mealy sequential machine consists of a combinatorial network, which generates the outputs and the next state, and a state register which holds the current state as shown below.
-
The state register is normally modeled as D flip-flops.
-
The other block(s) can be modeled either using the always procedural block or a mixture of the always procedural block and dataflow modeling statements.
-
Traffic Light Controller - A sensor on the farmway is to detect if there are any vehicles and change the traffic light to allow the vehicles to cross the highway. Otherwise, highway light is always green since it has higher priority than the farmway.
-
Highway light is always green since it has higher priority than the farmway
-
Sensor detects vehicles on farmway, green on highway and red on farmway turn to yellow on highway and red on farmway
-
Yellow on highway and red on farmway for 3s, then turn to red on highway and green on farmway
-
Red on highway and green on farmway for 10s, then turn to red on highway then yellow on highway
-
Red on highway and yellow on farmway for 3s, then turn to green on highway and red on farmway
Distributed under the MIT License. See LICENSE
for more information.
吳華楨 Trista Wu - [email protected]
Project Link: https://github.com/trista-csee/Traffic_Light_Controller_Mealy_Machine