https://github.com/hellebenjamin/p4-cpu
Simple single cycle 4-bit cpu
https://github.com/hellebenjamin/p4-cpu
Last synced: 10 months ago
JSON representation
Simple single cycle 4-bit cpu
- Host: GitHub
- URL: https://github.com/hellebenjamin/p4-cpu
- Owner: HelleBenjamin
- License: mit
- Created: 2024-06-03T20:03:56.000Z (about 2 years ago)
- Default Branch: main
- Last Pushed: 2024-06-13T22:51:35.000Z (about 2 years ago)
- Last Synced: 2025-03-28T16:13:03.442Z (over 1 year ago)
- Language: C++
- Size: 3.77 MB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README

# P4 CPU
P4 is a simple 4-bit single-cycle prosessor with 2-bit instruction set. Check the [user manual](https://github.com/Pepe-57/p4-cpu/blob/main/P4_user_manual_en.pdf) 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