Skip to content
/ cpu Public

Toy CPU architecture and software stack including assembler, debugger, emulator and more.

Notifications You must be signed in to change notification settings

kevinms/cpu

Repository files navigation

------------------------------------------------------------------------

This project's goal is to design a custom CPU

Instruction Set
Assembly Language
Compiled Language

Verilog FPGA Implemenation

Processor

24 Instructions
16 Registers

Assembly Language

Assembler
Emulator
Debugger

doc/   - Technical documention describing all aspects of this project.
progs/ - Programs written to run on the CPU.
hdl/   - Hardware to run 


Arithmetic:      7 add,sub,adc,sbc,mul,div,cmp
Load/Store/Move: 5 ldw,ldb,stw,stb,mov
Bitwise:         6 and,or,xor,nor,lsl,lsr
Jumps:           5 jmp,jz,jnz,jl,jge
Other:           1 die,nop
                --
				24

die


#
# Install dependencies.
#
sudo apt-get install libncurses5 libncurses5-dev

#
# Build a ROM and binary file from assembly code.
#
./assembler.py --assemble test.asm -b test.bin > test.rom

#
# Run the ROM in the emulator.
#
./emulator -r test.rom

#
# Run the binary in the emulator.
#
./emulator -b test.bin:0x0

#
# Run the kernel in the emulator.
#
./emulator -b progs/boot.bin:0x4000 -b sd.img:0x5000 -p 0x4000 -i

#
# Run the kernel using the debugger.
#
./emulator -b progs/boot.bin:0x4000 -b sd.img:0x5000 -g progs/all.kernel.bin:0x0 -g progs/lib.bin:0x3000 -p 0x4000 -i -t 2> error.out

#
# Dump heap contents in human readable format.
#
./heap -m emulator.memory -o 0x10000 -z $(( 0x1FF0000 )) -s

About

Toy CPU architecture and software stack including assembler, debugger, emulator and more.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published