Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

3 Commits
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

CPU-Simulator

A C++ program that simulates a basic CPU with registers, memory and simple instructions (load, add, sub, store, print).

πŸ’‘ Why this project?

Every electronic device runs on a CPU. Understanding how a processor executes instructions at the lowest level is core knowledge for Computer Architecture β€” a subject every Electrical Engineering student will encounter in their degree!

✨ Features

  • 4 general-purpose registers (R0, R1, R2, R3)
  • 16 memory slots (addresses 0–15)
  • Supported instructions:
    • LOAD β€” load a value directly into a register
    • ADD β€” add two registers, store result
    • SUB β€” subtract two registers, store result
    • STORE β€” save a register value to memory
    • PRINT β€” display a register's current value
    • VIEW β€” display all registers and memory at once
  • Interactive menu-driven interface
  • Loops until the CPU is halted

πŸ”§ Challenge Extensions

β€’	Add MUL (multiply) and DIV (divide) instructions
β€’	Add a JUMP instruction for simple loops
β€’	Add an assembler β€” let the user type β€œADD R0 R1 R2” as text
β€’	Simulate a fetch-decode-execute cycle
β€’	Add a program counter (PC) register

About

A C++ program that simulates a basic CPU with registers, memory and simple instructions (load, add, sub, store, print).

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages