Forums

Downloads

Calendar

Everything posted by Moberg

Two modules, an input Generator and a Controller.
The Generator sends a signal to increase a value in the Controller. The controller contains a loop where it checks if this value is > 0 and in that case do some stuf and reset it to zero.;
How should I connect these two modules? Sending an event seemed most intuitional, but it doesnt look like the standard way to do this.
I also read about semaphore but I'm not sure how to connect them. (I also want a monitor module to be able to print the value at some points (probably when it is reset))

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?