2

I have a c program on a Cyclone 5 that does an FFT using the connected FPGA. This program currently takes 256 bytes from stdin and then process it gives the FFT results on stdout. I run it like this from the Linux bash on the Cyclone 5.

./fpga_fft < input_s16le_audio.pcm

This only evaluates the first 256 bytes. How do I do this, so that the program is continuously called with the stdin stream until all from the *.pcm file is read?

Ideas:

cat input_s16le_audio.pcm|xargs ./fpga_fft

Somehow xargs needs to be told to process 256 bytes at the time in chronological sequential order (not parallel).

2 Answers 2

1

Something like this:

for i in {0..N} 
do
    dd if=input_s16le_audio.pcm bs=256 count=1 skip=$i |  ./fpga_fft
done

Obviously you have to replace the for loop by something that stops when the whole file has been processed (when the skip value is too big, dd just sends 0 bytes, so you cannot count on a bad rc).

Now, if you have a C program, it should be that hard to change it to make it loop on its input file?

1

Using GNU Parallel:

cat input_s16le_audio.pcm |
  parallel --pipe --recend '' --block 256 ./fpga_fft

If multiple fpga_fft cannot run in parallel, add -j0

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.