Search the Community
Showing results for tags 'wait'.
-
Hi all, I have a systemC-tlm code that uses SC_THREAD( ) to implement parallel modules. I am working on latency analysis and hence included a few wait statements in each of the SC_THREAD functions. It was working fine for a long time, until yesterday. The SC_THREAD functions with wait(time, SC_NS) hang exactly at the wait statement. I tried debugging into the wait function, and found that the code throws an SC_REPORT_ERROR in wait( ) function in sc_wait.cpp. I am not sure if that error is caught, because I do not see any error in my console output. Does anyone have a clue on why I am seeing this behavior?
-
My design includes communication between 5 different modules. Let's say the modules are 1, 2, 3, 4 and 5. The communication takes place between modules 4 and 5 first, they exchange four messages between them but once that is done communication should take place between 4 and 1, then 5 and 1. Once that is done, then 4 and 2, then 5 and 2. And similarly 4 and 3, then 5 and 3. When I started writing the design between 4 and 5 using cthreads and wait(), that worked fine. But once that is done, I can't seem to start the communication between modules 4 and 1. I guess I still didn't wholly understand the concept of processes and wait(), but could someone suggest how to go about this? module4.h module5.h //input and output ports are defined //input and output ports are defined //sc_cthread(func4, clk.pos()) //sc_cthread(func5, clk.pos()) module4.cpp module5.cpp //void module4::func4 //void module5::func5 //while(true) //while(true) //send message1; wait(); //receive message1; send message2; wait(); //receive message2; send message3; wait(); //receive message3; send message4; wait(); //receive message4; wait(); It was working fine when I just had only these two modules at first. I wrote a value to the signal which connects module4 and module5 from the main function and these two started communicating just the way I wanted. Then, module1.h was defined. //input and output ports are defined //sc_cthread(func1, clk.pos()) module4.cpp module1.cpp //send message5; wait(); //receive message5(); wait(); But when I defined module1 just the way I defined modules4 and 5, the communication stopped after sending message1 in module4. Module5 didn't seem to receive message1. Can someone point out how to go about this? I know I probably am not using wait() statements the way they are meant to be used, so any help will be much appreciated. Thanks!
-
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
-
Good day, I have a question regarding how to determine the appropriate delay value for the wait( ) function call. In the target b_transport callback, we can add delay to the simulation time by passing delay amount to the wait( ) function. In simulation that uses quantum and temporal decoupling that targets super fast instruction accurate simulation, the timing does not have to be very detail (loosely timed). With or without delay in the target callback function will not cause any functional inaccuracy and still we could produce the platform that can support firmware/software development. Still if we want to put a delay to the wait( ), how can we determine the appropriate delay value for the function parameter? Thank you. Regards, Arya.
-
Hallo, I have a SC_THREAD which has a dynamic synchronization. I use a sc_event_or_list as the wait-function argument. void notifyForGeneratedOutPix(void) { using namespace std; while (true) { sc_core::wait( m_outPixEvOrList ); //I'd like to do something like this: for(auto event : m_outPixEvOrList) { if(event.isNotified()) { cout << "@ " << setw(5) << sc_core::sc_time_stamp(); cout << " | delta cycle: " << setw(5) << sc_core::sc_delta_count(); cout << "Written values from "; this->dump(cout); cout << endl; cout << "value: "; dumpOutPixel(event); //map access with event as key } else continue; } } The events synchronize a method where I need to know which event is notified and has resumed the thread process. I haven't found a method or function to check an event if it is notified or not. The event class have this enumaration enum notify_t { NONE, DELTA, TIMED }; but I haven't found something to check that flag. Is their any way to find out if a event is notified or not? Thx *andre*
-
I happened across the following code. @(m_vif.smp_cb iff (m_vif.smp_cb.xyz_enable) ); To get to the crux of my question, let's consider it to be the below code. I don't think I've dropped anything relevant with this change (but I post both, b/c I have dropped important info with my edits in the past). @(posedge clk iff (xyz_enable) ); Q) How should the above line behave? How would you read that line aloud? 1) "Wait for a posedge of clk, if and only if xyz_enable is true." //That's how I read it, but that is incorrect. 2) "Wait for posedges of clk until xyz_enable is true." //This is correct. My thought was that when xyz_enable==0, it would just 'fall through' and there would be no wait for a posedge of clk. i.e. if(xyz_enable) @(posedge clk); Can someone help me read that line as a descriptive sentence? Here is some test code: module top; logic clk; int count=0; initial clk=0; always #1 clk = ~clk; initial begin $display($time," ************* START"); repeat (10) @(posedge clk); fork begin repeat(33) begin $display($time," Tine1: waiting for posedge clk. count=%0d",count); @(posedge clk); count++; end end begin $display($time," Tine2: waiting for count=10"); @(posedge clk iff (count==10)); $display($time," Tine2: waited for count=10. count=%0d",count); end join_any $display($time," ************* END"); $finish; end endmodule Results: 0 ************* START 19 Tine1: waiting for posedge clk. count=0 19 Tine2: waiting for count=10 21 Tine1: waiting for posedge clk. count=1 23 Tine1: waiting for posedge clk. count=2 25 Tine1: waiting for posedge clk. count=3 27 Tine1: waiting for posedge clk. count=4 29 Tine1: waiting for posedge clk. count=5 31 Tine1: waiting for posedge clk. count=6 33 Tine1: waiting for posedge clk. count=7 35 Tine1: waiting for posedge clk. count=8 37 Tine1: waiting for posedge clk. count=9 39 Tine1: waiting for posedge clk. count=10 39 Tine2: waited for count=10. count=10 39 ************* END Thanks, for any feedback.
-
*, Is one of these ways to have a sequence wait on an event preferred? If so, why? The following are code snippets from inside a sequence. 1) Create transaction and engage w/ driver, then wait for event. `uvm_create(req) start_item(req); m_state.wait_on_smthg(); // <--- wait here 2) Wait for event, then proceed m_state.wait_on_smthg(); // <--- wait here `uvm_create(req) start_item(req); In this case, the event being waited for is that data of a certain type is available.
-
Hi Guys If I use wait(e1 | e2) in my thread(where e1 and e2 are sc_event), on the next line after this wait, is there a way to know whether it is an event on e1 or e2 which force the thread to come out of wait. Thanks RahulJn