are ports blocking?

If you have a simple question and just want an answer.
woodsb
Active Member
Posts: 40
Joined: Thu Nov 17, 2016 11:24 pm

are ports blocking?

Postby woodsb » Fri May 12, 2017 1:24 pm

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
User avatar
mon2
XCore Expert
Posts: 756
Joined: Thu Jun 10, 2010 11:43 am
Contact:

Postby mon2 » Fri May 12, 2017 2:20 pm

woodsb
Active Member
Posts: 40
Joined: Thu Nov 17, 2016 11:24 pm

Postby woodsb » Fri May 12, 2017 3:06 pm

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
User avatar
Bianco
XCore Expert
Posts: 754
Joined: Thu Dec 10, 2009 6:56 pm
Contact:

Postby Bianco » Fri May 12, 2017 3:11 pm

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.
woodsb
Active Member
Posts: 40
Joined: Thu Nov 17, 2016 11:24 pm

Postby woodsb » Fri May 12, 2017 4:57 pm

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?
User avatar
Bianco
XCore Expert
Posts: 754
Joined: Thu Dec 10, 2009 6:56 pm
Contact:

Postby Bianco » Fri May 12, 2017 5:00 pm

By default the full buffer width is used
woodsb
Active Member
Posts: 40
Joined: Thu Nov 17, 2016 11:24 pm

Postby woodsb » Fri May 12, 2017 5:27 pm

Does that mean that for "in buffered port :32 p_in = XS1_PORT_8A ;" the default mode for "p_in :> x;" is to block?
User avatar
Bianco
XCore Expert
Posts: 754
Joined: Thu Dec 10, 2009 6:56 pm
Contact:

Postby Bianco » Fri May 12, 2017 7:20 pm

Yes it will block until 32 bits have been clocked in.
woodsb
Active Member
Posts: 40
Joined: Thu Nov 17, 2016 11:24 pm

Postby woodsb » Fri May 12, 2017 7:21 pm

Thanks for the help!

sincerely,
Bill

Return to “Q&A”

Who is online

Users browsing this forum: No registered users and 9 guests