Micro16 - A Simple 16 Bit VHDL CPU
Micro16 is an extension or derivative of the Micro8 CPUs. Addressing modes have been reduced to extend the adressing range. Rather than supporting an index register the Micro16 uses indirect addressing. The Micro16 does not support byte addressing. addresses are word addresses. The idea of the Micro16 was to provide a very simple micro controller, originally intened as an I/O processor for a Compact Flash reader.
The Micro16 features:
Bits 15 to 13 form the Opcode.
- 8 Instructions
- Direct & Indirect Addressing
- 4KWord Direct Addressing Range (Program & Data)
- 64K Word Indirect Addressing Range (Data Only)
- 8 Level Hardware Stack
- 1 Interrupt Input
Bit 12 is the Indirect bit. If set the opcode reads / writes from the address pointed to by the address field.
Bits 11 to 0 form the Direct address. Stored Program code can only reside in the Direct Address Space.
15
14
13
12
11
10
9
8
7
6
5
4
3
2
1
0
Opcode
I
Address
B15
B14
B13
Instruction
0
0
0
ADD Add Accumulator
0
0
1
NOR Nor Accumulator
0
1
0
STO Store Accumulator
0
1
1
JSR Jump to Subroutine
1
0
0
JNZ Jump if Non Zero (Clears ZFlag)
1
0
1
JNC Jump if No Carry (Clears Carry Flag)
1
1
0
RTI Return From Interrupt
1
1
1
RTS Return From Subroutine
Micro16-18sep03.zip Pre-release
This version does not work ... I'm putting it up here for safe keeping. I've included the smal32 macro assembler with macros for the micro16 and the source to a monitor program included in the blockrom VHDL code. I've also included the source to "epedit" that allows you to generate the initialisation code for the 16 bit block RAM.
I had an enquiry today about porting this design to other FPGA platforms namely the XESS XSB-300E. The thing to note is that SysClk has been set up for 4.9152 MHz. The baud rate divisor in the UART for the RX sample clock defaults to 128. The TX baud rate is one quarter of this 4.915200/128/4 = 9600 Baud. I am not sure what the maximum clock rate is for Micro16 but if you use SysClk = 25 MHz and 115200 Baud then you need to set BRDIVISOR = 25,000,000/115,200/4 = approx 54. I have not tested this so you may need to experiment a bit.