Forum Discussion
Altera_Forum
Honored Contributor
11 years agoI just checked and it doesn't look like the official docs have it covered yet. These slides have some information but typically I just look at an example when I need to remember how to use the API: http://www.altera.com/support/examples/download/exm_opencl_asian_option_opencl_fpga.pdf
The API is fairly easy to use, you create a channel and there are functions for writing data into the channel and read data from the channel. The main thing to remember when using channels is that you can only read or write to a channel from one location in your code. For example you can't do something like this: if(x > 5) write_channel_altera(MY_CHANNEL, x); else write_channel_altera(MY_CHANNEL, (x + 5)); Instead you would write the code like this to ensure there is only one location writing to the channel: if (x > 5) temp_var = x; else temp_var = x + 5; write_channel_altera(MY_CHANNEL, temp_var);