Everyone,
Oh, I see. I think the LRM is wrong and the PoC sim is wrong.
The issue is this:
// time = 0
ev.notify(100, SC_NS);
sc_start(50, SC_NS, SC_EXIT_ON_STARVATION);
The current LRM wording says that on exit, simulation time shall be set to
of the most recent event notification, which is 0. But what if there is a
future event notification?
I think I got the LRM wording wrong. I had meant to say:
"If the argument of type sc_starvation_policy has the value
SC_EXIT_ON_STARVATION, the implementation shall set simulation time equal
to either the maximum time of any pending event notification or time-out
or to the end time, whichever is the smaller."
i.e.
start = sc_time_stamp();
sc_start(delay, SC_EXIT_ON_STARVATION);
sc_assert( sc_time_stamp() == MIN ( MAX(time of every pending
notification) , start + delay );
Is that correct?
John A
From:
Andy Goodrich <acg@forteds.com>
To:
john.aynsley@doulos.com
Date:
24/01/2011 09:31
Subject:
Re: Question about sc_start_starvation.cpp
John, here is my change to your test that now succeeds with a fix to the
simulator. Notice the change in assertion I made, which I think is
correct, but I wanted a sanity check on it. I don't think time should move
when the bold face call is made.
Thanks,
Andy
int sc_main(int argc, char* argv[])
{
Top top("top");
sc_assert( sc_get_status() == SC_ELABORATION );
sc_assert( sc_time_stamp() == SC_ZERO_TIME );
sc_start(100, SC_NS);
sc_assert( sc_time_stamp() == sc_time(100, SC_NS) );
sc_start(10, SC_NS, SC_RUN_TO_TIME);
sc_assert( sc_time_stamp() == sc_time(110, SC_NS) );
sc_start(10, SC_NS, SC_EXIT_ON_STARVATION);
// sc_assert( sc_time_stamp() == sc_time(120, SC_NS) );
sc_assert( sc_time_stamp() == sc_time(110, SC_NS) );
sc_start(80, SC_NS, SC_EXIT_ON_STARVATION);
sc_assert( sc_time_stamp() == sc_time(150, SC_NS) );
sc_start();
sc_assert( sc_time_stamp() == sc_time(150, SC_NS) );
sc_assert( sc_get_status() == SC_PAUSED );
cout << endl << "Success" << endl;
return 0;
}
On Jan 24, 2011, at 12:53 AM, john.aynsley@doulos.com wrote:
Andy,
Here's my log...
SystemC 2.3.0_20110120_beta-OSCI --- Jan 21 2011 11:06:20
Copyright (c) 1996-2011 by all Contributors
ALL RIGHTS RESERVED
Fatal: (F4) assertion failed: sc_time_stamp() == sc_time(150, SC_NS)
In file: sc_start_starvation.cpp:42
Abort
If I print out the time when it fails, sc_time_stamp() = 200 NS. I reckon
it should exit after the notification at 150 NS.
John A
From:
Andy Goodrich <acg@forteds.com>
To:
John Aynsley <john.aynsley@doulos.com>
Date:
23/01/2011 22:14
Subject:
Question about sc_start_starvation.cpp
John, I think there is a bug in sc_start_starvation.cpp:
sc_start(10, SC_NS, SC_RUN_TO_TIME);
sc_assert( sc_time_stamp() == sc_time(110, SC_NS) );
sc_start(10, SC_NS, SC_EXIT_ON_STARVATION);
sc_assert( sc_time_stamp() == sc_time(120, SC_NS) );
The second sc_assert fails for me and sc_time_stamp() is still at 100,
SC_NS, which I believe is correct, since no event occurs, so time should
not move.
Am I correct?
Thanks,
Andy
-- This message has been scanned for viruses and dangerous content by MailScanner, and is believed to be clean.Received on Mon Jan 24 01:55:27 2011
This archive was generated by hypermail 2.1.8 : Mon Jan 24 2011 - 01:55:36 PST