Jump to content

[Issue] event call notify at the same time


DS1701

Recommended Posts

Hello @all

Description:

I have 2 input port sc_in<Data> input[2];

2 method "HandleInput(int port_index)" (using sc_spawn) with sensitive is input port

1 method "MainProcess"

"HandleInput" method will trigger "MainProcess" with main_process_event.notify(SC_ZERO_TIME)

Symptom :

"HandleInput" is called 2 times ( port_index = 0 and 1) at the same time (It is called before "MainProcess" is called )

"MainProcess" is called 2 times -> This is not desirable, My expected is "MainProcess" is called 1 time

I tried to reproduce it with the simple code ( as my attached), but I can't

As my check:

1. "HandleInput" with port index = 0 is called -> main_process_event.notify(SC_ZERO_TIME) is called -> m_notify_type = DELTA -> sc_event::trigger() is called

2. "HandleInput" with port index = 1 is called -> main_process_event.notify(SC_ZERO_TIME) is called ....

Because at (1) sc_event::trigger() is called => m_notify_type = NONE => So, at (2), when  main_process_event.notify(SC_ZERO_TIME) is called, kernel add new delta event => MainProcess triggered 2 times   

But I don't know why at(1) sc_event::trigger() is called ?, I think (1) and (2)  are same phase (Evaluate), I don't know this is a systemc bug or not?
Could you please to support?
BRs

DUT.cpp main.cpp

Link to comment
Share on other sites

  • DS1701 changed the title to [Issue] event call notify at the same time

Your understanding is correct: if a process (MainProcess in your case) is waiting on an event (main_process_event) that is notified twice in two different processes that are part of the same eval phase (using delta notification), then the process will be triggered only once - in the next evaluation phase.

In general, an event will have only one pending notification. The details are in "5.10.8 Multiple event notifications".

So, you have to debug your original code - to find out why MainProcess is getting triggered twice. In addition to sc_time_stamp(), you can also print sc_delta_count() - to check which delta cycle the event notification is being done (and which delta cycle the process is getting triggered).

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...