DhruvalMistry

Digital VLSI | ASIC Design Engineer

I design clocked digital hardware in SystemVerilog. This project is a register-mapped programmable timer that counts on every clock, detects overflow, reloads automatically and raises a maskable interrupt request, the same building block that sits inside every microcontroller and SoC.

SystemVerilogSequential RTLInterrupt LogicRegister MapVerilatorGTKWaveYosys
All 20 projects | live portfolio
Project 02

ProgrammableTimer and Interrupt Controller

A synthesizable timer IP in SystemVerilog. Load a value, start the counter, catch the overflow, reload and interrupt, all controlled through registers.

0Functions
0Register groups
0Test scenarios
000 COUNT[7:0]
COUNTING
03
Overview

Built to count
and to interrupt

Project at a glance

Design typeProgrammable timer IP
LanguageSystemVerilog (RTL)
Logic styleSequential, clocked
ControlRegister-mapped: start, stop, enable, disable
ConfigurationLoad value and reload value
EventOverflow detection
OutputInterrupt request
FlowVerilator, GTKWave, Yosys

Objectives

  • Reusable timer IP in SystemVerilog
  • Register-mapped start, stop, enable, disable
  • Configurable load and reload values
  • Overflow detect with automatic reload
  • Maskable interrupt request

Why it matters

Almost every microcontroller and SoC carries programmable timers with interrupts. Building one exercises the core RTL skills: register control, sequential logic, event detection and interrupt handling.

10

supported functions

Toolchain

VerilatorGTKWaveYosys

License

MIT
04
Architecture

Signal chain

Follow the event from the register write to the interrupt pin. Toggle blocks to see which parts of the path go quiet.

05
Register map

Program it like
software would

Pick a register and tap a bit field. Layout shown is an illustrative convention, the exact map lives in the RTL.

ILLUSTRATIVE LAYOUT
06
Output waveform

Count, overflow, IRQ

Reset, load, run, mask the interrupt, stop and restart. Hover for values, scroll to zoom.

BEHAVIORAL MODEL
Hover the waveform to read values.

This trace is generated by the in-page JavaScript model. Drop a real simulator dump at data/timer.vcd and it is loaded automatically in its place.

07
Timer lab

Drive the timer

Configure load and reload values, then run it cycle by cycle. A behavioral model of the design, not simulator output.

COUNT000
OVERFLOW
IRQ

Event log

Events: 0 overflows

08
RTL playground

Edit the RTL

Starter module and testbench you can edit. Compile and run needs a simulator service, which is not attached to this static site.

BACKEND NOT CONNECTED

Starter code is untested example code. Verify it with your own simulator before relying on it.

Console

Idle.
09
Verification

Test plan

Scenarios planned for the timer. Status shows PENDING until real results are added to data/results.json.

12Scenarios
0Passed
0Failed
12Pending
#ScenarioWhat is checkedStatus

Coverage

NO DATACoverage appears here once data/results.json is provided.
10
Counter stages

Inside the count

Each clock edge moves the counter through compare, increment and reload. Step it and watch the stages light up.

ENABLED AND RUNNING

-
enable & run

COMPARE

-
count == max

INCREMENT

-
count + 1

RELOAD

-
count = reload

INTERRUPT

-
ovf & irq_en
count = 0

Behavioral model for illustration. Up-counter convention assumed.

11
Synthesis

From RTL to gates

Readread_verilog -svParse the SystemVerilog source
Elaboratehierarchy, procResolve the design and processes
Optimizeopt, fsm, memoryClean and simplify logic
ReportstatCell and flip-flop counts
PENDINGCell counts appear here once data/synth.json is provided. Nothing is estimated.
Source

Read the RTL

View on GitHub