How to simulate output delay using sc_method but without using next_trigger() in SystemC?

106 views Asked by At
SC_MODULE(example) {

  sc_in < int > a, b;

  sc_in < int > out

  Void process() {

    // Output delay implement here

  }

  SC_CTOR(example) {

    SC_METHOD(process);

    sensitivity << a << b;

  }

};
1

There are 1 answers

0
RayaneCTX On

You can define an event and create a timed notification for it within your process method. Then, whatever needs to happen at the end of your delay can be done through another process that is made sensitive to the event.

sc_core::sc_event delay_e;

void process() {
    delay_e.notify(<enter your delay here>);
}

void respond() {
    // Do what needs to happen at the end of the delay...
}

SC_CTOR(example) {
    // ...

    SC_METHOD(respond);
    dont_initialize();
    sensitive << delay_e;
}