How can I implement the state machine with the given constraints?

In summary, the conversation discusses the design and operation of a traffic light system at an intersection. The system is controlled by a state machine, which responds to inputs from car and pedestrian buttons, as well as a timer. The lights will cycle to green in a particular direction if a car or pedestrian is detected, and the appropriate walk light will be displayed for a short interval. The lights will remain green for a minimum time, unless an input situation requires them to cycle. The system operates on a clock and all synchronous elements operate on the same clock. To prevent input race conditions, single point synchronization is necessary. The system also has an asynchronous reset function.
  • #1
k31453
58
0
Hi,
I got this instruction given:

> For each of the following three scenarios, initially assume that the East-West traffic has had a green traffic light for a long time.

1) If a North-South car is detected then the traffic lights will cycle to green in that direction. The walk light will not be on unless a pedestrian is detected then the lights have finished cycling to Green.
2) If a North-south pedestrian is detected then the lights will cycle in a similar fashion but the appropriate walk light will be displayed for a short interval when cycling to Green.
3) If an East-West pedestrian is detected then the appropriate walk light will be displayed for a short interval before returning to East-West having a green light for traffic only.

> Once the lights have changed to green in a particular direction they:
1) Will remain green for minimum time before another change in possible,
2) Will remain green unless an input situation requires the lights to cycle i.e. the lights do not cycle between directions without cars and/or pedestrians being present.
> If a pedestrian wishing to cross with the traffic is present and a car/or pedestrian is present on the cross road then the lights will cycle before the 1st mentioned pedestrian is shown a walk light.
> The intersection is symmetrical-neither road has precedence. The description given above may be applied to the other direction with obvious substitutions being used.

Some Points to Note:
1) The pedestrian buttons will not be held. They are only pressed briefly as would be the case for real pedestrian call buttons.
2) The car buttons may be assumed to be help since they represent car detectors in the road and would be active as long as the car was present. Cars that appear and then disappear before the lights change may be ignored.
3) The clock for the system should be at least `00 Hz so that system will be responsive to brief button presses.
4) All synchronous elements of the design should operate on the same clock.
5) To prevent input race conditions you must have single point synchronisation of external inputs before using them, as input to a synchronous circuit.
6) There must be no gated clocks and no latches.
7) An asynchronous reset single should be used to reset all synchronous circuits(input synchronization, counters and the state machine) when the board is initially powered up. It should not be used to restart the time as part of the usual circuit operation.
8) Asynchronous reset or set operations should not be otherwise used.



State machine provides the “intelligence” of the system. It controls the timer (mealy- style outputs), the lights (Moore-style outputs). Steady state machine respond to timer outputs, the car buttons (synchronised, the pedestrian buttons (synchronised & registered).


My Attempt:

Basically you need counter with multiple outputs to represent various time delays. It would have a synchronous clear input to re-start the time interval. I started doing basic traffic intersection which involves 4 different states. It allowed me sort out problems such as making a state machine, how are lights controlled?


I am only trying to work out basic state machine and how the lights will controlled !

So far I have done this :
Untitled.png
 
Physics news on Phys.org
  • #2
k31453 said:
Hi,
I got this instruction given:

> For each of the following three scenarios, initially assume that the East-West traffic has had a green traffic light for a long time.

1) If a North-South car is detected then the traffic lights will cycle to green in that direction. The walk light will not be on unless a pedestrian is detected then the lights have finished cycling to Green.
2) If a North-south pedestrian is detected then the lights will cycle in a similar fashion but the appropriate walk light will be displayed for a short interval when cycling to Green.
3) If an East-West pedestrian is detected then the appropriate walk light will be displayed for a short interval before returning to East-West having a green light for traffic only.

> Once the lights have changed to green in a particular direction they:
1) Will remain green for minimum time before another change in possible,
2) Will remain green unless an input situation requires the lights to cycle i.e. the lights do not cycle between directions without cars and/or pedestrians being present.
> If a pedestrian wishing to cross with the traffic is present and a car/or pedestrian is present on the cross road then the lights will cycle before the 1st mentioned pedestrian is shown a walk light.
> The intersection is symmetrical-neither road has precedence. The description given above may be applied to the other direction with obvious substitutions being used.

Some Points to Note:
1) The pedestrian buttons will not be held. They are only pressed briefly as would be the case for real pedestrian call buttons.
2) The car buttons may be assumed to be help since they represent car detectors in the road and would be active as long as the car was present. Cars that appear and then disappear before the lights change may be ignored.
3) The clock for the system should be at least `00 Hz so that system will be responsive to brief button presses.
4) All synchronous elements of the design should operate on the same clock.
5) To prevent input race conditions you must have single point synchronisation of external inputs before using them, as input to a synchronous circuit.
6) There must be no gated clocks and no latches.
7) An asynchronous reset single should be used to reset all synchronous circuits(input synchronization, counters and the state machine) when the board is initially powered up. It should not be used to restart the time as part of the usual circuit operation.
8) Asynchronous reset or set operations should not be otherwise used.



