Moberg Posted February 2, 2013 Report Posted February 2, 2013 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? Quote
apfitch Posted February 2, 2013 Report Posted February 2, 2013 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 maehne and sandeepjana 2 Quote
Recommended Posts
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.