Jal01 Posted December 20, 2017 Report Share Posted December 20, 2017 I had modeled a spi module in which i have a thread for the module, and a testbench thread to test the module. I am using MOSI and MISO lines for data transfer. I have a CLK line, which will be zero if slave is reading or writing data. And 1 when master is writing or reading data. Master have the control over CLK. So slave has to wait for master to make CLK line zero and suspend itself. After reading and writing on the line, Slave now suspend itself to give master control again. But the problem is master is not suspending. It will just execute wait(); and go for the next line. I am including the lines of code where the error is occurring. Sensitivity has anything to do with wait() statement? Module Code: if (rd_buf == 0) { DRIVE.write(false); // Here, clock is made zero, and waiting for slave to write on MISO pin... wait(); // Not suspending and jumping to testbench... for (char i = 7; i >= 0; i--) { DRIVE.write(true); rd_buf|= MISO.read()<<i; cout << "MISO in spi " << MISO.read() << endl; DRIVE.write(false); wait(); } } Test Bench: for (i = 7; i >= 0; i--) { if (clock.read ()== 0) { cout << "write_buff contents " << ((write_buff >> i) & 1) << endl; miso.write(write_buff >> i & 1); wait(); } } Thank you Quote Link to comment Share on other sites More sharing options...
David Black Posted December 20, 2017 Report Share Posted December 20, 2017 What does your constructor look like? Quote Link to comment Share on other sites More sharing options...
Philipp A Hartmann Posted December 20, 2017 Report Share Posted December 20, 2017 Does is make a difference to explicitly qualify wait() with its namespace? sc_core::wait(); If you happen to call unqualified wait() outside of an immediate SystemC module/channel member function, the compiler might accidentally pick up something else coming from a system header on your platform. Quote Link to comment Share on other sites More sharing options...
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.