
This project implements a dedicated digital controller for a vehicular traffic light. A pushbutton allows a user to request a temporary stop in vehicle traffic. Three active-high outputs control the green, yellow, and red lights. A seven-segment display indicates the remaining red time, and its decimal point indicates whether a request is pending.
The design is based on the first assessed assignment of the Fundamentals of Digital Systems (FSD) course at Instituto Superior de Engenharia de Lisboa (ISEL) for the 2026/2027 academic year. Originally intended for a CPLD implementation, it has been adapted and extended for ASIC implementation through Tiny Tapeout.
| Feature | Specification |
|---|---|
| Main clock | 1024 Hz nominal, externally supplied |
| Green guard | Programmable, 0–7 time-base ticks |
| Yellow | Fixed, 4 ticks |
| Red | Programmable, 1–15 ticks; zero selects 9 |
| Request interface | Active-high button; debounce and one pending request |
| Display | Single hexadecimal digit and independent pending-request point |
| Diagnostics | 3-bit state code, 1 Hz time base, guard equality |
| Technology | SKY130, one Tiny Tapeout tile (1x1) |
The original assignment specifies a six-second green guard period, a four-second yellow period, and a nine-second red period. The ASIC retains this operating sequence but allows the guard and red times to be configured.
The green phase therefore does not have a fixed total duration. It consists of a guard period followed, if necessary, by an indefinite wait for a request. Button presses do not restart or shorten the current yellow or red countdown.

The diagram illustrates an early request and a second request during red. The first is serviced after the sixth guard tick; the second remains pending as the next green guard begins. MCLK-scale state transitions are omitted. The diagram describes the intended sequence, not a measured waveform or an SDF simulation.
The button input is active high and must be low when released. A rising edge of the debounced button signal records a request, regardless of the current light color. The request memory stores a single pending request; repeated presses before that request is serviced do not accumulate additional requests. Holding the button down does not generate repeated requests. The button must be released and pressed again to generate another rising edge.
The memory is cleared during initialization and when a request is serviced at the transition from green to yellow. As the request flip-flop has an asynchronous reset, a new debounced rising edge occurring while that reset is active can be lost.
The seven digit segments are enabled only in the red countdown state. They are blank during green, yellow, and initialization. The ASIC uses hexadecimal digits (0–9, A, b, C, d, E, F) to represent red countdown values up to 15 on a single digit. Zero may appear briefly at the end of the red period before the controller returns to green. The decimal point is independent of the digit segments and lights whenever a request is pending, even when the digit is blank.
| Parameter | Original assignment | ASIC configuration | Inputs |
|---|---|---|---|
| Green guard | 6 s | 0–7 ticks | ui[3:1] |
| Yellow | 4 s | 4 ticks (fixed) | None |
| Red | 9 s | 1–15 ticks; 0 selects 9 | ui[7:4] |
The configuration inputs are unsigned binary values, with the least significant bits at ui[1] and ui[4], respectively. A zero guard setting permits servicing requests without waiting for a 1 Hz counting interval. A zero red setting selects the default value of nine ticks, not a zero-length red period.
During reset and initialization, all three lights are active as an initialization indication, the digit is blank, and the request memory is cleared. The two timing values are captured on the first rising edge of the main clock after internal reset is released. Normal operation then begins with green. Keep the configuration inputs stable before and during reset release. Later changes have no effect until another reset.
The nominal external clock (clk) is 1024 Hz. A free-running ten-bit divider generates a 1 Hz time base for both counters and a 64 Hz clock for button synchronization and debouncing. Timing settings specify the number of rising edges of the 1 Hz time base, not exact elapsed seconds. At the nominal clock frequency, a four-tick yellow countdown may last approximately three to four seconds, depending on its starting phase, plus small state-transition delays. The first nonzero guard period begins near the initial zero phase of the divider; its first tick occurs about half a second later. The same clock continues running across light transitions. Other external clock frequencies scale both the countdown and button-filter timing.
The debouncer uses a two-flip-flop synchronizer and requires three consecutive equal synchronized samples before changing its registered output. At 1024 Hz, the nominal response to a stable input transition is approximately 62.5–78.1 ms, depending on sampling phase.

