pico-feedback icon indicating copy to clipboard operation
pico-feedback copied to clipboard

pio wait irq next/prev: Documentation and pioasm disagree

Open wrtlprnft opened this issue 1 year ago • 2 comments

In what I think is the latest version of the rp2350 datasheet (build-date: 2024-10-16, build-version: 5e790a3-clean), “11.4.3.3. Assembler Syntax” describes the following:

wait <polarity> irq <irq_num> (rel, next, prev)

However, pioasm's parser.yy defines the following syntax (abridgred except):

wait_source:
    IRQ comma value REL
  | IRQ PREV comma value
  | IRQ NEXT comma value
  | IRQ PREV comma value REL /* only for error message */
  | IRQ NEXT comma value REL /* only for error message */
  | IRQ comma value
  | […]

Experimentation confirms this:

wait irq 0 next ; does not compile
wait irq next 0 ; works

My best guess is that the documentation is incorrect. For the .mov_status irq <(next|prev)> set <n> directive, both agree that the next|prev keyword should go after the irq keyword, and the way the parser specifies the syntax seems to be clearly intentional.

So I guess the documentation should explicitly mention two alternatives as rel must be at the end:

wait <polarity> irq <irq_num> rel
wait <polarity> irq (next, prev) <irq_num>

wrtlprnft avatar Nov 27 '24 20:11 wrtlprnft