RTL Studio Open IDE

Control & Timers

Traffic-Light Controller FSM — L2 Upgrade

Traffic-Light Controller FSM with sticky IRQ capture and emergency override.

About this block

Simulate it in the Verilog IDE

Hardverilogsimsyn

Traffic-Light Controller FSM — L2 Upgrade is a Verilog reference block in the Control & Timers catalog. FSMs, timers, watchdogs, and control/state sequencing blocks. Marked Hard: a larger reference. Simulate the packaged testbench before you change the RTL.

This IP implements a finite state machine (FSM) for a traffic light controller. It is designed for educational purposes and simple embedded traffic control applications.

The design supports configurable timing for Red, Green, and Yellow phases, includes an emergency override input, and features a sticky interrupt flag that asserts during the Yellow state or upon emergency detection.

This IP provides a robust, configurable traffic light controller FSM with emergency handling and interrupt signaling.

  1. Choose Open in IDE. RTL Studio loads the packaged workspace for Traffic-Light Controller FSM — L2 Upgrade.
  2. Read the Verilog module in the editor. The catalog line for this block: Traffic-Light Controller FSM with sticky IRQ capture and emergency override.
  3. Run the packaged testbench with the in-browser Verilator simulator, then open the VCD in the waveform viewer.
  4. Run Yosys in the same IDE for a generic netlist. Sky130 liberty mapping is a separate Pro library option.

RTL Studio is the Verilog simulator and IDE around this block: Slang lint, Verilator, VCD waveforms, and Yosys, in the browser. Simulation guide · Yosys guide.

Features

  • Configurable Timing: Adjust cycle counts for Green, Yellow, and Red phases via parameters.
  • Emergency Override: Immediate transition to Red state upon assertion of the emergency input.
  • Sticky Interrupt: irq_o asserts during the Yellow state or on emergency detection and persists until cleared by irq_clear.
  • Synchronous Reset: Resets to the initial Red state synchronously.
  • Verilog-2001 Compatible: Standard syntax for broad tool support.

Ports

Port NameDirectionWidthDescription
clkInput1System clock
rst_nInput1Active-low synchronous reset
startInput1Start signal to begin Green phase from Red
emergencyInput1Active-high emergency override to Red
irq_clearInput1Active-high signal to clear the sticky IRQ
state_outOutput2Current state: 00=Red, 01=Green, 10=Yellow
irq_oOutput1Sticky interrupt flag

Architecture

The design consists of a state register, next-state logic, three independent counters, and an IRQ latch.

  • State Machine: Transitions through Red, Green, and Yellow based on counter thresholds.
  • Start Logic: The start signal is required to leave the Red state.
  • Emergency Logic: Emergency inputs bypass normal timing and force an immediate Red state transition.

More in Control & Timers

All Control & Timers blocks