Jump to content

sequence processing


DS1701

Recommended Posts

I have a simple code as bellow:

class Tmodel{
private:
   sc_event notify_method_2;
   sc_event notify_method_4;
public:
  sc_event notify_method_3;
  sc_in<bool> input_port;
  ...
   SC_METHOD(method_1);
   dont_initialize();
   sensitive << input_port;

  SC_METHOD(method_2);
   dont_initialize();
   sensitive << notify_method_2;
  
  SC_METHOD(method_3);
   dont_initialize();
   sensitive << notify_method_3;
  
  SC_METHOD(method_4);
   dont_initialize();
   sensitive << notify_method_4;
  ...
  void method_1(void){
       ...
       notify_method_2.notify(SC_ZERO_TIME);
  }
  void method_2(void){
       ...
       printf("method_2\n");
  }
  void method_3(void){
       notify_method_4.notify(SC_ZERO_TIME);
  }
  void method_4(void){
       printf("method_4\n");
  }
  
};

int sc_main(int , char *){
  ...
   objectDUT->input_port.write(true);
  objectDUT->notify_method_3.notify(SC_ZERO_TIME);
  sc_start(200,SC_PS);
  ...
}

when debug, steps as bellow:

1. method_1 , call notify_method_2

2. method_3, call notify_method_4

3. method_4

4. method_2

I dont understand why at step 3 is method_4 ( I think it is method_2 ). 

if in sc_main, I insert sc_start(0,SC_PS);

int sc_main(int , char *){
  ...
   objectDUT->input_port.write(true);
sc_start(0,SC_PS);
  objectDUT->notify_method_3.notify(SC_ZERO_TIME);
  sc_start(200,SC_PS);
  ...
}

steps is correct:

1. method_1 , call notify_method_2

2. method_3, call notify_method_4

3. method_2

4. method_4

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...