Skip to content

weyland0/CPU-Simulator

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

CPU Simulator

CPU Simulator is a desktop Java application for step-by-step simulation of a simple CPU instruction flow.

The project models a basic processor with registers and memory, provides a graphical interface for building and executing command sequences, and persists commands in SQLite. It was built as a practice project to explore CPU simulation concepts, desktop UI development, architectural separation with MVP, and synchronization between application state and visualization.

Features

  • step-by-step execution of a command sequence
  • GUI for adding and managing commands
  • visualization of register values
  • visualization of memory state
  • execution progress highlighting
  • command usage statistics
  • SQLite-based command persistence between launches
  • MVP-based project structure

Supported commands

Current implementation supports the following commands:

  • INIT <value> <address> — writes a value to memory
  • LD <address> <register> — loads a value from memory into a register
  • ST <register> <address> — stores a register value into memory
  • ADD <register> <register | value> — adds either another register value or an immediate number
  • MUL <register> <register | value> — multiplies either by another register value or an immediate number

Registers used in the simulator:

  • A
  • B
  • C
  • D

Tech stack

  • Java 23
  • Maven
  • Java Swing
  • SQLite JDBC

Architecture

The application follows the MVP (Model–View–Presenter) pattern:

  • Model — CPU logic, RAM, command validation, program state, SQLite persistence
  • View — Swing-based GUI components for command list, output, memory, registers, and statistics
  • Presenter — interaction layer between UI and business logic

This separation makes the project easier to maintain, extend, and reason about.

Project structure

src/main/java
├── cpus        # application entry point
├── model       # CPU, RAM, commands, validation, persistence
├── presenter   # presenter layer
├── view        # Swing UI
└── util        # auxiliary event utilities

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages