Quantcast
Channel: SystemC Language Forum RSS Feed
Viewing all articles
Browse latest Browse all 595

systemC vcd trace file cannot open display

$
0
0

hi all,

    I am just starting my practical implementations in systemC. Below i have implemented a constant module which produces the constant o/p and it is connected to a counter module.

 

 

constant.h
#define SC_INCLUDE_FX
#include "systemc.h"
#include <stdlib.h>
SC_MODULE(constant){
sc_out<bool> output;

int A;
void process(){    //
while(true)
{
wait(19,SC_MS);   // sample time + delay
A=1;
output.write(A);
cout<< "@"<<sc_time_stamp() << " ::constant output written" << output << endl;
}
}
SC_CTOR(constant)
{
SC_THREAD(process);
}
};
 

 

counter.h
#include <systemc.h>
#include <iostream>
#define SC_INCLUDE_FX
SC_MODULE (counter) {
  sc_in<bool> reset;
  sc_in<bool> enable;
  sc_out<sc_ufixed<12,12, SC_TRN, SC_SAT> > counter_out;

  sc_ufixed<12,12, SC_TRN, SC_SAT> count;

   void incr_count () {
   while(true){
   wait(19, SC_MS);
   if (reset.read() == 1) {
      count =  0;
      counter_out.write(count);
      cout<<"@" << sc_time_stamp()<< "::COUNTER IS RESET " <<  counter_out.read() << endl;
    }
     if (enable.read() == 1) {
      count=count+1;
      counter_out.write(count);
      cout<<"@" << sc_time_stamp() <<" :: Incremented Counter "<<counter_out.read()<<endl;
    }
   }
   }
      SC_CTOR(counter) {
      cout<< " executing counter"<< endl;
      SC_THREAD(incr_count);
      dont_initialize();
      sensitive  <<reset << enable ;
    }
};

 

 

test.cpp
#define SC_INCLUDE_FX
#include "count.h"
#include "constant.h"
#include "systemc.h"
int sc_main (int argc, char* argv[]) {
    sc_buffer<sc_ufixed<8,8, SC_TRN, SC_SAT> > dinsignal;
    sc_buffer<bool> rstsignal;
    sc_buffer<bool> ensignal;
    sc_buffer <sc_ufixed<12,12, SC_TRN, SC_SAT > >outputsignal;

     constant c1("constant");
     c1.output(ensignal);


       counter c2("counter");
        c2.reset(rstsignal);
        c2.enable(ensignal);
        c2.counter_out(outputsignal);


        sc_trace_file *tf = sc_create_vcd_trace_file("VCD test");
         // External Signals
         sc_trace(tf, ensignal, "Enable signal");
         sc_trace(tf, outputsignal, "output signal");


        rstsignal = 1;
        sc_start(1, SC_SEC);
        rstsignal = 0;
        sc_start(1, SC_SEC);
        
        sc_close_vcd_trace_file(tf);


        return 0;
}
 

 

The module's works correctly as i expected.

 

But the problem is with the vcd trace file. The main module produces a vcd file of type .vcd format but when i tried to open it in the gtkwave viewer, the vcd file cannot be opened. There is no error message also for debugging the problem.

 

So I thought of debugging the vcd file in a text editor and found this output

 
date
     Oct 08, 2013       15:38:51
$end

$version
              SystemC 2.3.0-ASI --- Aug 26 2013 11:03:53
$end

$timescale
     1 ps
$end

$scope module SystemC $end
$var wire    1  aaa  Enable signal       $end
$var wire   12  aab  output signal [11:0]  $end
$upscope $end
$enddefinitions  $end

$comment
All initial values are dumped below at time 0 sec = 0 timescale units.
$end


$dumpvars
0aaa
b0 aab
$end


#19000000000
1aaa


#38000000000
b1 aab


....


....


....
 

 

As you can see the comment in the tracefile

 All initial values are dumped below at time 0 sec = 0 timescale units.

So is this the reason the vcd file cannot be opened? if yes, what changes do i need to do in the main module to get worked?

(or) the problem would be related to installation of gtkwave viewer?

 

Please help me how to proceed to the problem solution.

 

Thanks in advance.

 

 


Viewing all articles
Browse latest Browse all 595

Trending Articles