Coder Social home page Coder Social logo

vcd's Introduction

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

vcd's People

Contributors

134744072 avatar ju-sh avatar muratovas avatar uffejakobsen avatar yne avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

vcd's Issues

Error with VCD file

vcd-windows-latest-clang.exe < counter\waves.vcd

Fatal error. Send your VCD at https://github.com/yne/vcd/issue

Reason: MAX_CHANNEL reached (400), rebuild with -DMAX_CHANNEL=...

VCD File below :

$date
2022-03-12T16:14:46.339792
$end
$version
ROHD v0.2.0
$end
$comment
Generated by ROHD - www.github.com/intel/rohd
$end
$timescale 1ps $end
$scope module counter $end
$var wire 1 s0 en $end
$var wire 1 s1 reset $end
$var wire 1 s2 clk $end
$var wire 8 s3 val $end
$var wire 8 s4 s0 $end
$var wire 8 s5 nextVal $end
$scope module sequential $end
$var wire 1 s6 _in0_reset $end
$var wire 8 s7 _in1_s0 $end
$var wire 1 s8 _in2_en $end
$var wire 8 s9 _in3_nextVal $end
$var wire 1 s10 _clk0_clk $end
$var wire 8 s11 _out4_val $end
$upscope $end
$upscope $end
$enddefinitions $end
$dumpvars
zs0
zs1
0s2
bzzzzzzzz s3
b00000000 s4
bxxxxxxxx s5
zs6
b00000000 s7
zs8
bxxxxxxxx s9
0s10
bzzzzzzzz s11
$end
#0
0s0
1s1
1s6
0s8
#5
1s2
b00000000 s3
b00000001 s5
b00000001 s9
1s10
b00000000 s11
#10
0s2
0s10
#15
1s2
1s10
#20
0s2
0s10
#25
0s1
1s2
0s6
1s10
#30
0s2
0s10
#35
1s2
1s10
#40
0s2
0s10
#45
1s0
1s2
b00000001 s3
b00000010 s5
1s8
b00000010 s9
1s10
b00000001 s11
#50
0s2
0s10
#55
1s2
b00000010 s3
b00000011 s5
b00000011 s9
1s10
b00000010 s11
#60
0s2
0s10
#65
1s2
b00000011 s3
b00000100 s5
b00000100 s9
1s10
b00000011 s11
#70
0s2
0s10
#75
1s2
b00000100 s3
b00000101 s5
b00000101 s9
1s10
b00000100 s11
#80
0s2
0s10
#85
1s2
b00000101 s3
b00000110 s5
b00000110 s9
1s10
b00000101 s11
#90
0s2
0s10
#95
1s2
b00000110 s3
b00000111 s5
b00000111 s9
1s10
b00000110 s11
#100
0s2
0s10

Suggestion: an argument to specify sample range

Hi @yne , thanks for this!

It might be useful to be able to specify a sample range (e.g. -t=100-200, or -t=100:200, not sure what is the more standard syntax). Then it would be possible to write a wrapper script that would clear the screen and redraw the waves with a different sample range, to give the appearance of left-right scrolling of the waveforms.

realoc() instead of MAX_SAMPLE definition

As discussed on #11 (comment), it would be nice that vcd does not care too much about the file size(s) of .vcd.

IMHO the visualization is not important (vertical vs horizontal), but I'd like to open those files transparently without getting errors or having to count lines and define MAX_SAMPLE accordingly.

Segfault on libsigrok acquired capture

Testing with this input file from a libsigrok capture:

H-UDI_libsigrok_only_first_10000_records.vcd.zip

I'm getting the following segfault:

% lldb vcd
(lldb) target create "vcd"
Current executable set to '/Users/rvalls/dev/personal/vcd/vcd' (arm64).
(lldb) settings set target.input-path samples/H-UDI_libsigrok_only_first_10000_records.vcd
(lldb) process launch
Process 97181 launched: '/Users/rvalls/dev/personal/vcd/vcd' (arm64)
Process 97181 stopped
* thread #1, queue = 'com.apple.main-thread', stop reason = EXC_BAD_ACCESS (code=1, address=0xffffec6cfe2bbe50)
    frame #0: 0x000000010000305c vcd`parseVcdSample(p=0x000000016f7acc98, c=48) at vcd.c:145:49
   142 	  }
   143 	  char id_str[MAX_NAME];
   144 	  scanf("%" TXT(SFL) "[^\n]", id_str);
-> 145 	  p->ch[chanId(id_str)].samples[p->total - 1] = s;
   146 	}
   147
   148 	void parseVcd(ParseCtx* p) {
Target 0: (vcd) stopped.
(lldb) bt
* thread #1, queue = 'com.apple.main-thread', stop reason = EXC_BAD_ACCESS (code=1, address=0xffffec6cfe2bbe50)
  * frame #0: 0x000000010000305c vcd`parseVcdSample(p=0x000000016f7acc98, c=48) at vcd.c:145:49
    frame #1: 0x000000010000310c vcd`parseVcd(p=0x000000016f7acc98) at vcd.c:156:7
    frame #2: 0x000000010000397c vcd`main(argc=1, argv=0x000000016fdff440) at vcd.c:220:3
    frame #3: 0x00000001000110f4 dyld`start + 520

Refinement of the application

good day
I started using and improving this application.
I plan to keep the ideology of a minimalistic solution.
My todo:

  • Added support for icarus vvp
  • Fixed bug with display UZX on binary lines
  • Fixed display 0 status on binary lines
  • Added timeline
  • TUI

Are you planning to develop a project? Will you be happy with "Pull requests"?
Maybe I should develop it myself?

Here you can see how the work is going: https://github.com/MuratovAS/vcd

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.