GATE 2018 EC – Question 29
A traffic signal cycles from GREEN to YELLOW, YELLOW to RED and RED to GREEN. In each cycle, GREEN is turned on for 70 seconds, YELLOW is turned on for 5 seconds and the RED is turned on for 75 seconds. This traffic light has to be implemented using a finite state machine (FSM). The only input to this FSM is a clock of 5 second period. The minimum number of flip-flops required to implement this FSM is ________.
Practise this question in The GATE Grind →
Show answer and explanation
Correct answer: 5
Explanation
With a 5 s clock the states last $14$ (green), $1$ (yellow) and $15$ (red) clock cycles, so the machine needs $14+1+15=30$ distinct states. $\lceil\log_2 30\rceil=5$ flip-flops are needed.