Quick check of Mico8, a 8 bit software CPU on Lattice MachXO2

A project log for HDL training board by FPGA for real beginner

Previously I've made CPLD board, but eventually new FPGA version!

kodera2tkodera2t 08/22/2017 at 09:110 Comments

Lattice has provided ready-made software processor named Mico8 (8bit CPU) and Mico32 (32bit CPU). This time I quickly checked its developing flow on my board.

The Lattice's tutorial, which can be available by googling "Mico8 tutorial" is enough to see the fundamentals but some part of this document is out-of-date and we need to swap some words to the new ones.

In addition to Lattice Diamond, we need to download/install "LatticeMico System for Diamond"

Here I would like to write just for different point to the tutorial for running on my board.

The default of the device is not TQFP100 and  just need to select TQFP100 for package type.

The tutorial says "launch Lattice Mico System" but it is renamed by LMS 1.0

New Platform wizard at LMS, we should choose LCMX02-1200HC TQFP100

The board has 8-LEDs so we can add data width to 8.

Default source of "LM8_LEDTest.c" access only lower 4bit so we need small change to iValue limit.

In the platform1_top.v, we need to prepare 3bit LED_CS lines and lower bit should be zero for 8-led access.

On the pinout definition, we need to add and modify as above (3.3V logic, reset pull-up,, cs definition)

That's all! You will see LED blinking from LED1 to 8! Most interesting point is, the program written by C.

		MICO_GPIO_WRITE_DATA_BYTE0 (leds->base, iValue);
		if(iShiftLeft == 1){
			iValue = iValue << 1;
			if(iValue == 0x80){
				iValue = 0x40;
				iShiftLeft = 0;
			iValue = iValue >> 1;
			if(iValue == 0){
				iValue = 0x02;
				iShiftLeft = 1;

This code is running on a system consisting of CPU, memory, GPIO and the system is fully re-configurable. Just put GPIO module and uploading bitstream, we can make "system". On the same system if we need to change program, just change C-program with same system configuration is enough....