Activity Files: VCD, SAIF and Estimation Across the Flow
Record how a block really toggles, fold the record into SAIF totals, and check how much of it the power tool used.
You Will Be Able To
- Explain what a VCD records and what a SAIF file keeps of it.
- Compute T0, T1, TX and TC for a net, and get the X cases right.
- Read an annotation report and say how much of an estimate rests on recorded activity.
- Choose the flow stage whose estimate fits the decision you must make.
- Lesson
- W1.5
- Time
- 30 min
- Runs on
- Your browser
- Check
- 5 questions
A team estimated a multiply-accumulate block with a recorded workload. The report said read_vcd and 0.779 mW. A gate-level record of the same workload gave 0.264 mW: 3.0 times less. The first file had matched only 39 of 1,598 pins.
- Step
- File
- Tool
- Report
- Data
- Record
The simulation writes a VCD: every value change of every dumped signal, with its time.
- Fold
A SAIF file keeps only totals per signal: time at 0, time at 1, time at X, and the toggle count.
- Match
The power tool looks up each name in the netlist. A name it cannot find gives it nothing.
- Check, then read
The annotation report says how many pins got recorded activity. Only then is the power report worth reading.
Read the diagram as text
- Simulation: RTL or netlist
- VCD: Every change, with its time
- SAIF: Totals per pin
- Power tool: Matches names to pins
- Annotation report: Pins matched, pins guessed
- Power report: Internal, switching, leakage
- Simulation → VCD: dump
- VCD → SAIF: fold
- VCD → Power tool: read_vcd
- SAIF → Power tool: read_saif
- Power tool → Annotation report
- Power tool → Power report
A recorded estimate is only as good as the share of pins the tool matched.
What a VCD Records
A VCD (value change dump) is the file a simulator writes with $dumpvars. It lists every change of every dumped signal, with the time of the change. It grows with every cycle you simulate.
The lab's workload runs the MAC of lesson W1.2 for 2,003 cycles of 10 ns. It works in bursts: en is 1 for 64 cycles of every 256. The input a wanders slowly, and b changes once every 512 cycles. The RTL VCD of this run takes 188 kB. A VCD of the synthesized netlist, with every cell pin, takes 1.46 MB.
A power tool does not need the order of the changes. It needs two numbers per signal: how often it toggles, and how long it is 1. The figure folds one net into those totals.
- Cycle 1
The value is unknown for two cycles. T0 0, T1 0, TX 20, TC 0.
- Cycle 3
X to 0 is not a toggle: the old value was not a valid level. T0 20, T1 0, TX 20, TC 0.
- Cycle 4
0 to 1 is a toggle. T0 20, T1 10, TX 20, TC 1.
- Cycle 7
1 to 0 is the second toggle. T0 30, T1 30, TX 20, TC 2.
- Cycle 9
0 to X and then X to 1 are not toggles either. T0 30, T1 40, TX 30, TC 2.
- Cycle 11
The last 1 to 0 counts. Final record: T0 40, T1 50, TX 30, TC 3.
More context
T0 + T1 + TX always equals the length of the window. Here that is 120 ns.
Twelve cycles become one line: (T0 40) (T1 50) (TX 30) (TC 3).
SAIF: Totals per Signal
SAIF (Switching Activity Interchange Format) is the standard file for those totals. The Accellera UPF 1.0 standard defines it in chapter 7. A record holds T0, T1 and TX (time at 0, at 1 and unknown) and TC, the toggle count. TZ, the time floating, and IG, the glitch count, are optional.
Two numbers come out of a record. The static probability is T1 divided by the window: the duty of W1.2. The toggle rate is TC per clock period: the activity of W1.2.
| Net | T0 (ns) | T1 (ns) | TX (ns) | TC | Toggles per cycle | Share of time at 1 |
|---|---|---|---|---|---|---|
| clk | 10015 | 10015 | 0 | 4006 | 2.000 | 0.50 |
| en | 14890 | 5120 | 20 | 16 | 0.008 | 0.26 |
| a[0] | 9990 | 10020 | 20 | 1011 | 0.505 | 0.50 |
| a[7] | 9770 | 10240 | 20 | 15 | 0.007 | 0.51 |
| b[0] | 5130 | 14880 | 20 | 1 | 0.0005 | 0.74 |
| acc[0] | 12865 | 7145 | 20 | 199 | 0.099 | 0.36 |
Recorded in the RTL run: 20,030 ns, 2,003 clock periods. The inputs are unknown for the first 20 ns.
Two lines are worth a second look. The clock toggles twice per cycle and is 1 half of the time. b[0] is 1 for most of the run, yet it toggles once: a high probability does not mean high activity.
W1.2 assumed 0.2 toggles per cycle on every data input. The record disagrees bit by bit. a[0] toggles 0.50 times per cycle, and a[7] only 0.0075 times.
Read the plot as a table
| Bit of a | recorded |
|---|---|
| 0 bit | 0.5047 |
| 1 bit | 0.5062 |
| 2 bit | 0.2481 |
| 3 bit | 0.1318 |
| 4 bit | 0.0579 |
| 5 bit | 0.03 |
| 6 bit | 0.0165 |
| 7 bit | 0.0075 |
Measured in the RTL run of the workload (tools/probes/lowpower/vcd-saif.mjs on its VCD).
A SAIF file can also flow the other way. A forward SAIF file holds instructions to the simulator: which nets to record, and which state-dependent toggles to count. A backward SAIF file holds the results. This lesson writes backward files only.
Annotation Coverage: How Much the Tool Really Read
OpenSTA estimated the same netlist of 1,598 cell pins four times. Only the activity source changed. The clock period was 10 ns and the corner tt.
| Activity source | Pins with recorded activity | Total | Sequential | Combinational |
|---|---|---|---|---|
None: 0.2 per cycle on every input, en held at 1 | 0 | 1.182 mW | 0.365 mW | 0.818 mW |
| VCD of the RTL run | 39 (2.4 %) | 0.779 mW | 0.327 mW | 0.452 mW |
| VCD of the netlist run | 1,598 (100 %) | 0.264 mW | 0.228 mW | 0.036 mW |
| SAIF folded from that VCD | 1,598 (100 %) | 0.264 mW | 0.228 mW | 0.035 mW |
Build-time OpenSTA estimates of mac8 for the same workload.
The RTL VCD matched only the 39 port pins: clk, rst_n, en, 8 bits of a, 8 of b and 20 of acc. For every other pin, the tool spread the port activity through the logic with its own rules. So 97.6 % of the pins still carried guessed activity.
With every pin recorded, the combinational power fell from 0.452 mW to 0.036 mW. The MAC idles three cycles in four, and the record saw that. The guess did not.
The SAIF gave 0.264 mW against 0.264 mW for the VCD: within 0.09 %. The totals carry everything a power tool reads from a VCD.
Estimation Across the Flow
Every stage of the flow can estimate power. Early estimates are fast and rough; late ones are slow and close to silicon.
- Step
- Structure
- Architecture
A spreadsheet multiplies energy per operation by the number of operations. It is fast and rough, and it is the cheapest time to change the design.
- RTL, no activity file
The tool assumes a toggle rate for every input and spreads it through the logic. For this MAC it says 1.182 mW.
- RTL activity on a netlist
An RTL simulation names only the ports and registers. OpenSTA matched 39 of 1,598 pins and guessed the rest: 0.779 mW.
- Gate-level activity
A simulation of the netlist itself records every pin. The estimate falls to 0.264 mW.
- Sign-off
Routed wire loads and a simulation with real delays add the last pieces, including glitches (lesson W1.6). This course does not run that step.
Read the diagram as text
- Architecture: Energy per operation x count
- RTL: No file: 1.182 mW
- RTL activity: 39 pins read: 0.779 mW
- Gate level: Every pin: 0.264 mW
- Sign-off: Routed wires, real delays
- Architecture → RTL: write RTL
- RTL → RTL activity: simulate
- RTL activity → Gate level: synthesize
- Gate level → Sign-off: place, route
Accuracy grows down the flow, and the freedom to change the design shrinks.
In this run, the netlist simulation took about 13 times longer than the RTL one. On a large chip that ratio turns minutes into days. Teams therefore record RTL activity for most runs, and gate-level activity for the final checks.
The gate-level number is still not the last word. Our netlist run has zero delay, so it records no glitches. It also uses no wire loads, which come only after routing.
Mehta quotes a study by LSI Logic about where power can still be cut. Changes at the architecture level could save up to 80 %, at the gate level about 10 %. Estimate early to decide, and estimate late to confirm.
Asked in interviews
What is the difference between a VCD and a SAIF file?
A VCD lists every value change with its time, so it grows with the run. A SAIF file keeps totals per signal: time at 0, at 1 and unknown, and the toggle count. Power tools need only those totals.
What is annotation coverage?
It is the share of pins whose activity came from the file. The rest gets activity propagated by the tool. Low coverage means the "recorded" estimate is mostly a guess.
Why can a gate-level estimate still be too low?
A zero-delay simulation records no glitches, and a netlist before routing has no wire loads. Sign-off adds both, from a timing simulation and extracted parasitics.
When is a vectorless estimate useful?
Early, when no workload exists yet, and for a quick worst case. It needs a toggle rate and a duty for every input, and its number moves with them.
Try It
Run it. The bench resets the MAC and plays the burst workload. saif_bit adds up time at 0, at 1 and at X for one net, and counts its toggles.
A converter that folds the VCD of this run gives the same totals: en is 1 for 5120 ns, and a[0] toggles 1011 times.
Change < 64 to < 192 in the workload. Predict the T1 of en, then run.
Add a counter for b[0] and explain why its T1 is high while its TC is 1.
duration=20030 ns en: T0=14890 T1=5120 TX=20 TC=16 a[0]: T0=9990 T1=10020 TX=20 TC=1011 a[7]: T0=9770 T1=10240 TX=20 TC=15 acc[0]: T0=12865 T1=7145 TX=20 TC=199 acc[19]: T0=9940 T1=10070 TX=20 TC=20Check Yourself
Common Mistakes
Wrong Trust a power report because read_vcd ran without an error.
OpenSTA matched only 39 of 1,598 pins and printed no warning. The other pins got guessed activity.
Fix Run report_activity_annotation after every read, and look at the unannotated count.
read_vcd -scope tb/dut rtl.vcd
report_powerread_vcd -scope tb/dut rtl.vcd
report_activity_annotation
report_powerWrong Count toggles with always @(net) count++ in a zero-delay simulation.
An event block also wakes for values that change and change back inside one time step. A VCD keeps only the last value of each step.
Fix Count changes of settled values, as a SAIF writer does, or fold the VCD.
Wrong Record the whole run, reset and start-up included, and call it typical activity.
SAIF totals are averages over the window. A long reset or an idle start drags the toggle rates down.
Fix Start and stop the record around the workload you want to estimate.
Wrong Sign off one power number from one activity file.
A burst workload and an idle workload give different totals, and each file averages only its own window.
Fix Record one window per operating mode, and report power per mode.
Remember
- A VCD lists every change. A SAIF file keeps, per signal, the time at 0, at 1 and at X, and the 0-1 toggle count.
- Toggles through X do not count. T0 + T1 + TX equals the window.
- Always read the annotation report: an RTL VCD matched 39 of 1,598 pins of this netlist.
- Recorded activity moved this MAC's estimate from 1.182 mW to 0.264 mW.
- Early estimates decide, late estimates confirm. Zero-delay gate-level runs still miss glitches and wires.