Created: Jul 30, 2010
Updated: Aug 29, 2010
SVN Updated: Jul 30, 2010
Other project properties
Development status: Beta
WishBone Compliant: No
This CPU project does not implement fully AVR compatible core.
Instead it realizes very minimal functionality.
Task was to make kind of CPU that can fit into very small CPLD (Altera's EPM240T100C5) and still leave some space for other logic.
Development platform was choosed opensource "Marsohod" board. About this board You can read more on http://www.marsohod.org/index.php/howtostart/plata but it is Russian idea and pages. This board is dedicated for education, hobbies, creating electronic toys etc.
Board has 4 buttons, 8 LEDs, 2 step motor control sockets.
In AVR8 project we had implemented:
1) only four general purpose registers r16..r19;
2) general purpose register r20, bits connected to 8 LEDs of board
3) general purpose register r21, bits connected to 6 step motor output pins
4) read only register r22, low 4 bits read status of 4 board buttons.
Thus, no i/o ports, no timers, interrupts and other AVR features.
Anyway somehow this core is partly compatible to real microcontroller.
Altera's CPLD has User Flash Memory, so called UFM. It is organased as 512 words 16 bits each.
So AVR program can be stored there.
Project implements following AVR instructions:
ADD 0000 11rd dddd rrrr
SUB 0001 10rd dddd rrrr
AND 0010 00rd dddd rrrr
EOR 0010 01rd dddd rrrr
OR 0010 10rd dddd rrrr
MOV 0010 11rd dddd rrrr
CP 0001 01rd dddd rrrr
LSR 1001 010d dddd 0110
SUBI 0101 KKKK dddd KKKK
ANDI 0111 KKKK dddd KKKK
ORI 0110 KKKK dddd KKKK
CPI 0011 KKKK dddd KKKK
LDI 1110 KKKK dddd KKKK
BREQ 1111 00kk kkkk k001
BRNE 1111 01kk kkkk k001
BRCS 1111 00kk kkkk k000
BRCC 1111 01kk kkkk k000
Letter "d" encodes destination register.
Letter "r" encodes source register.
"k" encodes immediate values.
Core also inmpelemnts only two flags "Z" and "C".
Corresponding conditional jumps BREQ, BRNE, BRCS, BRCC were realized.
No real jumps of subrotine calls, no memory.
As resources are extremelly limited,
seems this cannot work, but test program was written in ATMEL AVRStudio.
Test application polls board buttons and blinks board LEDs accordingly.
Test application is that:
;initial one bit in register
;read port (key status)
;go and blink one LED if no key pressed
;go and right shift LEDs if key pressed
;go and left shift LEDs if key pressed
;jump to read keys