In this article I try to talk about implementation part of CPU that can execute instructons subset of original AVR core. It’s only preview and can be use for academic using only. Because most useful programm that this CPU can execute is LED blinking :-) You can view this in following video:
Here right 8 LEDs indicate value of register R20. Left 8 LEDs – value of IP(PC).
I found several implementations of AVR core in FPGA: pAVR, AVR Core, Navré AVR clone. But all of them is very complicated and some of them written not on Verilog. But I want learn only Verilog now. Most similar project is reducedAVR. But m4k ram blocks is much simplier than UFM.
Now implemented following instructions: some of arithmetic and branch on condition. Code that execution by CPU in previous video:
1 2 3 4 5 6 7 8 9 10 11 |
.include "1200def.inc" .device AT90S1200 .cseg .org 0 start: ldi r20,$FF ;1110 1111 0100 1111 / 0xEF4F loop: subi r20, 1 ;0101 0000 0100 0001 / 0x5041 brne loop ;1111 0111 1111 0001 / 0xF7F1 |
Source code of SomeAVR you can found on github. Sorry for generated by Quartus trash files.
On load programm on FPGA all registers reseted to default value/ You can view this in next video: