Page 1 of 1

are ports blocking?

Posted: Fri May 12, 2017 1:24 pm
by woodsb
Hello:

If p_in is an input buffered port, does a "p_in :> x;" statement inside a while(1) loop block the loop execution until the next time the buffered port is full?

If not, what happens each time the statement is encountered?

Thanks,
Bill

Re: are ports blocking?

Posted: Fri May 12, 2017 2:20 pm
by mon2

Re: are ports blocking?

Posted: Fri May 12, 2017 3:06 pm
by woodsb
Thanks for the response. Reading the linked material prompted another question.

The summary states that "An input removes data from a port’s FIFO. The processor waits only if the FIFO is empty." What happens if I use a buffered port that is larger than the size of the input pin specification, for example "in buffered port :32 p_in = XS1_PORT_8A ;"?

Can the "p_in :> x;" statement pull partial data from the FIFO in a non-blocking manner, or will the processor wait until all 4 8-bit portions are in the FIFO?

Thanks,
Bill

Re: are ports blocking?

Posted: Fri May 12, 2017 3:11 pm
by Bianco
There's the partin, partout and some related library functions to do that.

https://www.xmos.com/download/private/I ... 283%29.pdf

Should be valid too for XS2.

Re: are ports blocking?

Posted: Fri May 12, 2017 4:57 pm
by woodsb
Thanks for the further references. I'm wondering, what is the default value? That is, what happens if I use a buffered port that is larger than the size of the input pin specification, for example "in buffered port :32 p_in = XS1_PORT_8A ;"? Will "p_in :> x;" block or pull out partial results or something else?

What should I do if I want the "p_in :> x;" statement to wait until the FIFO is full?

Re: are ports blocking?

Posted: Fri May 12, 2017 5:00 pm
by Bianco
By default the full buffer width is used

Re: are ports blocking?

Posted: Fri May 12, 2017 5:27 pm
by woodsb
Does that mean that for "in buffered port :32 p_in = XS1_PORT_8A ;" the default mode for "p_in :> x;" is to block?

Re: are ports blocking?

Posted: Fri May 12, 2017 7:20 pm
by Bianco
Yes it will block until 32 bits have been clocked in.

Re: are ports blocking?

Posted: Fri May 12, 2017 7:21 pm
by woodsb
Thanks for the help!

sincerely,
Bill