Jump to content

Can I close sc_trace_file dynamically at any time?


Recommended Posts



Can I close sc_trace_file dynamically? Can I use sc_close_vcd_trace_file(wf) at any time after sc_trace and sc_create_vcd_trace_file(); I believe so but there is no error in compile time, but it make a Segmentation fault.





  SC_THREAD ( vcd_ctrl);






void vcd_ctrl() {

  while(1) {


     if(command=="off") {



     else if(command=="on") {

         wf = sc_create_vcd_trace_file("wave");








Program received signal SIGSEGV, Segmentation fault.
0x00000019 in sc_get_curr_simcontext (this=0x84a7658, value_=...)
    at '/systemc/include/sysc/kernel/sc_simcontext.h:379
379         if( sc_curr_simcontext == 0 ) {
Missing separate debuginfos, use: debuginfo-install glibc-2.12-1.80.el6_3.6.i686 libgcc-4.4.6-4.el6.i686 libstdc++-4.4.6-4.el6.i686
(gdb) where
#0  0x00000019 in sc_get_curr_simcontext (this=0x84a7658, value_=...)
    at '/systemc/include/sysc/kernel/sc_simcontext.h:379
#1  sc_core::sc_signal<sc_dt::sc_logic>::write (this=0x84a7658, value_=...)
    at '/systemc/include/sysc/communication/sc_signal.h:690
#2  0x0835a73f in sc_core::sc_simcontext::simulate(sc_core::sc_time const&) ()
#3  0x0835b4e0 in sc_core::sc_start() ()
#4  0x08106454 in sc_main (argc=6, argv=0xffffbb14) at ./tb/sc_plamo.cpp:81
#5  0x0834d4b3 in sc_elab_and_sim ()
#6  0x0834d3c2 in main ()
Link to comment
Share on other sites

Again the LRM says "NOTE—A trace file can be opened at any time, but no mechanism is available to switch off tracing before the end of simulation."


I suppose you could open and close multiple different trace files with the same signals, and then combine after simulation using a script.




Link to comment
Share on other sites

thank Alan for reply.

Then, are there any way to turn on/off the trace during the simulation?


Hello Sir,

Echoing essentailly what Mr. Alan has said, please

note also that the sc_trace file object is not very

flexible, to achieve the goals that you have stated.


You could create your own customized trace file

object -- SystemC is just a ANSI C++ library. One

can create a custom trace file that can be plotted

with e.g., gnuplot or Excel without any problems.

The advantage is that one could for example,

write to the custom trace file if some condition

is satisfied -- just use appropriate guards.

Hope that helps.

Link to comment
Share on other sites

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.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Create New...