Jump to content

How to schedule interrupt to trigger for next time?


Minu
 Share

Recommended Posts

Hi All,

I am trying to schedule interrupt of timer for next time as my current logic only executed interrupt only one time.

void call_overflow_interrupt(){
      //check overflow
      //cout<<"\nIn callInterrupts func\n";
      if((timer_cntrl &(1<<TIMER_CNTRL_OV))&& timer_val==0xff)
        {
          intr1=1;
          timer_intr_status=ENABLE(timer_intr_status,TIMER_OV_INTR);
          
        }
      else{
        cout<<"\ncall_overflow_interrupt is not coming\n";
      }
      
    }

And in SC_CTOR i am registering this process

    SC_METHOD(call_overflow_interrupt);
    sensitive<<Event;
    dont_initialize();
    Event.notify(256*20,SC_NS);//count=256(0xFF),clock period=20ns
    

I wrote above code but it is not scheduling the process for next time.How this can be achieved?

Link to comment
Share on other sites

SC_METHOD is like a cpp function, you need explicitly to trigger it's sensitivity list (in this case to notify Event again), otherwise it won't be re-entered.
E.g.
 

void call_overflow_interrupt(){
      //check overflow
      //cout<<"\nIn callInterrupts func\n";
      if((timer_cntrl &(1<<TIMER_CNTRL_OV))&& timer_val==0xff)
        {
          intr1=1;
          timer_intr_status=ENABLE(timer_intr_status,TIMER_OV_INTR);
          
        }
      else{
        cout<<"\ncall_overflow_interrupt is not coming\n";
      }
     // Added this line to trigger SC_METHOD's sensitivity
     Event.notify(256*20,SC_NS);//count=256(0xFF),clock period=20ns
      
    }

 

Link to comment
Share on other sites

Thanks @tmp_sc for answering my question.But when I did as you suggested it is coming to else part.

One more thing ,like at 256*20 ns interrupt will enable . I want to disable interrupt after 20ns also.How this can be achieved in SC_METHOD?

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.

 Share

×
×
  • Create New...