All Projects → ben-marshall → verilog-vcd-parser

ben-marshall / verilog-vcd-parser

Licence: MIT license
A parser for Value Change Dump (VCD) files as specified in the IEEE System Verilog 1800-2012 standard.

Programming Languages

C++
36643 projects - #6 most used programming language
Lex
420 projects
Makefile
30231 projects

Projects that are alternatives of or similar to verilog-vcd-parser

xeda
Cross EDA Abstraction and Automation
Stars: ✭ 25 (-45.65%)
Mutual labels:  vhdl, verilog
Awesome Open Hardware Verification
A List of Free and Open Source Hardware Verification Tools and Frameworks
Stars: ✭ 103 (+123.91%)
Mutual labels:  vhdl, verilog
Ophidian
Ophidian's Mirror Repository on github. https://gitlab.com/eclufsc/eda/ophidian
Stars: ✭ 32 (-30.43%)
Mutual labels:  vhdl, verilog
Cocotb
cocotb, a coroutine based cosimulation library for writing VHDL and Verilog testbenches in Python
Stars: ✭ 740 (+1508.7%)
Mutual labels:  vhdl, verilog
svut
SVUT is a simple framework to create Verilog/SystemVerilog unit tests. Just focus on your tests!
Stars: ✭ 48 (+4.35%)
Mutual labels:  verilog, vcd
Clash Compiler
Haskell to VHDL/Verilog/SystemVerilog compiler
Stars: ✭ 958 (+1982.61%)
Mutual labels:  vhdl, verilog
J1sc
A reimplementation of a tiny stack CPU
Stars: ✭ 64 (+39.13%)
Mutual labels:  vhdl, verilog
Edalize
An abstraction library for interfacing EDA tools
Stars: ✭ 270 (+486.96%)
Mutual labels:  vhdl, verilog
Degate
Open source software for chip reverse engineering.
Stars: ✭ 156 (+239.13%)
Mutual labels:  vhdl, verilog
Tinytpu
Implementation of a Tensor Processing Unit for embedded systems and the IoT.
Stars: ✭ 153 (+232.61%)
Mutual labels:  vhdl, verilog
Spinalhdl
Scala based HDL
Stars: ✭ 696 (+1413.04%)
Mutual labels:  vhdl, verilog
SpinalDev
Docker Development Environment for SpinalHDL
Stars: ✭ 17 (-63.04%)
Mutual labels:  vhdl, verilog
Awesome Hdl
Hardware Description Languages
Stars: ✭ 385 (+736.96%)
Mutual labels:  vhdl, verilog
Image Processing
Image Processing Toolbox in Verilog using Basys3 FPGA
Stars: ✭ 31 (-32.61%)
Mutual labels:  vhdl, verilog
Microwatt
A tiny Open POWER ISA softcore written in VHDL 2008
Stars: ✭ 383 (+732.61%)
Mutual labels:  vhdl, verilog
Vexriscv
A FPGA friendly 32 bit RISC-V CPU implementation
Stars: ✭ 1,041 (+2163.04%)
Mutual labels:  vhdl, verilog
docker
Scripts to build and use docker images including GHDL
Stars: ✭ 27 (-41.3%)
Mutual labels:  vhdl, verilog
intfftk
Fully pipelined Integer Scaled / Unscaled Radix-2 Forward/Inverse Fast Fourier Transform (FFT) IP-core for newest Xilinx FPGAs (Source language - VHDL / Verilog). GNU GPL 3.0.
Stars: ✭ 43 (-6.52%)
Mutual labels:  vhdl, verilog
Hdl checker
Repurposing existing HDL tools to help writing better code
Stars: ✭ 103 (+123.91%)
Mutual labels:  vhdl, verilog
fpga-docker
Tools for running FPGA vendor toolchains with Docker
Stars: ✭ 54 (+17.39%)
Mutual labels:  vhdl, verilog

VCD Tools

