• Skip to main content
  • Skip to search
  • Skip to footer
Cadence Home
  • This search text may be transcribed, used, stored, or accessed by our third-party service providers per our Cookie Policy and Privacy Policy.

  1. Community Forums
  2. Mixed-Signal Design
  3. Shift VCD timeline

Stats

  • Locked Locked
  • Replies 1
  • Subscribers 64
  • Views 13858
  • Members are here 0
This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Shift VCD timeline

pyohayo
pyohayo over 6 years ago

Hello,

I wonder if there is a cadence tool that allows you to shift the time values in a VCD file, for example translate the range 700us ... 1000us to the range 0 ... 300us.

Thanks.

  • Cancel
Parents
  • pyohayo
    pyohayo over 6 years ago

    Well ... I've developed a small program: probably will be useful for someone (filenane vcd_timeline_shifter.cpp):

    #include <fstream>
    #include <string>
    #include <sstream>

    using namespace std;

    int main(int argc, char *argv[]) {
    string input_file;
    string output_file;
    long int time_shift;

    if(argc < 3)
    {
    printf("\n\nPrograme usage: vcd_timeline_shifter {name_of_vcd_file} {shift time in fs}\n\n\n");
    return 0;
    } else {
    input_file = argv[1];
    output_file = input_file.substr(0, input_file.find('.')) + "_shifted.vcd";
    time_shift = atol(argv[2]);
    }

    string input_line;
    ifstream fin(input_file);
    ofstream fout(output_file);

    if(fin.is_open() && fout.is_open())
    {
    while(getline(fin, input_line))
    {
    if(input_line[0] == '#')
    {
    stringstream ss;
    ss << '#' << stol(input_line.substr(1))- time_shift;
    input_line = ss.str();
    }
    fout << input_line << endl;
    }
    fin.close();
    fout.close();
    } else {
    printf("Cannot open file %s\n", argv[1]);
    return 0;
    }
    }

    Compilation:

    g++   -std=c++11 vcd_timeline_shifter.cpp -o vcd_timeline_shifter  

     Usage: 

    ./vcd_timeline_shifter {name_of_vcd_file} {time_shift_in_fs}

    it generates file with prefix _shifted.

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
Reply
  • pyohayo
    pyohayo over 6 years ago

    Well ... I've developed a small program: probably will be useful for someone (filenane vcd_timeline_shifter.cpp):

    #include <fstream>
    #include <string>
    #include <sstream>

    using namespace std;

    int main(int argc, char *argv[]) {
    string input_file;
    string output_file;
    long int time_shift;

    if(argc < 3)
    {
    printf("\n\nPrograme usage: vcd_timeline_shifter {name_of_vcd_file} {shift time in fs}\n\n\n");
    return 0;
    } else {
    input_file = argv[1];
    output_file = input_file.substr(0, input_file.find('.')) + "_shifted.vcd";
    time_shift = atol(argv[2]);
    }

    string input_line;
    ifstream fin(input_file);
    ofstream fout(output_file);

    if(fin.is_open() && fout.is_open())
    {
    while(getline(fin, input_line))
    {
    if(input_line[0] == '#')
    {
    stringstream ss;
    ss << '#' << stol(input_line.substr(1))- time_shift;
    input_line = ss.str();
    }
    fout << input_line << endl;
    }
    fin.close();
    fout.close();
    } else {
    printf("Cannot open file %s\n", argv[1]);
    return 0;
    }
    }

    Compilation:

    g++   -std=c++11 vcd_timeline_shifter.cpp -o vcd_timeline_shifter  

     Usage: 

    ./vcd_timeline_shifter {name_of_vcd_file} {time_shift_in_fs}

    it generates file with prefix _shifted.

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
Children
No Data

Community Guidelines

The Cadence Design Communities support Cadence users and technologists interacting to exchange ideas, news, technical information, and best practices to solve problems and get the most from Cadence technology. The community is open to everyone, and to provide the most value, we require participants to follow our Community Guidelines that facilitate a quality exchange of ideas and information. By accessing, contributing, using or downloading any materials from the site, you agree to be bound by the full Community Guidelines.

© 2025 Cadence Design Systems, Inc. All Rights Reserved.

  • Terms of Use
  • Privacy
  • Cookie Policy
  • US Trademarks
  • Do Not Sell or Share My Personal Information