![]() ![]() |
Feb 21 2010, 12:20 PM
Post
#1
|
|
|
Member ![]() ![]() Group: Members Posts: 10 Joined: 1-December 09 Member No.: 2,555 |
Hi, I have a hw design with three process.
The first one reads data, performs some initial computations and push data to the second process, which is pipelined. The third process read data from the pipelined process, performs some final computations and write the results. Once I've finished to push data in the pipelined process i'm closing the input stream so that the pipeline get flushed. However, with Stage Master Debugger I'm seeing that only the first iteration works well. In the second iteration i'm seeing the pipeline doesn't get filled correctly and process is always returning 1. Below there is a skeleton of my code. I hope you can help me to see what i'm doing wrong. Thanks in advance and Kind Regards, Diego. CODE void preProc(co_stream inputstr, co_stream outputstr, co_signal go, co_signal fin) {
int goData; //Input/output vars co_uint32 nSample; IF_SIM(cosim_logwindow log;) IF_SIM(log = cosim_logwindow_create("preProc");) do { // Hardware processes run forever co_stream_open(inputstr, O_RDONLY, UINT_TYPE(STREAMWIDTH)); co_stream_open(outputstr, O_WRONLY, UINT_TYPE(STREAMWIDTH)); // Read values from the stream while (co_stream_read(inputstr, &nSample, sizeof ( co_uint32)) == co_err_none) { //Some computation co_par_break(); co_signal_post(go, 1); //Notify postProc to start //More computations co_par_break(); //Send data to upwind co_stream_write(outputstr, &nSample, sizeof ( co_uint32)); co_stream_write(outputstr, &nSample, sizeof ( co_uint32)); co_stream_write(outputstr, &nSample, sizeof ( co_uint32)); co_stream_write(outputstr, &nSample, sizeof ( co_uint32)); co_stream_close(outputstr); //to flush pipeline co_par_break(); //wait to avoid inter-blocking (?) co_signal_wait(fin, &goData); // Wait for postProc to finish } co_stream_close(inputstr); } while (1); } void postProc(co_stream inputstr, co_stream outputstr, co_signal go, co_signal fin) { //Input/output vars co_uint32 nSample; int goData; IF_SIM(cosim_logwindow log;) IF_SIM(log = cosim_logwindow_create("postProc");) do { // Hardware processes run forever co_stream_open(inputstr, O_RDONLY, UINT_TYPE(STREAMWIDTH)); co_stream_open(outputstr, O_WRONLY, UINT_TYPE(STREAMWIDTH)); co_signal_wait(go, &goData); // Wait for preProc to read data problem numbers co_par_break(); co_par_break(); co_par_break(); co_par_break(); co_par_break(); co_stream_read(inputstr, &nSample, sizeof ( co_uint32)); co_stream_read(inputstr, &nSample, sizeof ( co_uint32)); co_stream_read(inputstr, &nSample, sizeof ( co_uint32)); co_stream_read(inputstr, &nSample, sizeof ( co_uint32)); co_signal_post(fin, 1); co_stream_close(inputstr); co_stream_close(outputstr); } while (1); } void upwind_residuals(co_stream inputResStr, co_stream outputResStr) { co_uint32 salida, nSample; IF_SIM(int samplesread; int sampleswritten;) IF_SIM(cosim_logwindow log;) IF_SIM(log = cosim_logwindow_create("upwind");) do { // Hardware processes run forever IF_SIM(samplesread = 0; sampleswritten = 0;) co_stream_open(inputResStr, O_RDONLY, UINT_TYPE(STREAMWIDTH)); co_stream_open(outputResStr, O_WRONLY, UINT_TYPE(STREAMWIDTH)); salida = 0; // Read values from the stream while (co_stream_read(inputResStr, &nSample, sizeof ( co_uint32)) == co_err_none) { #pragma CO PIPELINE IF_SIM(samplesread++;) salida++; co_par_break(); co_par_break(); co_par_break(); co_par_break(); co_par_break(); co_stream_write(outputResStr, &salida, sizeof ( co_uint32)); //IF_SIM(cosim_logwindow_fwrite(log, "Instance %d wrote value %x\n", nInstance, nSample);) IF_SIM(sampleswritten++;) } co_stream_close(inputResStr); co_stream_close(outputResStr); IF_SIM(cosim_logwindow_fwrite(log, "Closing filter process (instance %d), samples read: %d, samples written: %d\n", 0/*nInstance*/, samplesread, sampleswritten);) IF_SIM(break;) // Only run once for desktop simulation } while (1); } |
|
|
|
Feb 21 2010, 04:15 PM
Post
#2
|
|
|
Advanced Member ![]() ![]() ![]() Group: Impulse Staff Posts: 237 Joined: 20-April 06 Member No.: 594 |
Hi Diego,
Only thing that potentially doesn't look balanced in terms of co_stream_open/close() is in preProc() where co_stream_close(outputstr); is inside the loop and could be called more than once depending upon the input data. Is co_stream_close(outputstr); being called only once? If that didn't help: What version of CoDeveloper are you running? And would it be possible to have you send a complete set of CoDeveloper projects to support@impulsec.com in order to reproduce the symptom? Best Regards, Ed -------------------- Ed Trexel
Impulse Accelerated Technologies, Inc. |
|
|
|
Feb 22 2010, 01:15 AM
Post
#3
|
|
|
Member ![]() ![]() Group: Members Posts: 10 Joined: 1-December 09 Member No.: 2,555 |
Hi Diego, Only thing that potentially doesn't look balanced in terms of co_stream_open/close() is in preProc() where co_stream_close(outputstr); is inside the loop and could be called more than once depending upon the input data. Is co_stream_close(outputstr); being called only once? If that didn't help: What version of CoDeveloper are you running? And would it be possible to have you send a complete set of CoDeveloper projects to support@impulsec.com in order to reproduce the symptom? Best Regards, Ed Hi etrexel, As far as I can see, opennings and closings are balanced. I'm using 3.60.d6 version. I've just sent you an email with the sample project. Thank you very much. Best regards, Diego. |
|
|
|
![]() ![]() |
| Lo-Fi Version | Time is now: 8th September 2010 - 08:30 PM |