okPipeOut behavior and python?

Just want to confirm something I can’t find in the docs. Since okPipeOut generates its own request signal (ep_read), my logic has to be able to generate data within 1 clock (@ 48 Mhz TI_CLK) of ep_read going high. I’m using okPipeOut + a DP block ram as a FIFO.

Looking at the C API code for ReadFromPipeOut(), there’s a length parameter. (In python, I assume the length is implicit – i.e. len(buffer) as passed in. Is this right?) What does this length parameter do in terms of the host interface logic? I’m guessing that it holds ep_read high for N clocks of TI_CLK, where N is the length parameter? Is this data being directly DMAed over the USB each TI_CLK?

I assume I need to pass in a variable-length buffer to ReadFromPipeOut() in python if I want to read a partially full FIFO, for example, where the size of the buffer is 16-bits * number of entries in the FIFO. For example, to read a FIFO that has 100 entries filled out of 1000 total:

buf = (2 * 100) * '\0'
ReadFromPipeOut(0xa0, buf)

In my logic for the FIFO, can I just do fifoCount -= 1 each time ep_read is high @posedge(ti_clk)?

I hope you can take a break from helping students with their homework to answer. (Yes, I know that’s you video buffering types! :slight_smile:



Yes, that’s all generally correct.

You may want to note that the Xilinx Core generator FIFOs plug right into the okPipeXXX HDL modules. Since you mentioned a FIFO count, it sounded like you were trying to roll your own. FIFOs are actually a non-trivial thing (especially asynchronous ones where the source/sink clocks are different). Using the Cores can save a lot of effort.

Thanks for the advice. I’ll look into the core generator. Yeah, I was rolling my own FIFO with a DP block RAM. I’m practicing understanding clock domain transitions so I wanted to do this one on my own.

BTW, I noticed that ReadFromPipeOut() returns an integer result. It appears to be the same value passed in as the length of the buf or -1 on error. Is there any way this function will return a partial result, i.e. an integer > 0 and < buf length?