Syntax for partin() in select case statement Topic is solved

Technical questions regarding the xTIMEcomposer, xSOFTip Explorer and Programming with XMOS.
User avatar
dsteinwe
Member++
Posts: 28
Joined: Wed Jun 29, 2016 8:59 am

Syntax for partin() in select case statement

Postby dsteinwe » Fri Aug 10, 2018 8:21 am

Hello,

is it possible to use the function partin(my_32bit_buffered_port, count) in a select case statement? My intention is, that the case block is only triggered, when "count" bits are read from the port into the port's shift buffer. I need a syntax like "case my_32bit_buffered_port :> my_var: ..." but with a different number of bits.
View Solution
User avatar
dsteinwe
Member++
Posts: 28
Joined: Wed Jun 29, 2016 8:59 am

Postby dsteinwe » Mon Aug 13, 2018 6:50 pm

I think, it is not possible, because you can only use the operators :> and <: in the case-statement to read and write resources. Resource can only be ports, timers or channels, but a function like partin() is not a resource. Therefore I guess, it is not possible.
User avatar
dsteinwe
Member++
Posts: 28
Joined: Wed Jun 29, 2016 8:59 am

Postby dsteinwe » Thu Aug 16, 2018 12:25 pm

It's possible with inline assembler like this:

Code: Select all

asm("setpsc res[%0], %1" :: "r"(p_in), "r"(bit_width));

For more informations look here: https://www.xcore.com/viewtopic.php?f=26&t=6862&p=33974#p33974

Who is online

Users browsing this forum: No registered users and 50 guests