Ah, that’s the thing I’m looking for. I didn’t even try to think whether “during elaboration” includes end_of_elaboration(). Now I am clear on it. Thanks!
Regards,
Michael
From: alan.fitch@xxxxxxxxxx [mailto:alan.fitch@xxxxxxxxxx]
Sent: Sunday, March 25, 2012 10:57 PM
To: Michael
Cc: 'amal banerjee'; systemc-forum@xxxxxxxxxxxxxxxxxxx
Subject: RE: [systemc-forum] Cannot set time resolution at end of elaboration
OK, I misunderstood (well to be honest I didn't read your example carefully enough!).
The LRM is correct by definition, i.e. it is the definition of SystemC (that is SystemC is defined by the LRM, not by the behaviour of the proof-of-concept simulator). But of course the LRM may be unclear...
In the SystemC 2011 LRM there is a specific definition for the phrase "during elaboration" on page 7
"The term during elaboration includes the construction of the module hierarchy and the
before_end_of_elaboration callbacks."
So it the LRM has been clarified in 1666-2011 to state that sc_set_time_resolution cannot be called from end_of_elaboration, because end_of_elaboration is not covered by "during_elaboration". This now matches the behaviour of the SystemC 2.2 proof-of-concept simulator.
kind regards
Alan
--
Alan Fitch
Senior Consultant
Hi Alan,
I’m aware of that rule. But clearly the sc_time object is not constructed by the user design - all the things I have is just a simple empty module. If SystemC kernel constructs an sc_time object internally before end_of_elaboration(), then I think the LRM should get fixed. Otherwise it’s somehow misleading since the user doesn’t construct any sc_time object explicitly.
Regards,
Michael
From: alan.fitch@xxxxxxxxxx [mailto:alan.fitch@xxxxxxxxxx]
Sent: Sunday, March 25, 2012 1:02 PM
To: Michael
Cc: 'amal banerjee'; systemc-forum@xxxxxxxxxxxxxxxxxxx
Subject: RE: [systemc-forum] Cannot set time resolution at end of elaboration
Hi Michael and Amal,
the rule is that you must use sc_set_time_resolution before end_of_elaboration *and* before any objects of type sc_time have been created. I'll just look that up....
See IEEE 1666-2005 section 5.10.3 or IEEE 1666-2011 section 5.11.3
"This function shall only be called during elaboration, shall not be called more than once, and shall not be called after
constructing an object of type sc_time with a non-zero time value."
That's what your error message is telling you, an object of type sc_time has already been constructed at the point you call the function,
kind regards
Alan
--
Alan Fitch
Senior Consultant
Doulos - Developing Design Know-how
VHDL * Verilog * SystemVerilog * SystemC * PSL * Perl * Tcl/Tk * Project Services
Doulos Ltd. Church Hatch, 22 Market Place, Ringwood, Hampshire, BH24 1AW, UK
Tel: + 44 (0)1425 471223 Email: alan.fitch@xxxxxxxxxx
Fax: +44 (0)1425 471573 http://www.doulos.com
--------------------------------------------------------------------------------
Doulos Ltd is registered in England and Wales with company no. 3723454
Its registered office is 4 Brackley Close, Bournemouth International Airport,
Christchurch, BH23 6SE, UK.
This message (and associated files) may contain information that is confidential,
proprietary, privileged, or subject to copyright. It is intended solely for the use
of the individual to whom it is addressed and others authorised to receive it. If
you have received this email in error, please notify the sender and delete all
copies. This message may contain personal views which are not the views of
Doulos, unless specifically stated.
Hi Amal,
I’m also using 2.2. So it looks like at least I’m not committing mistake in my code..
Regards,
Michael
From: amal banerjee [mailto:dakupoto@xxxxxxxxx]
Sent: Saturday, March 24, 2012 11:18 PM
To: systemc-forum@xxxxxxxxxxxxxxxxxxx; Michael
Subject: Re: [systemc-forum] Cannot set time resolution at end of elaboration
Hello,
Which version of SystemC are
you using ? I have faced the
same problem with SystemC-2.2.0,
the current stable version. I could
not resolve it despite advice from
the forum gurus and ended up
just removing it and using only
sc_core::sc_clock. Let us see
what the others say.
On Sat, Mar 24, 2012 at 8:32 PM, Michael <michael6866@xxxxxxxxx> wrote:
Hi guys,
On page 15 of IEEE 1666-2011 it states that “The simulation time resolution can be set during elaboration”. But when I tried to use sc_set_time_resolution() in end_of_elaboration() callback it reports an error “sc_time object<s> constructed”. If I do that in end_of_construction() instead then it’s fine. But clearly on page 12 it says end_of_elaboration() is a part of elaboration phase. Am I missing anything?
SC_MODULE(Top)
{
void end_of_elaboration()
{
sc_set_time_resolution(100,SC_PS); // error
}
void end_of_construction()
{
//sc_set_time_resolution(100,SC_PS); // fine
}
SC_CTOR(Top) {}
};
int sc_main (int argc, char* argv[])
{
Top top(“top”);
sc_start();
return 0;
}
Regards,
Michael