MicroCPU - 16-bit CPU for XO-1200 (TinyFPGA AX2)


Hi, I created a simple processor and assembler for Lattice MachXO2-1200. I used a board similar to TinyFPGA A2 but made myself.
The system has UART and GPIO support. It has a UART bootloader, so you can upload the code directly without flashing.

The processor has eight 16-bit registers and basic 27 opcodes. Other (pseudo)opcodes are implemented with assembler macros.

For example, macros for call subroutine and return:

	macro bsr
	mov	lr, pc
	b	#1

	macro rts
	add	pc, lr, 3

Read char from UART:

getchar	proc
	push v1
	set	v1, UART_ADDR
	seth	v0, 0
.1	ldrl	v0, v1, 0
	and	v0, v0, 1
	beq	.1
	ldrl	v0, v1, 1
	pop v1

GitHub project page https://github.com/pdaxrom/microcpu

Examples for UART and LED Displays

Maybe someone will find it useful :grinning:


Pretty cool that you also did the assembler!