# Weird traffic controller

1. May 14, 2014

### k31453

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 :

2. May 15, 2014

### Staff: Mentor

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. May 15, 2014

### k31453

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

4. May 16, 2014

### Staff: Mentor

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?