krishna Posted October 14, 2014 Report Share Posted October 14, 2014 Hi All, I am starting the practical implementation of systemc code for 4 bit counter using d flip flop. It works properly as it is, 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. My systemc code is given below //dff.cpp #include <systemc.h> SC_MODULE (dff) { sc_in <bool> clk; sc_in <bool> din; sc_out <bool> dout,; void dff_method() { dout=din; } SC_CTOR (dff) { SC_METHOD (dff_method); sensitive_pos << clk; } } //main.cpp #include <systemc.h> #include "dff.cpp" int sc_main(int argc, char* argv[]) { sc_core::sc_report_handler::set_actions( "/IEEE_Std_1666/deprecated", sc_core::SC_DO_NOTHING ); sc_set_time_resolution(100, SC_PS); sc_signal<bool> din1, dout1; sc_signal<bool> din2, dout2; sc_signal<bool> din3, dout3; sc_signal<bool> din4, dout4; sc_signal<bool> en; sc_signal<bool> clk; int i; dff dff1("dff"); dff1.din(din1); dff1.dout(dout1); dff1.clk(clk); dff dff2("dff"); dff2.din(din2); dff2.dout(dout2); dff2.clk(clk); dff dff3("dff"); dff3.din(din3); dff3.dout(dout3); dff3.clk(clk); dff dff4("dff"); dff4.din(din4); dff4.dout(dout4); dff4.clk(clk); sc_trace_file *fp; // VCD file fp=sc_create_vcd_trace_file("wave"); sc_trace(fp,clk,"clk"); // signals sc_trace(fp,din1,"en"); sc_trace(fp,dout1,"dout_one"); sc_trace(fp,dout2,"dout_two"); sc_trace(fp,dout3,"dout_three"); sc_trace(fp,dout4,"dout_four"); en=1; for(i=0;i<40;i++) { din1=en^dout1; din2=((en&dout1)^dout2); din3=(((en&dout1)&dout2)^dout3); din4=((((en&dout1)&dout2)&dout3)^dout4); clk=0; sc_start(1, SC_NS); clk=1; sc_start(1, SC_NS); cout<<" @ "<<sc_time_stamp()<<" dout: "<<dout4<<dout3<<dout2<<dout1<<endl; } sc_close_vcd_trace_file(fp); return 0; } and the vcd file is shown as below when opened in vi editior: $date Oct 13, 2014 21:46:55 $end $version SystemC 2.3.1-Accellera --- Oct 8 2014 22:37:31 $end $timescale 100 ps $end $scope module SystemC $end $var wire 1 aaaaa clk $end $var wire 1 aaaab en $end $var wire 1 aaaac dout_one $end $var wire 1 aaaad dout_two $end $var wire 1 aaaae dout_three $end $var wire 1 aaaaf dout_four $end $upscope $end $enddefinitions $end $comment All initial values are dumped below at time 0 sec = 0 timescale units. $end $dumpvars 0aaaaa 0aaaab 0aaaac 0aaaad 0aaaae 0aaaaf $end #10 1aaaaa #20 0aaaaa 1aaaab #30 1aaaaa 1aaaac #40 0aaaaa 0aaaab #50 1aaaaa 0aaaac 1aaaad #60 0aaaaa 1aaaab #70 1aaaaa 1aaaac #80 0aaaaa 0aaaab #90 1aaaaa 0aaaac 0aaaad 1aaaae #100 0aaaaa 1aaaab #110 1aaaaa 1aaaac #120 0aaaaa 0aaaab #130 1aaaaa 0aaaac 1aaaad #140 0aaaaa 1aaaab #150 1aaaaa 1aaaac #160 0aaaaa 0aaaab #170 1aaaaa 0aaaac 0aaaad 0aaaae 1aaaaf #180 0aaaaa 1aaaab #190 1aaaaa 1aaaac #200 0aaaaa 0aaaab #210 1aaaaa 0aaaac 1aaaad #220 0aaaaa 1aaaab #230 1aaaaa 1aaaac #240 0aaaaa 0aaaab #250 1aaaaa 0aaaac 0aaaad 1aaaae #260 0aaaaa 1aaaab #270 1aaaaa 1aaaac #280 0aaaaa 0aaaab #290 1aaaaa 0aaaac 1aaaad #300 0aaaaa 1aaaab #310 1aaaaa 1aaaac #320 0aaaaa 0aaaab #330 1aaaaa 0aaaac 0aaaad 0aaaae 0aaaaf #340 0aaaaa 1aaaab #350 1aaaaa 1aaaac #360 0aaaaa 0aaaab #370 1aaaaa 0aaaac 1aaaad #380 0aaaaa 1aaaab #390 1aaaaa 1aaaac #400 0aaaaa 0aaaab #410 1aaaaa 0aaaac 0aaaad 1aaaae #420 0aaaaa 1aaaab #430 1aaaaa 1aaaac #440 0aaaaa 0aaaab #450 1aaaaa 0aaaac 1aaaad #460 0aaaaa 1aaaab #470 1aaaaa 1aaaac #480 0aaaaa 0aaaab #490 1aaaaa 0aaaac 0aaaad 0aaaae 1aaaaf #500 0aaaaa 1aaaab #510 1aaaaa 1aaaac #520 0aaaaa 0aaaab #530 1aaaaa 0aaaac 1aaaad #540 0aaaaa 1aaaab #550 1aaaaa 1aaaac #560 0aaaaa 0aaaab #570 1aaaaa 0aaaac 0aaaad 1aaaae #580 0aaaaa 1aaaab #590 1aaaaa 1aaaac #600 0aaaaa 0aaaab #610 1aaaaa 0aaaac 1aaaad #620 0aaaaa 1aaaab #630 1aaaaa 1aaaac #640 0aaaaa 0aaaab #650 1aaaaa 0aaaac 0aaaad 0aaaae 0aaaaf #660 0aaaaa 1aaaab #670 1aaaaa 1aaaac #680 0aaaaa 0aaaab #690 1aaaaa 0aaaac 1aaaad #700 0aaaaa 1aaaab #710 1aaaaa 1aaaac #720 0aaaaa 0aaaab #730 1aaaaa 0aaaac 0aaaad 1aaaae #740 0aaaaa 1aaaab #750 1aaaaa 1aaaac #760 0aaaaa 0aaaab #770 1aaaaa 0aaaac 1aaaad #780 0aaaaa 1aaaab #790 1aaaaa 1aaaac As you can see the comment in the tracefile $comment All initial values are dumped below at time 0 sec = 0 timescale units. $end 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 waveform? Please help me how to proceed to the problem solution. Thanks in advance. Quote Link to comment Share on other sites More sharing options...
kartikkg Posted October 14, 2014 Report Share Posted October 14, 2014 SC_MODULE (dff) { sc_in <bool> clk;sc_in <bool> din;sc_out <bool> dout,; void dff_method() { dout=din;} SC_CTOR (dff) {SC_METHOD (dff_method);sensitive_pos << clk;}}; Add the semi colon at the end. I compiled this code It works fine . In GTK-Wave you have to click on the System C icon below SST and then add all the signals which appear on the window below . Quote Link to comment Share on other sites More sharing options...
krishna Posted October 15, 2014 Author Report Share Posted October 15, 2014 Kartikkg, Thanks for clarification. I got the waveform with your guidance... Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.