This is a multipurpose utility for handling VCD files.
It started as a fork of the excellent Verilog VCD Parser, therefore keeping its original README file below.

Features

  • Display full path of signals contained within th VCD file.
  • Display the list of scopes within the VCD file.
  • Display VCD file header
  • Display number of toggles for each signal
  • Restrict VCD file to a range of timestamps

TODO

  • Export VCD file (useful for producing a cut-down VCD file)
  • Filter some signals/scopes (useful for the VCD export)

Please see below for the original Verilog VCD Parser README.md file:


Verilog VCD Parser

Documentation

This project implements a no-frills Value Change Dump (VCD) file parser, as described in the IEEE System Verilog 1800-2012 standard. It can be used to write custom tools which need to read signal traces dumped out by Verilog (or VHDL) simulators.


Getting Started

After cloning the repository to your local machine, run the following in a shell:

$> cd ./verilog-vcd-parser
$> make all

This will build both the demonstration executable in build/vcd-parser and the API documentation in build/docs.

Code Example

This code will load up a VCD file and print the hierarchy of the scopes and signals declared in it.

VCDFileParser parser;

VCDFile * trace = parser.parse_file("path-to-my-file.vcd");

if(trace == nullptr) {
    // Something went wrong.
} else {

    for(VCDScope * scope : *trace -> get_scopes()) {

        std::cout << "Scope: "  << scope ->  name  << std::endl;

        for(VCDSignal * signal : scope -> signals) {

            std::cout << "\t" << signal -> hash << "\t" 
                      << signal -> reference;

            if(signal -> size > 1) {
                std::cout << " [" << signal -> size << ":0]";
            }
            
            std::cout << std::endl;

        }
    }

}

We can also query the value of a signal at a particular time. Because a VCD file can have multiple signals in multiple scopes which represent the same physical signal, we use the signal hash to access it's value at a particular time:

// Get the first signal we fancy.
VCDSignal * mysignal = trace -> get_scope("$root") -> signals[0];

// Print the value of this signal at every time step.

for (VCDTime time : *trace -> get_timestamps()) {

    VCDValue * val = trace -> get_signal_value_at( mysignal -> hash, time);

    std::cout << "t = " << time
              << ", "   << mysignal -> reference
              << " = ";
    
    // Assumes val is not nullptr!
    switch(val -> get_type()) {
        case (VCD_SCALAR):
            std::cout << VCDValue::VCDBit2Char(val -> get_value_bit());
            break;
        case (VCD_VECTOR):
            VCDBitVector * vecval = val -> get_value_vector()
            for(auto it = vecval -> begin();
                     it != vecval -> end();
                     ++it) {
                std::cout << VCDValue::VCDBit2Char(*it);
            }
            break;
        case (VCD_REAL):
            std::cout << val -> get_value_real();
        default:
            break;
    }

    std::cout << endl;

}

The example above is deliberately verbose to show how common variables and signal attributes can be accessed.

Integration

It is assumed that given a set of source files, it will be easy for people to integrate this as a submodule of their own projects. However, Flex and Bison must be run before all compilable source files are present. If integrating this into a larger project, you will want to ensure the following commands are run before compiling any of the VCD parser sources.

$> make parser-srcs

This will run flex and bison on the .ypp and .l files in src/ and put the generated parser and lexer code in build/. The complete file list for inclusion in a larger project is:

src/VCDFile.cpp
src/VCDFileParser.cpp
src/VCDValue.cpp
build/VCDParser.cpp
build/VCDScanner.cpp

With header files located in both src/ and build/.

Integration using static link library

build/libverilog-vcd-parser.a and the required .hpp files are copied into build/.

To use these from another application add -I and the .a file to your gcc command line:

$ gcc -Ibuild/ build/libverilog-vcd-parser.a myapp.cpp

Tools

  • The parser and lexical analyser are written using Bison and Flex respectively.
  • The data structures and other functions are written using C++ 2011.
  • The build system is GNU Make.
  • The codebase is documented using Doxygen.
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].