@@ -68,6 +68,10 @@ def __init__(self, text_program: str, *, build_debuginfo: bool = False) -> None:
68
68
in_shift_right = None
69
69
auto_push = None
70
70
push_threshold = None
71
+ out_count = None
72
+ out_shift_right = None
73
+ auto_pull = None
74
+ pull_threshold = None
71
75
72
76
def require_before_instruction ():
73
77
if len (instructions ) != 0 :
@@ -140,6 +144,29 @@ def int_in_range(arg, low, high, what, radix=0):
140
144
raise RuntimeError (f"Invalid { line } )" )
141
145
mov_status_count = int (words [idx + 1 ])
142
146
require_version (required_version , line )
147
+ elif words [0 ] == ".out" :
148
+ require_before_instruction ()
149
+ out_count = int_in_range (
150
+ words [1 ], 32 if pio_version == 0 else 1 , 33 , ".out count"
151
+ )
152
+ auto_pull = False
153
+
154
+ idx = 2
155
+ if idx < len (words ) and words [idx ] == "left" :
156
+ out_shift_right = False
157
+ idx += 1
158
+ elif idx < len (words ) and words [idx ] == "right" :
159
+ out_shift_right = True
160
+ idx += 1
161
+
162
+ if idx < len (words ) and words [idx ] == "auto" :
163
+ auto_pull = True
164
+ idx += 1
165
+
166
+ if idx < len (words ):
167
+ pull_threshold = int_in_range (words [idx ], 1 , 33 , ".out threshold" )
168
+ idx += 1
169
+
143
170
elif words [0 ] == ".in" :
144
171
require_before_instruction ()
145
172
in_count = int_in_range (
@@ -350,6 +377,18 @@ def int_in_range(arg, low, high, what, radix=0):
350
377
self .pio_kwargs ["mov_status_count" ] = mov_status_count
351
378
self .pio_kwargs ["mov_status_param" ] = mov_status_param
352
379
380
+ if out_count not in (None , 32 ):
381
+ self .pio_kwargs ["out_count" ] = out_count
382
+
383
+ if out_shift_right is not None :
384
+ self .pio_kwargs ["out_shift_right" ] = out_shift_right
385
+
386
+ if auto_pull is not None :
387
+ self .pio_kwargs ["auto_pull" ] = auto_pull
388
+
389
+ if pull_threshold is not None :
390
+ self .pio_kwargs ["pull_threshold" ] = pull_threshold
391
+
353
392
if in_count not in (None , 32 ):
354
393
self .pio_kwargs ["in_count" ] = in_count
355
394
0 commit comments