View email archives for the history of this mailing list.
systemc-forum - Re: [systemc-forum] SC_TRACE Confusion
- To: vince vince <vincekoskesh@xxxxxxxxxxx>
- From: "Philipp A. Hartmann" <philipp.hartmann@xxxxxxxx>
- Date: Wed, 09 Dec 2009 10:05:58 +0100
- Cc: systemc-forum@xxxxxxxxxxxxxxxxx
- Send Email to firstname.lastname@example.org:
- Send new message
- Reply to this message
On 09/12/09 05:40, vince vince wrote:
> I have produced the trace file. However, I do not see the value of
> the 'app_engine_state_current' change in the trace file, and I can
> guarantee that in my code its value changes. I may not be referencing
> it correctly but I followed a tutorial online :-). Any
> recommendations would be great.
This is one of the subtle gotchas of SystemC... :)
Your 'app_engine_state_current' is of an enumeration type.
Unfortunately, enum variables can't be traced in SystemC directly
(without ugly casts, close to C++ "undefined behaviour").
You could change the type of this variable to a plain "int" (and still
assign only values of your enum to it), which should work.
> Also, I would like to trace a 'app_cache_msg' obj in the 'app_engine'
> obj. (i.e. trace an obj1 within another obj2). Would I need to pass
> the tracefile pointer to the obj1 and place a sc_trace cal for obj2?
Not necessarily. You need to pass the trace file pointer to the
sc_trace overload, that is used to trace that obj1.
> Where would I place the sc_trace call for obj2.. is the contructor of
> obj1 sufficient?
Inside the sc_trace() call for obj1. (Here you changed the roles of obj1
and obj2, right?)
Consider the following:
sc_trace( sc_trace_file* tf
, app_engine const & obj1
, const std::string & name
// trace nested object
sc_trace( tf, obj1.obj2, name + ".obj2" );
sc_trace( sc_trace_file tf*
, app_cache_msg const & obj2
, const std::string & name )
// call sc_trace for local/primitive data
If you have these overloads for your 'app_eninge' and your msg class,
you can simply forward the sc_trace_file from the sc_trace call of the
outer object to the inner object.
Greetings from Oldenburg,
Philipp A. Hartmann
Hardware/Software Design Methodology Group
R&D Division Transportation | FuE-Bereich Verkehr
Escherweg 2 · 26121 Oldenburg · Germany
Phone/Fax: +49-441-9722-420/282 · PGP: 0x9161A5C0 · http://www.offis.de/
Description: OpenPGP digital signature