// Using Gidel ProcIII PSP
// Original Impulse C Hello World example works well, but this does not.
void DoText(co_stream input_stream, co_stream output_stream)
{
char c;
char result;
int idx=0;
char array[128*128];
do{
co_stream_open(input_stream, O_RDONLY, CHAR_TYPE);
co_stream_open(output_stream, O_WRONLY, CHAR_TYPE);
while ( co_stream_read(input_stream, &c, sizeof(char)) == co_err_none ) {
array[idx++]=c;
if(idx==128*128)
break;
}
co_stream_close(input_stream);
for(idx=0;idx<128*128;idx++)
{
#pragma CO PIPELINE
#pragma CO SET stageDelay 32
result = array[idx];
result = result+1;
co_stream_write(output_stream,&result,sizeof(char));
}
co_stream_close(output_stream);
IF_SIM(break;)
} while(1);
}
// Can anybody offer some suggestion?
A simple Helloworld, but on board test returns all 0?
Started by Lyle, Oct 05 2009 04:23 PM
1 reply to this topic
#1
Posted 05 October 2009 - 04:23 PM
#2
Posted 31 October 2009 - 08:21 PM
QUOTE (Lyle @ Oct 5 2009, 08:23 PM) <{POST_SNAPBACK}>
// Using Gidel ProcIII PSP
// Original Impulse C Hello World example works well, but this does not.
void DoText(co_stream input_stream, co_stream output_stream)
{
char c;
char result;
int idx=0;
char array[128*128];
do{
co_stream_open(input_stream, O_RDONLY, CHAR_TYPE);
co_stream_open(output_stream, O_WRONLY, CHAR_TYPE);
while ( co_stream_read(input_stream, &c, sizeof(char)) == co_err_none ) {
array[idx++]=c;
if(idx==128*128)
break;
}
co_stream_close(input_stream);
for(idx=0;idx<128*128;idx++)
{
#pragma CO PIPELINE
#pragma CO SET stageDelay 32
result = array[idx];
result = result+1;
co_stream_write(output_stream,&result,sizeof(char));
}
co_stream_close(output_stream);
IF_SIM(break;)
} while(1);
}
// Can anybody offer some suggestion?
// Original Impulse C Hello World example works well, but this does not.
void DoText(co_stream input_stream, co_stream output_stream)
{
char c;
char result;
int idx=0;
char array[128*128];
do{
co_stream_open(input_stream, O_RDONLY, CHAR_TYPE);
co_stream_open(output_stream, O_WRONLY, CHAR_TYPE);
while ( co_stream_read(input_stream, &c, sizeof(char)) == co_err_none ) {
array[idx++]=c;
if(idx==128*128)
break;
}
co_stream_close(input_stream);
for(idx=0;idx<128*128;idx++)
{
#pragma CO PIPELINE
#pragma CO SET stageDelay 32
result = array[idx];
result = result+1;
co_stream_write(output_stream,&result,sizeof(char));
}
co_stream_close(output_stream);
IF_SIM(break;)
} while(1);
}
// Can anybody offer some suggestion?
PROCe III?As far as I know you need to write seperate software code to get it working. Pay attention to the memory alignment issue.(See PROC MultiFIFO user guide or PROC API guide for more info). And, GiDEL MultiFIFO's ReadToBuffer is non-blocking, which means if there's no data at port, it will return immediately. If there is data, transfer will start, but it will still return immediately. Use WaitDone() right after it, and check the readsize variable for a reading count. Or if you know how much data you expect, you can use FillBuffer + WaitDone. It will block the process until that much data is retrieved. Also, consider possible C++ data type issue.(This bothered me for weeks)
And, there should be an interface module instantiated for each stream in impulse_wrap.vhd between stream interfaces(*_en, *_eos, etc) and GiDEL's multiFIFO interface(data_*, req_*, ack_*). That module doesn't deal with co_stream_close(), so it doesn't matter if you close the stream or not. Actually, your code will get stuck in the reading loop(since co_stream_read is blocking, and input_stream never gets closed) and not sending anything. What I do is to put everything into one while loop like this:
CODE
do{
while(co_stream_read == co_err_none){
do stuff;
co_stream_write();
}
IF_SIM(break;)
}while(1);
}
}
while(co_stream_read == co_err_none){
do stuff;
co_stream_write();
}
IF_SIM(break;)
}while(1);
}
}
1 user(s) are reading this topic
0 members, 1 guests, 0 anonymous users












