pioasm: support set x -1
Maintainers usually reply within 6 days
Assessment
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Newbie friendliness
- 78/100
- Issue type
- Feature
- Clarity
- Clearly specified
- Activity status
- Active
- Tech stack
- cpp
- Domain
- compilers, embedded-iot
Research direction
Start in tools/pioasm/pio_assembler.cpp at instr_set::raw_encode. Trace how the resolved value and destination are encoded, especially for x, y, pins, and pindirs. Done means set x/y with -1 produces the equivalent inverted null move, while other destinations retain validation and the updated error message.
Written by the indexing model from the issue text.
Description
Sometimes, it could be convenient when set x, -1 could also generate mov x, ~null (especially when -1 is a calculated value like (n-1 << 25 >> 25)). Not for pins and pindirs (different pin mappings) but for x and y:
diff --git tools/pioasm/pio_assembler.cpp tools/pioasm/pio_assembler.cpp
index a36854b2..5de3d972 100644
--- tools/pioasm/pio_assembler.cpp
+++ tools/pioasm/pio_assembler.cpp
@@ -385,8 +385,12 @@ raw_encoding instr_out::raw_encode(program& program) {
raw_encoding instr_set::raw_encode(program& program) {
int v = value->resolve(program);
+ if (v == ~0 && (dest == in_out_set::in_out_set_x || dest == in_out_set::in_out_set_y)) {
+ return {inst_type::mov, (uint) dest, (uint) mov::null | ((uint) mov_op::invert << 3u)};
+ }
+
if (v < 0 || v > 31) {
- throw syntax_error(value->location, "'set' bit count must be >= 0 and <= 31");
+ throw syntax_error(value->location, "'set' value must be >= 0 and <= 31 (or -1 for x and y)");
}
return {inst_type::set, (uint) dest, (uint) v};
}
- Dominant language
- C
- Stars
- 5k
- Forks
- 1.3k
- Avg merge
- 12d 19h
- Merged PRs (30d)
- 5
Getting set up
- No Dockerfile or Docker Compose file
- Has a pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from raspberrypi/pico-sdk
-
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
raspberrypi/pico-sdk#3300 ·
Maintainers usually reply within 6 days
-
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
raspberrypi/pico-sdk#3292 ·
Maintainers usually reply within 6 days
-
Add masked GPIO pull configuration APIsPossibly taken A pull request linked to this issue is open or already merged. Openhardware_gpio
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
raspberrypi/pico-sdk#3279 ·
Maintainers usually reply within 6 days
-
hardware_pll doxygen doesn't mention RP2350Possibly taken A pull request linked to this issue is open or already merged. Opendocumentation
Difficulty 1/5 Under an hour Newbie friendliness 91/100
raspberrypi/pico-sdk#3277 ·
Maintainers usually reply within 6 days
-
multicore_lockout_handler calling non-inlined multicore_fifo_push_blocking_inlinePossibly taken @Wooohaaa claimed this 2 days ago. Open
Difficulty 2/5 1-3 hours Newbie friendliness 64/100
raspberrypi/pico-sdk#3225 · 2 comments ·
Maintainers usually reply within 6 days
All issues in raspberrypi/pico-sdk
Similar issues
-
Difficulty 1/5 Under an hour Newbie friendliness 85/100
Maintainers usually reply within 1 day
-
slice
Difficulty 2/5 Under an hour Newbie friendliness 72/100
Life-Framework/Life-Framework#3465 ·
Maintainers usually reply within 1 day