Jump to content

Recommended Posts

Posted

It is almost always stupid to try to read from your own output signal (right?)(I just got an infinite loop because it didn't update). I had code along these lines:

sc_out<bool> access1;
sc_out<bool> access2;

for(;
{
   while(!(condition1 || condition2))
   {
       wait(sensor_ev);
   }

   if(condition1)
   {
       access1 = true;
   }

   if(condition2)
   {
       access2 = true;
   }
   if(access1 or access2)
   {
       wait(5, SC_SEC);
       access1 = false;
       access2 = false;
   }
}

The last if could be changed to cond1 or 2 instead of access1 or 2 to remedy this. Any way to make the compiler or the simulator warn me on this kind of code? i.e. whenever an sc_out is being read?

Maybe there are cases when I want to read an output?

Posted

It can make sense to read an output. The classic example is to implement a counter, where you want to increment the count using

count = count + 1;

This will work in SystemC for an output signal port of an integer type.

Of course a counter has a clock.

I would guess your example is a case of combinational feedback, though I can't tell without knowing the sensitivity of your process,

regards

Alan

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