The controller consists of an eight-state Moore finite state machine and six directly interconnected processing components: a two-input multiplexer, a four-bit down counter shared by the yellow and red periods, a three-bit up counter for the guard period, an equality comparator, a D flip-flop for the request memory, and a hexadecimal-to-seven-segment decoder. The control unit generates the asynchronous load and reset commands, enables the guard counter and display, and uses the counter and request status signals to determine state transitions.
The Tiny Tapeout top-level module adds reset synchronization, clock division, button conditioning, two timing configuration registers, and platform-specific I/O mapping. The down counter is loaded before its value is used; its initial contents need not be defined.

The countdown counter uses asynchronous parallel loading of the selected red or yellow duration. It decrements modulo 16 on rising edges of the 1 Hz clock; the control unit responds to the zero flag only in the yellow and red countdown states. The guard counter is asynchronously cleared, counts only while enabled, and is held after equality is reached. The request memory is a D flip-flop with its data input tied high and its clock driven by the debounced button. Its asynchronous reset clears the pending request.
The control unit is a Moore finite state machine with eight explicitly encoded states. The state register is clocked by MCLK and is asynchronously initialized to 000. Its outputs select the countdown value, load the counter, reset or enable the guard counter, clear the request and enable the digit. The yellow value is already selected before load_yellow; setup_red selects the red value one MCLK cycle before load_red asserts the asynchronous load command. Each load state occupies one MCLK cycle.

The chart shows only asserted Moore outputs. The two decision outcomes are labeled 0 and 1. The initialization state is entered on reset; the reset transition from each operating state is omitted for clarity. This state encoding is intended to reduce unwanted transitions on asynchronous commands, not to guarantee hazard-free physical logic.
| Pins | Function |
|---|---|
ui[0] |
Request button (active high) |
ui[3:1] |
Guard configuration (bit 0 at ui[1]) |
ui[7:4] |
Red configuration (bit 0 at ui[4]) |
uo[6:0] |
Digit segments g through a (a at uo[0]) |
uo[7] |
Pending request / decimal point |
uio[0] |
Red light |
uio[1] |
Yellow light |
uio[2] |
Green light |
uio[5:3] |
Control state (bit 0 at uio[3]) |
uio[6] |
1 Hz time base |
uio[7] |
Guard counter equals configured guard count |
The light, segment, decimal-point, and guard-equality outputs are active high. All eight bidirectional pins are configured as outputs. The user module does not use ena or the bidirectional inputs. The guard equality output is a comparator result, not a latched completion flag; for a zero guard setting it can also be high while the counter is reset.
| State code | State | Active lights |
|---|---|---|
| 000 | Initialization and configuration | All three |
| 011 | Green guard | Green |
| 001 | Green, waiting for request | Green |
| 111 | Load yellow countdown | Yellow |
| 101 | Yellow | Yellow |
| 100 | Select red countdown | Red |
| 110 | Load red countdown | Red |
| 010 | Red countdown | Red |
The state code, 1 Hz time base, guard equality output, and decimal point can be monitored to observe the operation of the controller during demonstrations.
| Parameter | Local implementation result |
|---|---|
| Process and requested area | SKY130, 1x1 tile |
| RTL organization | 13 Verilog-2005 modules, 35 mapped flip-flops |
| Standard-cell area (including taps) | 3114.24 µm² |
| Core utilization (including taps) | 18.88% |
| MCLK implementation constraint | 20 ns (50 MHz) |
| Worst reported setup / hold slack | +7.445 ns / +0.034707 ns |
| Reported setup, hold, slew, capacitance and fanout violations | 0 |
| Local Magic DRC / LVS / antenna violations | 0 / 0 / 0 |
| Functional regression | RTL: 3/3; final gate-level: 3/3 |

