Skip to content

Latest commit

History

124 Commits

Folders and files

NameName
Last commit message
Last commit date

Repository files navigation

CPU 16

Simple load-store 16-bit CPU ISA, along with an assembler, compiler, simulator and Yodl design.

CPU16 Running on an Alchitry Au

Instruction Set

InstructionDescriptionOpcodeFlagsArguments
CTLControl flags0b00Zero, Carry<padding: 11> <ctrl_op: 3>
SETSet register0b01-<dst: 3> <value: 11>
MEMLoad/Store memory0b10-<dst: 3> <addr: 3> <load/store: 1> <offset: 7>
ALUALU operation0b11Zero, Carry<dst: 3> <src1: 3> <src2: 3> <alu_op: 5>

Registers

RegisterDescriptionIndex
ZZero register (always 0, cannot be written to)0
R1General purpose register1
R2General purpose register2
R3General purpose register3
R4General purpose register4
TMPTemporary register5
SPStack pointer6
PCProgram counter7

CtrlOps

OpcodeOperation
0b000Halt
0b001SetZero
0b010ClearZero
0b011SetCarry
0b100ClearCarry

AluOps

OpcodeOperation
0b000_00Add
0b000_01Sub
0b000_10Adc (Add with carry)
0b000_11Sbc (Subtract with carry)
0b001_00AddIfZero
0b001_01SubIfZero
0b001_10AdcIfZero
0b001_11SbcIfZero
0b010_00AddIfNotZero
0b010_01SubIfNotZero
0b010_10AdcIfNotZero
0b010_11SbcIfNotZero
0b011_00AddIfCarry

The assembler defines common operations using these primitive instructions.

Generating bin files

Nexys A7 (Xilinx Artix 7 XC7A100T)

  1. Install Vivado
  2. Run make build-vivado in the design/ directory
  3. The bitstream will be in design/build/cpu16_Top.bin
  4. Run openFPGALoader or any other compatible tool to program the FPGA

About

Simple 16-bit load-store CPU for FPGAs

Resources

Stars

2 stars

Watchers

1 watching

Forks

Releases

Packages

Used by

Contributors

Languages