Page 1 of 1

Syntax for partin() in select case statement

Posted: Fri Aug 10, 2018 8:21 am
by dsteinwe
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.

Re: Syntax for partin() in select case statement

Posted: Mon Aug 13, 2018 6:50 pm
by dsteinwe
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.

Re: Syntax for partin() in select case statement

Posted: Thu Aug 16, 2018 12:25 pm
by dsteinwe
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=2 ... 974#p33974