General-Purpose Timer¶
The general-purpose timer provides configurable counting, periodic interrupt generation, and compare-match events. Multiple independent timer instances can be instantiated in a single IP block, each with its own prescaler, counter, and compare channels.
All timer logic is bus-driven. There are no external IO signals — the IP is purely internal.
Features¶
Configurable number of independent timer instances (
count, 1–16)Configurable compare channels per timer (
channelCount, 1–8)Configurable counter width (
width, 1–32 bits)Optional clock prescaler per timer (
prescalerWidth, 0 = no prescaler)Three operating modes: free-run, periodic (auto-reload), one-shot
Counter preload: software can write the counter register while stopped
Compare-match events: each channel fires independently when counter equals its compare register
One-shot mode clears the enable bit automatically on completion
Combined InterruptCtrl: single
interruptoutput with per-source pending and mask registersSupported buses: APB3, TileLink, Wishbone
Operating Modes¶
Mode |
Behaviour |
|---|---|
|
Counter counts up from 0 to |
|
Counter counts up from 0 to |
|
Counter counts up from 0 to |
Parameters¶
Parameter |
Default |
Description |
|---|---|---|
|
|
Number of independent timer instances (1–16) |
|
|
Compare channels per timer instance (1–8) |
|
|
Counter and compare register width in bits (1–32) |
|
|
Prescaler counter width in bits. 0 disables the prescaler (counter ticks every clock cycle). |
Register Map¶
Offset |
Name |
Description |
|---|---|---|
0x000 |
|
IP Identification header |
0x004 |
|
IP Identification version |
0x008 |
|
Compile-time parameters (read-only, see below) |
0x00C |
|
Interrupt pending bits — sticky W1C, one bit per source |
0x010 |
|
Interrupt mask — 1 enables the corresponding source |
0x014 + t × stride |
|
Per-timer control register (see below) |
0x018 + t × stride |
|
Prescaler reload value. Counter decrements; tick fires when it reaches 0 and reloads. |
0x01C + t × stride |
|
Current counter value (R/W; write preloads the counter while stopped) |
0x020 + t × stride |
|
Auto-reload value used by periodic and one-shot modes |
0x024 + t × stride + ch × 4 |
|
Compare value for channel |
stride = 0x10 + channelCount × 4
Info Register (0x008)¶
Bits |
Field |
Description |
|---|---|---|
[7:0] |
|
Number of timer instances |
[15:8] |
|
Compare channels per timer |
[23:16] |
|
Counter width in bits |
[31:24] |
|
Prescaler width in bits (0 = no prescaler) |
Control Register (per timer)¶
Bits |
Field |
Description |
|---|---|---|
[0] |
|
Start/stop the timer. Cleared automatically by hardware in one-shot mode. |
[2:1] |
|
Operating mode: |
Interrupt Pending / Mask Layout¶
Bits are allocated per timer, with 1 + channelCount bits each:
bit t*(1+channelCount) + 0 timer t overflow
bit t*(1+channelCount) + 1 timer t compare channel 0
bit t*(1+channelCount) + 2 timer t compare channel 1
...