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

  • Thread starter Thread starter k31453
  • Start date Start date
  • Tags Tags
    Controller Weird
Click For Summary

Discussion Overview

The discussion revolves around implementing a state machine for a traffic light control system with specific constraints regarding traffic and pedestrian interactions. Participants explore the design requirements, state machine functionality, and the handling of various inputs and outputs in a synchronous circuit.

Discussion Character

  • Technical explanation
  • Debate/contested
  • Mathematical reasoning

Main Points Raised

  • One participant outlines the requirements for the state machine, emphasizing the need for a counter with multiple outputs to manage time delays and the importance of synchronous clear inputs.
  • Another participant questions the feasibility of designing a synchronous circuit without using latches, seeking clarification on the constraints provided in the instructions.
  • There is a suggestion to incorporate additional inputs (buttons, car sensors) and outputs (pedestrian walk light) into the design.
  • A participant mentions the necessity of synchronizing asynchronous inputs from switches, indicating a potential need for latches, which raises further questions about the problem statement.
  • Some participants discuss the implementation of the state machine using VHDL in a CPLD circuit, but the specifics of the state table and input handling remain unclear.

Areas of Agreement / Disagreement

Participants express differing views on the use of latches in the design, with some asserting that latches are not needed while others argue that synchronization of inputs may require them. The discussion remains unresolved regarding the implementation details and the interpretation of the constraints.

Contextual Notes

Participants note limitations in understanding the requirements for handling asynchronous inputs and the implications of the instruction to avoid latches. The discussion reflects uncertainty about the design approach and the need for further clarification on the state machine's operation.

k31453
Messages
58
Reaction score
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
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)...
 
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.
 
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?
 

Similar threads

  • · Replies 1 ·
Replies
1
Views
2K
  • · Replies 10 ·
Replies
10
Views
4K
Replies
1
Views
9K
  • · Replies 1 ·
Replies
1
Views
3K
  • · Replies 3 ·
Replies
3
Views
3K
  • · Replies 1 ·
Replies
1
Views
6K
Replies
7
Views
13K
Replies
3
Views
5K
  • · Replies 4 ·
Replies
4
Views
13K
  • · Replies 1 ·
Replies
1
Views
3K