Idein / py-videocore6

Python library for GPGPU programming on Raspberry Pi 4
https://idein.jp
GNU General Public License v2.0
247 stars 28 forks source link

Simple loop helper #19

Closed notogawa closed 4 years ago

notogawa commented 4 years ago

By this PR, this code is equivalent to

L.loop
sub(r0, r0, 1, cond = 'pushn')
b(R.loop, cond = 'anyna')
nop()
nop()
nop()

this one.

with loop as l:
  sub(r0, r0, 1, cond = 'pushn')
  l.b(cond = 'anyna')
  nop()
  nop()
  nop()

Using with syntax makes a program structure clear. This loop helper generates a label name automatically.

Terminus-IMRC commented 4 years ago

Great improvement! Thanks!