2

I have a problem in SystemC trying to write a signal after some time passes...

Consider the following:

process (clk)
   begin
      -- Updating my signal, out signal, in order to get result, but after a certain delay.
      signal1 <= '0' after 2 ns;

OK! I can do the same in SystemC:

SC_CTOR(MyModule) {
   SC_METHOD(mymethod);
   sensitive << ....
}
void mymethod() {
   mysig = '0'; // HOW TO SAY AFTER 2 NS?????????
}

How can I specify a delay for signal assignment in SystemC????

Martin Thompson
  • 16,395
  • 1
  • 38
  • 56
Andry
  • 16,172
  • 27
  • 138
  • 246

2 Answers2

2

I think you can wait(2, SC_NS); in SC_THREADs, but not in a SC_METHODs. (AFAIK, you're not allowed to wait in SC_METHODs.)

Marty
  • 6,494
  • 3
  • 37
  • 40
  • no you can't use `wait` in `SC_METHOD`. `wait()` function calls yeild on current fiber, and there is no where to switch to, so it would cause a crash. – Gene Bushuyev Jun 07 '11 at 02:52
  • I had the same question and was unable to find what Gene is talking about. The way I ended up doing it was a separate wait() statement followed by the assignment. – Rich Dec 18 '12 at 16:12
0

I'm forgetting SC syntax already, but it should be similar to GBL, the write function should take an optional delay parameter, like mysig.write(0, 2*SC_NS); In GBL it's either mysig.Write(0, 2*ns); or alternative syntax: mysig(2*ns) = 0;

Gene Bushuyev
  • 5,512
  • 20
  • 19