shaddad Posted July 31 Report Share Posted July 31 I have an issue with fsdb dump when simulation in systemc fails using an assert statement such as (assert(a==b) .. etc. The signals in the waveform show as nf (not found). Any way to fix this issue? Quote Link to comment Share on other sites More sharing options...
Eyck Posted July 31 Report Share Posted July 31 The only option is to close your database properly. BTW, this only applies to VCD or transaction recording (e.g. https://github.com/Minres/LWTR4SC). One way to achieve this under Linux would be to use the setjmp/longjmp mechanism: #include <systemc> ... #include <csetjmp> #include <csignal> using namespace sc_core; jmp_buf abrt; void ABRThandler(int sig) { longjmp(abrt, 1); } int sc_main(int argc, char* argv[]) { signal(SIGABRT, ABRThandler); /////////////////////////////////////////////////////////////////////////// // create toplevel, trace, etc /////////////////////////////////////////////////////////////////////////// ... /////////////////////////////////////////////////////////////////////////// // run the simulation /////////////////////////////////////////////////////////////////////////// int ret = -1; if(setjmp(abrt) == 0) { try { sc_start(); } } catch(sc_report& rep) { sc_report_handler::get_handler()(rep, SC_DISPLAY | SC_STOP); } // make sure end_of_simulation gets invoked if(!sc_end_of_simulation_invoked()) { sc_stop(); } ret = sc_report_handler::get_count(SC_ERROR) + sc_report_handler::get_count(SC_WARNING); } else { ret = -1; } /////////////////////////////////////////////////////////////////////////// // close databases, cleanuo /////////////////////////////////////////////////////////////////////////// ... /////////////////////////////////////////////////////////////////////////// // finish execution returning the number of errors/warnings as exit status /////////////////////////////////////////////////////////////////////////// return ret; } It also reports the number of warnings and errors so that it can be used in CI scenarios or regression testing. Quote Link to comment Share on other sites More sharing options...
shaddad Posted July 31 Author Report Share Posted July 31 The vcd file is good and does not have any problem showing signals' values with the sim is ended with assert. We still need a fix for the fsdb (verdi) issue. Pls help if you can! Quote Link to comment Share on other sites More sharing options...
Eyck Posted August 14 Report Share Posted August 14 This is not entirely true, VCD has the same problems only at a different scale. Writing a text file using fwrite usually employs buffering for performance reasons. Stopping a program using abort (called by a failing assert) will not write this buffer to disc. So the content is lost. Depending of the amount a signals being traced and their activiy you might loose the most interesting part of the trace.... On 8/1/2024 at 1:21 AM, shaddad said: We still need a fix for the fsdb (verdi) issue. This cannot be fixed in fsdb, you need to modify your sc_main to allow proper closing of trace database(s). 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.