Jump to content
hle

reset during wait(int)

Recommended Posts

IEEE 1666-2011 describes wait(int ) as follows:

Quote

A call to this function shall be equivalent to calling the function wait with an empty argument list
for a number of times in immediate succession, the number of times being passed as the value of the
argument. It shall be an error to pass an argument value less than or equal to zero. The
implementation is expected to optimize the execution speed of this function for clocked thread
processes.

If my interpretation is correct,

wait(3);

should always be equivalent to

wait(); wait(); wait();

However, after applying such an equivalent transformation to tests/systemc/kernel/reset_signal_is/test02/test02.cpp from the regression suite, I got a different simulation output (with systemc-2.3.2):

Quote

0 s: initializing
3 ns: waited 3
4 ns: initializing
5 ns: initializing
8 ns: waited 3
11 ns: waited 3
12 ns: initializing
13 ns: initializing
14 ns: initializing
15 ns: initializing
16 ns: initializing

Is this possibly a bug in the reference implementation?

Share this post


Link to post
Share on other sites

I agree with your conclusion that the observed behavior of the proof-of-concept implementation does not match the requirements of IEEE 1666-2011. I checked the code and it can be fixed by adding the check for resets to sc_thread_process.h (in the trigger_static() function):

diff --git a/src/sysc/kernel/sc_thread_process.h b/src/sysc/kernel/sc_thread_process.h
--- a/src/sysc/kernel/sc_thread_process.h
+++ b/src/sysc/kernel/sc_thread_process.h
@@ -485,5 +486,5 @@ sc_thread_process::trigger_static()
 #endif // SC_ENABLE_IMMEDIATE_SELF_NOTIFICATIONS
 
-    if ( m_wait_cycle_n > 0 )
+    if ( m_wait_cycle_n > 0 && THROW_NONE == m_throw_status )
     {
         --m_wait_cycle_n;


I'll take this change to the language working group to get it fixed in a future version of the SystemC PoC kernel. Thanks for reporting!

Greetings from Duisburg,
  Philipp
 

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×