Skip to content

HelleBenjamin/p4-cpu

Repository files navigation

The P4 cpu

P4 CPU

P4 is a simple 4-bit single-cycle prosessor with 2-bit instruction set. Check the user manual for more information.

Registers

The P4 contains two General-Purpose Registers (GPR) and two Special-Purpose Registers (SPR).

GPR

  • REG A: A 4-bit register that is used for the ALU.
  • REG OR: A 4-bit register that is used for a result of an ALU operation.

SPR

  • PC: 4-bit or 6-bit register that points the next instruction in memory.
  • IR: 6-bit register that is holds current instruction byte fetched from memory.

Instruction set

The P4 has 4 diffent instructions. Every instruction takes a single clock cycle to complete.

  • NOP No operation
  • LDA n Load A with immediate value
  • ADD n Add A with immediate value -> OR
  • JMP n Unconditional jump, PC = immediate

About

Simple single cycle 4-bit cpu

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published