I have created a custom made 16-bit CPU. I have used the LogiSim tool to
create it. The CPU has three registers (A, B, and C), PC, SP, and some internal registers, such as MBR
(Memory Buffer Register), IR (Instruction Register), and HIGH-BYTE register (keeps the upper 16-bit word of
the 32-bit multiplication result, or a remainder when doing division).
Besides CPU, the system has 2x64KB of RAM and
16 words of text-based video memory, starting from the 0xfff0 address, and going to the 0xffff. The ALU is
capable of doing all important operations including hardware-implemented multiplication and division. Both
multiplication and division consume 32 cycles for 16-bit operands.
All the microcode is placed in two 32-bit ROMs:
There are around 100 instructions implemented: load/store, arithmetic,
logical, shifting, jumps, calls, etc.
The assembler for this CPU was forked from the original custom assembler and is also on the github:
https://github.com/milanvidakovic/customasmThe
output of the assembler are files in a such format that the LogiSim can load them into the RAM memory
component.
The emulator was written in Java and it is capable of executing the machine code instructions
which are the output of the assembler. It is also on the github:
https://github.com/milanvidakovic/16-bit-CPU-emulatorI
have also created a transsembler which converts x86 assembler code made by the MS C compiler into the assembler
for my custom CPU. That way, I can make a program in C and make it run on my CPU. The transsembler was written
in Java and is also on the github:
https://github.com/milanvidakovic/16-bit-CPU-transsembler