Plan 9 from Bell Labs’s /usr/web/sources/contrib/kws/v3d/sequence.py

Copyright © 2021 Plan 9 Foundation.
Distributed under the MIT License.
Download the Plan 9 distribution.


from videocore6.assembler import assemble, qpu


@qpu
def sequence(asm):
	reg_idx = r0
	reg_buf = r1
	reg_len = r2
	reg_stride = r3

	nop(sig=ldunifrf(reg_buf))
	nop(sig=ldunifrf(reg_len))

	shr(reg_len, reg_len, 4)

	eidx(reg_idx)
	shl(reg_idx, reg_idx, 2)
	add(reg_buf, reg_buf, reg_idx)

	shl(reg_stride, 4, 4)

	eidx(reg_idx)
	with loop as l:
		mov(tmud, reg_idx)
		mov(tmua, reg_buf)
		tmuwt()

		add(reg_buf, reg_buf, reg_stride)
		sub(reg_idx, reg_idx, -16)
		sub(reg_len, reg_len, 1, cond='pushz')
		l.b(cond='na0')
		nop()
		nop()
		nop()

	nop(sig=thrsw)
	nop(sig=thrsw)
	nop()
	nop()
	nop(sig=thrsw)
	nop()
	nop()
	nop()


def main():
	for insn in assemble(sequence):
		print(f'{insn:#018x}')


if __name__ == '__main__':
	main()

Bell Labs OSI certified Powered by Plan 9

(Return to Plan 9 Home Page)

Copyright © 2021 Plan 9 Foundation. All Rights Reserved.
Comments to webmaster@9p.io.