Jump to content

Moberg

Members
  • Content Count

    4
  • Joined

  • Last visited

Everything posted by Moberg

  1. 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
  2. Thanks this looks like the right stuff. I will try it in a while! Should I use sig.write(true) or is it equal to normal assignment, i.e. sig = true:
  3. I'm not sure what to do, really ^^' I'm not familiar with sc_buffer nor default_event(). I have this code right now. But in this way I can't react to two ones (1) coming in serie, because there has been no change on the input. Testbench: int sc_main(int argc, char **argv) { sc_time sim_time(atof(argv[1]), SC_SEC); char *infile = argv[2]; sc_signal<bool> sig; // create modules Generator generator("Generator", infile); Controller controller("Controller"); // connect channels to ports generator(sig); controller(sig); } (stimuli) Generator: SC_MODULE(Generator)
  4. 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))
×
×
  • Create New...