Skip to content

This simple CPU simulator is designed for educational purposes, enabling users to visualize the fetch, decode, and execute processes of programs executed by the CPU. It helps users learn about CPU operations and the basics of computer architecture.

Notifications You must be signed in to change notification settings

mohitShahiT/CPU-simulator

Repository files navigation

CPU Simulator

A web-based CPU simulator built with React and TypeScript. This project visually demonstrates the working of a simple CPU, RAM, and Bus system, allowing users to load and run sample programs in a simulated environment.

Features

  • Visual representation of CPU, RAM, and Bus components
  • Load and run sample programs into simulated memory
  • Step through program execution and observe register/memory changes
  • Modular React component structure
  • State management using React Context API

Getting Started

Prerequisites

  • Node.js (v16 or above recommended)
  • npm or yarn

Installation

  1. Clone the repository:
    git clone https://github.com/mohitShahiT/CPU-simulator.git
    cd cpu-simulator
  2. Install dependencies:
    npm install
    # or
    yarn install

Running the App

Start the development server:

npm run dev
# or
yarn dev

Open http://localhost:5173 in your browser to view the simulator.

Project Structure

src/
  App.tsx            # Main app entry point
  components/        # UI components (CPU, RAM, Bus, etc.)
  context/           # React Contexts for state management
  utils/             # Utility functions and sample programs
  index.css          # Global styles (Tailwind CSS)

Usage

  • Click the controller to open the program list.
  • Select a sample program to load it into memory.
  • Use the provided controls to step through execution and observe how the CPU, RAM, and Bus interact.

Customization

  • Add new sample programs in src/utils/programs.ts.
  • Modify or extend components in src/components/ for custom CPU/RAM/Bus logic.

Technologies Used

License

MIT

About

This simple CPU simulator is designed for educational purposes, enabling users to visualize the fetch, decode, and execute processes of programs executed by the CPU. It helps users learn about CPU operations and the basics of computer architecture.

Resources

Stars

Watchers

Forks