Skip to content

yne/vcd

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

30 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Value Change Dump (.vcd) command line viewer for Windows, Linux and MacOS

# SKIP=13 vcd < samples/basic.vcd
global:
  zoom: 2
  date: Fri Nov 21 16:56:29 2014
  total: 43
  skip: 13
  time:
    scale: 1.00
    unit:  fs
    line       : "13                  23                  33                  "
channels:
  default:
    e_clk      : "╲▁╱▔╲▁╱▔╲▁╱▔╲▁╱▔╲▁╱▔╲▁╱▔╲▁╱▔╲▁╱▔╲▁╱▔╲▁╱▔╲▁╱▔╲▁╱▔╲▁╱▔╲▁╱▔╲▁╱▔"
    e_rst      : "▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔"
    e_ren      : "▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔╲▁▁▁╱▔▔▔╲▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁╱▔▔▔▔▔▔▔"
    e_wen      : "▁▁▁▁▁▁▁▁▁▁▁▁╱▔▔▔╲▁▁▁╱▔▔▔╲▁▁▁╱▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔"
    e_d[3:0]   : "3 3 4 4 5 5 Z Z 6 6 Z Z 7 7 Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z "
    e_q[3:0]   : "Z Z Z Z Z Z Z Z Z Z Z Z Z 3 3 Z Z 4 4 5 5 6 6 7 7 0 0 Z Z Z "
    e_empty    : "▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁╱▔▔▔▔▔▔▔▔▔▔▔▔▔"
    e_mid      : "▁▁╱▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔╲▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁"
    e_full     : "▁▁▁▁▁▁▁▁▁▁╱▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔╲▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁"
  fifo1:
    clk        : "╲▁╱▔╲▁╱▔╲▁╱▔╲▁╱▔╲▁╱▔╲▁╱▔╲▁╱▔╲▁╱▔╲▁╱▔╲▁╱▔╲▁╱▔╲▁╱▔╲▁╱▔╲▁╱▔╲▁╱▔"
    rst        : "▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔"
    ren        : "▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔╲▁▁▁╱▔▔▔╲▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁╱▔▔▔▔▔▔▔"
    wen        : "▁▁▁▁▁▁▁▁▁▁▁▁╱▔▔▔╲▁▁▁╱▔▔▔╲▁▁▁╱▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔"
    d[3:0]     : "3 3 4 4 5 5 Z Z 6 6 Z Z 7 7 Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z "
    q[3:0]     : "Z Z Z Z Z Z Z Z Z Z Z Z Z 3 3 Z Z 4 4 5 5 6 6 7 7 0 0 Z Z Z "
    empty      : "▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁╱▔▔▔▔▔▔▔▔▔▔▔▔▔"
    mid        : "▁▁╱▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔╲▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁"
    full       : "▁▁▁▁▁▁▁▁▁▁╱▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔╲▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁"
    w_adr[1:0] : "2 3 3 0 0 1 1 1 1 2 2 2 2 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 "
    r_adr[1:0] : "1 1 1 1 1 1 1 1 1 2 2 2 2 3 3 3 3 0 0 1 1 2 2 3 3 3 3 3 3 3 "

Installation

From prebuilt binary

Manually download install a prebuilt binary

From sources

make
sudo make install

From Package Manager

Arch-based distribution:

yay -S vcd

Usage

vcd < in.vcd            # output to screen
vcd < in.vcd > out.yml  # output to file
vcd < in.vcd | less -S  # scrollable view

Query

The default vcd output is a valid YAML file, so you can process it with many tools like yq or shyaml

# print the first 9 sample of the clk channel in the fifo1 scope
vcd < samples/basic.vcd | yq .channels.fifo1.clk[0:9]
vcd < samples/basic.vcd | shyaml -y get-value channels.default.e_clk

Styling

Waveform, position, color can be customized using environment variables.

# skip the 9 first samples
SKIP=9 vcd < in.vcd | less -S
# Disable RAISE/DROWN transition
RAISE="" DROWN="" vcd < in.vcd
# color the bus value in green using StartTeX/EndTeXt (STX/ETX) variables
STX=$(printf "\x1b[32m") ETX=$(printf "\x1b[0m") vcd < in.vcd

Auto-Refresh

The following snippet endlessly wait for a change on the in.vcd file. Then, when it happen, regenerate the out.yml graph and refresh the less -S out.yml scrollable display by sending a "R" keypress (for refreshing).

echo "hi ! please modify 'in.vcd' to refresh me" > out.yml
while inotifywait -q -e modify -e close_write in.vcd ; do
  vcd < in.vcd > out.yml           # regenerate out.yml
  screen -x -r bridge -X stuff R   # send Refresh command to foreground less -S
done &                             # this loop will run in background
screen -S bridge less -S out.yml   # the foreground "less -S" display
# don't forget to stop the background loop using `kill %1` or fg + ^C