Add .set
This commit is contained in:
parent
ed74947440
commit
e9858c3666
2 changed files with 18 additions and 0 deletions
|
|
@ -72,6 +72,7 @@ class Program: # pylint: disable=too-few-public-methods
|
|||
out_shift_right = None
|
||||
auto_pull = None
|
||||
pull_threshold = None
|
||||
set_count = None
|
||||
|
||||
def require_before_instruction():
|
||||
if len(instructions) != 0:
|
||||
|
|
@ -190,6 +191,12 @@ class Program: # pylint: disable=too-few-public-methods
|
|||
push_threshold = int_in_range(words[idx], 1, 33, ".in threshold")
|
||||
idx += 1
|
||||
|
||||
elif words[0] == ".set":
|
||||
require_before_instruction()
|
||||
set_count = int_in_range(
|
||||
words[1], 32 if pio_version == 0 else 1, 33, ".set count"
|
||||
)
|
||||
|
||||
elif line.endswith(":"):
|
||||
label = line[:-1]
|
||||
if label in labels:
|
||||
|
|
@ -377,6 +384,9 @@ class Program: # pylint: disable=too-few-public-methods
|
|||
self.pio_kwargs["mov_status_count"] = mov_status_count
|
||||
self.pio_kwargs["mov_status_param"] = mov_status_param
|
||||
|
||||
if set_count not in (None, 32):
|
||||
self.pio_kwargs["set_count"] = set_count
|
||||
|
||||
if out_count not in (None, 32):
|
||||
self.pio_kwargs["out_count"] = out_count
|
||||
|
||||
|
|
|
|||
|
|
@ -99,3 +99,11 @@ def test_dot_out() -> None:
|
|||
auto_pull=False,
|
||||
out_shift_right=True,
|
||||
)
|
||||
|
||||
|
||||
def test_dot_set() -> None:
|
||||
assert_pio_kwargs(".set 32", sideset_enable=0)
|
||||
assert_assembly_fails(".set 16")
|
||||
assert_pio_kwargs(
|
||||
".pio_version 1\n.set 16 right", pio_version=1, sideset_enable=0, set_count=16
|
||||
)
|
||||
|
|
|
|||
Loading…
Reference in a new issue