Commit graph

48 commits

Author SHA1 Message Date
3da0f6cea2 Add .fifo directive 2024-09-05 09:05:47 -05:00
a8fa218e45 Recognize .pio_version directive (integer arguments only) 2024-09-05 08:37:43 -05:00
be66c02eb3 Better diagnose the incorrect lines like "side 1" or "[5]"
Before this, the exception would be 'IndexError: list index out of range'.
Now it is 'Unknown instruction: side' or similar.

(These need an instruction, even if it's a `nop`: `nop side 1 [5]`)
2024-07-10 08:09:46 -05:00
KB Sriram
3e6a8bc392 Add type annotations for library and tests.
Verified that `mypy --strict adafruit_pioasm.py tests` runs without
errors.

Fixes: https://github.com/adafruit/Adafruit_CircuitPython_PIOASM/issues/24
2024-05-27 12:30:52 -07:00
KB Sriram
d87b4461ae Add tests for "out" and "in".
Also added more descriptive errors for invalid
source/destination values.

Fixes https://github.com/adafruit/Adafruit_CircuitPython_PIOASM/issues/44
2024-04-25 22:50:39 -07:00
Gebhartj
6ac60b4554
repair inscorect directive .offset to .origin
.offset directive do not exist in pioasm
2024-01-24 08:09:03 +01:00
3bacee4ad2
support .offset pseudo-op 2023-08-05 15:57:13 -05:00
Alec Delaney
31fabd6150 Update version string 2022-08-16 18:09:15 -04:00
5429dc1f59
accept 0x, 0b, 0o literals in most places numbers can be used
Closes: #30 (though I don't know what octal syntax is accepted by
official pioasm, we will accept python-style 0o567 not C-style 0567)
2022-04-24 20:06:24 -05:00
7110473f04
Merge remote-tracking branch 'origin/main' into wrap 2022-04-06 08:42:07 -05:00
16adbe4464
The core doesn't like sideset_pin_count=0, so don't send it 2022-04-06 08:41:58 -05:00
Alec Delaney
5aa37e1a46 "Reformatted per new black version" 2022-03-29 18:19:18 -04:00
d16bd7e6a4
Add support for wrap/wrap_target
.. This also needs support in the core for specifying them in the
StateMachine constructor.
2022-02-13 13:22:03 -06:00
ac5290f6c7
Add pretty-printing of PIO programs (into C for now) 2022-02-01 11:04:47 -06:00
2722649975
Fix name of parameter in pio_kwargs 2022-02-01 11:00:45 -06:00
68a5881044
black 2022-01-12 08:43:33 -06:00
666f4ef2c9
Merge remote-tracking branch 'origin/main' into program-object 2022-01-12 08:38:43 -06:00
Danny Staple
df0662297d make my exceptions more consistent, and add tests. 2022-01-02 16:07:07 +00:00
Danny Staple
b065422813 Black reformat 2022-01-02 13:22:11 +00:00
Danny Staple
fa2b8689ce
Typo spotted after tweeting... Doh 2022-01-02 13:02:33 +00:00
Danny Staple
0381b30119
Fix the pylint, add in one other I've been using 2022-01-02 12:56:55 +00:00
Danny Staple
ac1cb9937d
Copied incorrectly 2022-01-02 12:09:21 +00:00
Danny Staple
e1e5e2a3ee
Add some helpful exception wrappers
These make errors easier to fix.
2022-01-02 12:07:24 +00:00
Jeff Epler
9707333567 Add Program class, type information
An instance of the `Program` class has the `.assembled` property
as well as the `pio_kwargs` property. This allows passing information
from the assembler to the StateMachine constructor, in a way that can
be extended in future versions (e.g., for .wrap / .wrap_target)

This re-indents a lot of code so it may be better viewed with whitespace
changes hidden.

Tests are added for the limits of the side-set and delay values. An
off-by-one bug with the sideset_value limit was fixed.
2021-12-26 10:35:41 -06:00
Scott Shawcroft
6fd0518867
Fix tests and add one 2021-12-22 12:35:25 -08:00
Scott Shawcroft
9a1d5c6141
Add sideset assembly support.
You must also set `sideset_enable` when creating the rp2pio.StateMachine
object.

Fixes #16 and fixes #21.
2021-12-22 12:10:14 -08:00
Scott Shawcroft
adc3ae56d9
Merge pull request #17 from gamblor21/mov_operators
Add all mov operators
2021-03-24 08:39:35 -07:00
gamblor21
bb7c5717ab Add case of op and then space 2021-03-23 14:12:46 -05:00
55bee3f66c fix an error while raising an invalid instruction error 2021-03-22 21:09:54 -05:00
gamblor21
f3d4b2ff4c Black fix 2021-03-20 16:35:29 -05:00
gamblor21
1a5eed7263 Add all mov operators 2021-03-20 13:16:44 -05:00
0635463a78 disable a pylint diagnostic 2021-02-25 10:03:57 -06:00
3ad9fae9f7 assemble: better diagnose jump to undefined label 2021-02-25 09:19:35 -06:00
ebdf4e3d6b assemble: Diagnose duplicate labels
Closes #10
2021-02-25 09:19:25 -06:00
bfbd002c24 run black 2021-02-12 09:44:54 -06:00
f25d17af8e split instructions on commas and whitespace
All of the following now parse as `["mov", "pins", "1"]` and assemble to
0x6001:
```
out pins , 1 ;
out pins, 1  ;
out pins,1   ;
out pins ,1  ;
out pins 1   ;
```

This brings pioasm closer to what upstream's examples show

Closes: #7
2021-02-12 09:02:12 -06:00
Scott Shawcroft
cf81c94093
Merge pull request #5 from dglaude/patch-1
Fix for "; comment only lines"
2021-02-03 19:18:48 -08:00
Scott Shawcroft
4ceb54bdef
Black 2021-02-03 18:56:17 -08:00
Scott Shawcroft
897358415d
Update adafruit_pioasm.py 2021-02-03 13:32:10 -08:00
David Glaude
ef66ca9010
Remove print in library.
library should not print
2021-02-02 21:48:54 +01:00
Scott Shawcroft
61c8964705
Update adafruit_pioasm.py 2021-02-02 10:36:18 -08:00
luminousOwl
c4fbe187ab Shift mov operator 2021-02-01 19:12:36 -05:00
David Glaude
f70126c059
My fix for "; comment only lines"
This should fix #4 but there might be a better way.
2021-02-01 00:28:05 +01:00
luminousOwl
e089e82e26 Fix pull instruction parsing 2021-01-30 12:16:48 -05:00
ryang14
e4f2740f40
Fix wait source encoding
Change the wait instruction encoding to shift the source by 5 bits instead of 4.
2021-01-25 20:44:49 -05:00
Scott Shawcroft
7fc8625aea
Lint 2021-01-21 15:35:45 -08:00
Scott Shawcroft
5e8b820a52
Black 2021-01-21 15:26:20 -08:00
Scott Shawcroft
4cd0064413
Add initial PIOASM code 2021-01-21 10:01:11 -08:00