State machine provides the “intelligence” of the system. It controls the timer (mealy- style outputs), the lights (Moore-style outputs). Steady state machine respond to timer outputs, the car buttons (synchronised, the pedestrian buttons (synchronised & registered).


My Attempt:

Basically you need counter with multiple outputs to represent various time delays. It would have a synchronous clear input to re-start the time interval. I started doing basic traffic intersection which involves 4 different states. It allowed me sort out problems such as making a state machine, how are lights controlled?


I am only trying to work out basic state machine and how the lights will controlled !

So far I have done this :
View attachment 69781

This looks to be a typo: `00 Hz

And what is meant by "no latches" -- how can you design a synchronous circuit without using latches?

Next you should add in the other inputs that are used (buttons, car sensors, etc.), and the other outputs (pedestrian walk light)...
 
  • #3
berkeman said:
This looks to be a typo: `00 Hz

And what is meant by "no latches" -- how can you design a synchronous circuit without using latches?

Next you should add in the other inputs that are used (buttons, car sensors, etc.), and the other outputs (pedestrian walk light)...

Cars and pedastrians are controlled by switch and we don't use latches. We create state machine and use vhdl to implement program in CPLD circuit.

Hope that answer your questions.
 
  • #4
k31453 said:
Cars and pedastrians are controlled by switch and we don't use latches. We create state machine and use vhdl to implement program in CPLD circuit.

Hope that answer your questions.

But you need to synchronize those asynchronous inputs from switches, and that requires 2 latches for each signal, right? I'm not understanding that part of the problem statement.

Do you have an expanded State Table yet with the other inputs?
 
  • #5


1) State 1: East-West traffic has green light, North-South traffic has red light. No pedestrian detected.
2) State 2: East-West traffic has green light, North-South traffic has red light. North-South pedestrian detected. Walk light turns on for short interval before East-West traffic light changes to red and North-South traffic light turns green.
3) State 3: East-West traffic has red light, North-South traffic has green light. East-West pedestrian detected. Walk light turns on for short interval before North-South traffic light changes to red and East-West traffic light turns green.
4) State 4: East-West traffic has red light, North-South traffic has green light. No pedestrian detected.

In order to implement this state machine with the given constraints, you would need to use a synchronous design approach and follow the guidelines provided. This would involve using a single clock for all synchronous elements, synchronizing external inputs before using them, and using an asynchronous reset signal to reset all synchronous circuits when the system is initially powered up.

Additionally, you would need to use a counter with multiple outputs to represent the different time delays and use a synchronous clear input to restart the time interval. You would also need to make sure there are no gated clocks or latches used in the design.

To control the lights, you would need to use Moore-style outputs that are controlled by the state machine. These outputs would determine when the lights should change and which lights should be on at a given time. For example, in state 1, the output would be to turn on the green light for East-West traffic and the red light for North-South traffic.

To handle the different scenarios involving pedestrians, you would need to use Mealy-style outputs that are controlled by both the state machine and the pedestrian buttons. These outputs would determine when the walk light should turn on and for how long.

Overall, implementing this state machine would require careful design and consideration of the given constraints. It is important to ensure that the system is responsive to brief button presses and that there are no input race conditions. With proper design and synchronization, the state machine can effectively control the traffic lights and pedestrian signals in a symmetrical manner.
 

FAQ: How can I implement the state machine with the given constraints?

What is a "Weird traffic controller?"

A "Weird traffic controller" is a term used to describe a person or device that controls and directs the flow of traffic in a strange or unconventional manner. This could include unusual hand gestures or movements, unique traffic signals, or other non-traditional methods of managing traffic.

Why would someone use a "Weird traffic controller?"

There could be a variety of reasons why someone would use a "Weird traffic controller." It could be for entertainment purposes, to attract attention, or to test different traffic control methods. In some cases, it may even be used as a form of protest or to raise awareness about certain traffic issues.

Is using a "Weird traffic controller" safe?

The safety of using a "Weird traffic controller" depends on the specific methods and techniques being used. If the traffic controller is properly trained and follows all traffic laws and regulations, it can be just as safe as a traditional traffic controller. However, if the methods used are dangerous or distracting to drivers, it can pose a safety risk.

Are there any regulations or restrictions for using a "Weird traffic controller?"

In most cases, using a "Weird traffic controller" falls under the jurisdiction of local traffic laws and regulations. This means that there may be restrictions or permits required for certain methods, and the traffic controller must follow all applicable laws. It's important to check with local authorities before implementing any unconventional traffic control methods.

Can "Weird traffic controllers" be effective?

While unconventional traffic control methods may not be as widely used or recognized as traditional methods, they can still be effective if used properly. Some studies have shown that unique and entertaining traffic control methods can even improve driver compliance and reduce accidents. However, it's important to carefully consider the effectiveness and safety of any "Weird traffic controller" before implementing it.

Similar threads

Back
Top