Jump to content

rainer

Members
  • Content Count

    3
  • Joined

  • Last visited

  1. Hi Philipp, thank you for the quick answer and for taking care of this! BR, Rainer.
  2. Hi, I'm using cci_value::from_json(std::string const & json) to allow users to set model parameters. If the supplied json string is invalid JSON, ie. cannot be deserialized correctly, the function fails rather harshly in the CCI 1.0.0 PoC implementation -- it simply sc_assert()'s that the conversion was ok: inline cci_value cci_value::from_json( std::string const & json ) { cci_value v; bool ok = v.json_deserialize( json ); sc_assert( ok ); return v; } In SystemC 2.3.2, sc_assert() calls sc_assertion_failed() in case of a failure, which in turn, reports an SC_FATAL, the default action of which includes to abort() the program. In case of an invalid user input, it obviously makes more sense to actually handle the error. However, the best I could come up with to deal with the SC_FATAL is this: auto const old_actions = sc_core::sc_report_handler::set_actions(sc_core::SC_FATAL, sc_core::SC_THROW); cci::cci_value value; try { value = cci::cci_value::from_json(user_supplied_string); } catch (sc_core::sc_report &) { SC_REPORT_WARNING(...); return; } sc_core::sc_report_handler::set_actions(sc_core::SC_FATAL, old_actions); This seems kind of clunky for what I assume is a rather common operation. Is the use of sc_assert() an oversight or am I missing something here? As a side node, while I have to admit that I haven't read the CCI LRM in depth, it gives this description, which doesn't seem to agree with the implementation (emphasis mine): and Thanks, Rainer.
  3. gtkwave actually supports strings in VCD files as an extension (see, eg., https://sourceforge.net/p/gtkwave/support-requests/2/ and the sample VCD file thats attached). With hacking the kernel to support tracing strings, as Roman mentioned, this works well in SystemC (I wrote such a patch some time ago, but unfortunately don't have it available anymore). Still, this means that your model will only work with the patched kernel and the VCD will only display correctly in gtkwave. test.vcd
×
×
  • Create New...