These are pre-silicon tool results for the local release candidate (Slew v5, November 30, 2026), not measured electrical specifications. The 50 MHz constraint is an implementation target, not a characterized maximum operating frequency. The nominal application clock remains 1024 Hz. Functional gate-level tests use no SDF back-annotation. See the validation report for the timing model, limitations, and verification details.
ui[0] low and select the desired timing parameters. To reproduce the original assignment's count settings, set ui[3:1] = 110 and ui[7:4] = 0000 (or 1001 for an explicit red setting of nine).rst_n = 0) and release it with the clock running. All three lights should be active during reset; afterward, only green should be active and the digit segments and decimal point should be off, with the button released.The on-board DIP switches can be used for configuration and to emulate a press and release of the request button on ui[0]. For the default guard and red settings with the button released, the input byte is 0x0C; the explicit nine-tick red configuration is 0x9C. Toggle only bit 0 to issue a request. Keep the timing bits stable at reset release. Select the appropriate project and clock settings using the ETR demo board guide. The procedure below is intended for board bring-up after fabrication; it has been checked against the functional testbench, not yet performed on the fabricated ASIC.
| Test | Expected behavior |
|---|---|
| No request | Green stays on after the guard count ends. |
| Request during guard | The decimal point turns on; green remains on until the guard count ends. |
| Request after guard | Green changes to yellow after button conditioning and control-state delays. |
| Yellow and red sequence | Yellow lasts four ticks, followed by the configured red countdown; the digit is visible only during the red countdown. |
| Request during yellow or red | The decimal point indicates a pending request; the current countdown continues, and the next request is serviced after the following guard period. Avoid the brief request-clear interval when performing this test. |
| Repeated presses while pending | Only one additional cycle is requested, provided all presses occur before the pending request is serviced. |
| Held button | No further cycle is requested solely because the button remains pressed. |
| Change configuration | Changes have no effect until reset. |
| Zero guard and maximum red | With guard set to 0 and red set to 15, no guard ticks are required and the red countdown starts at F. |
| Reset during operation | Pending requests are cleared and the selected configuration is loaded again; operation restarts with green. |
Use the diagnostic pins to correlate state changes with the 1 Hz rising edges. Allow for the phase-dependent timing described above rather than expecting exact wall-clock intervals from the start of every phase.
A Tiny Tapeout demo board or equivalent setup must provide a 1024 Hz clock, an active-low reset, seven configuration inputs, and an active-high pushbutton input. Use a pull-down or equivalent circuit if the button input would otherwise float when released. Connect the three light outputs to suitable red, yellow, and green indicators and the eight dedicated outputs to a compatible seven-segment display with decimal point. The segment signals are active high, suitable for a common-cathode display with appropriate driving circuitry; an active-low display requires inversion or a suitable driver.

The ETR demo board provides 3.3 V board-interface logic, input switches, a seven-segment display and external I/O headers. Use the existing board display when its mapping and polarity are compatible. For external indicators, select current-limiting resistors or buffer/driver circuits based on the board output ratings and LED forward voltage. The diagram is a functional wiring example, not a board-revision-specific schematic. See the ETR specifications and GPIO specifications.
Use appropriate current limiting and observe the board and ASIC electrical ratings. Verify the actual board revision, connector assignments, and display polarity before wiring. Do not drive the bidirectional pins externally while the project is selected. This is an educational demonstration circuit, not a safety-certified controller for use in road traffic.
| # | Input | Output | Bidirectional |
|---|---|---|---|
| 0 | BUTTON | SEG_A | RED |
| 1 | TIME_GUARD[0] | SEG_B | YELLOW |
| 2 | TIME_GUARD[1] | SEG_C | GREEN |
| 3 | TIME_GUARD[2] | SEG_D | STATE[0] |
| 4 | TIME_RED_ON[0] | SEG_E | STATE[1] |
| 5 | TIME_RED_ON[1] | SEG_F | STATE[2] |
| 6 | TIME_RED_ON[2] | SEG_G | OSC_1HZ |
| 7 | TIME_RED_ON[3] | BUTTON_MEM (DP) | MATCH_GUARD |