1

What I want to do feels like sending av event from one module to another (like pressing a button). But as I have searched it seems that it should be done in an other way becuase I haven't found any standard way to send av event trigger/notification.

My simple model consists of two mudules, 1 Generator and 1 Controller. I want the Generator to be able to set an internal boolean in the Controller to true (indicating that there has been a registration on a sensor). The controller has a thread that acts if there has been a registration since last time and then resets the bool to false (effectively ignoring and discarding more sensor registrations during the 5 second wait).

if(sensor_activity)
{
    doStuff();
    wait(5, SC_SEC);
    sensor_activity = 0;
}

How should I send my signal from Generator to Controller?

Moberg
  • 5,253
  • 4
  • 38
  • 54
  • One solution could be to let Generator send pulses for let's say 1 ms to indicate a trigger. But it feels sloppy.. – Moberg Jan 31 '13 at 22:46
  • Put a port out of the one module and into the other then join them up... – Ifor Feb 01 '13 at 11:11
  • If I send a hundred 1's it will only detect the first one. How do you mean I should join them? What type/port/channel? – Moberg Feb 01 '13 at 11:49

2 Answers2

0

Use a buffer. It will trigger even if u write the value that it already has.

Moberg
  • 5,253
  • 4
  • 38
  • 54
0

There are so many ways this can be done.

  1. Systemc is basically C++. So generator can call a public function of controller, which will notify an internal event, which will trigger required thread.
  2. Make a process in controller sensitive to a port, which will notify an internal event, which will trigger required thread. Write to the port from generator.
  3. Declare a global sc_event variable. Now notify it in generator and use it to trigger the thread in controller.
zehawk
  • 210
  • 1
  • 10
  • 1: Didn't think of that, may be an option. 2: How will I see if there has happened a write? 3: Global events doesn't seem fitting. – Moberg Aug 09 '13 at 09:17
  • For #2, like I said, make the process in controller sensitive to the port. Toggle the value written to the port from generator, it will automatically trigger the process. – zehawk Aug 21 '13 at 10:49
  • So I need to keep a local value in the caller that I toggle and send? – Moberg Aug 22 '13 at 19:39