Skip to content

f3rhd/OoOVisual

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

143 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

OoOVisual: Out-of-Order CPU Architecture Visualizer

1. Overview

OoOVisual is an architectural-level visualization tool for an Out-of-Order (OoO) CPU core.

It models modern superscalar mechanisms such as:

  • Reorder Buffer (ROB)
  • Register Renaming
  • Distributed Reservation Stations
  • Out-of-Order Execution
  • Branch Prediction & Recovery
  • Load/Store Unit

The project's goal is to make dynamic scheduling, speculative execution, and pipeline behavior observable in real time, providing clear insights into microarchitectural operation.


2. Features

Architectural Simulation

  • Tomasulo-style dynamic scheduling
  • Physical register allocation and renaming
  • In-order commit via Reorder Buffer
  • Speculative execution with branch prediction
  • Pipeline flush and recovery on misprediction
  • Distributed reservation stations
  • Execution units and load/store handling

Visual Architecture Layout

  • Units placed in 2D space, connected with animated, orthogonal wires
  • Wires pulse when control or data signals propagate
  • Pulse colors indicate event types:
Color Context Meaning
Green Any Execution Unit → ROB Instruction committed successfully
Green ROB → Register Manager Operation completed; updates the register alias table
Green Fetch Unit → Fetch Group → Dispatcher Fetch successful; fetch group is on its way to be dispatched
Red Dispatcher → Any Reservation Station Dispatch failed due to structural hazards
Orange Dispatcher Dispatcher is actively dispatching instructions
Purple ROB → Register Manager Flushing ROB entries and restoring the alias table due to branch misprediction

Interactive Inspection

  • Hover over units to view current state
  • Double left click → open detailed view
  • Double right click → close detailed view

Clickable units include:

  • Fetch Unit
  • Reorder Buffer
  • Register Manager
  • Load/Store Execution Unit

Camera Controls

  • W / A / S / D → Move camera
  • + / - → Zoom in / Zoom out

3. GUI Demonstration

OoOVisual Demo


4. Dependencies

OoOVisual is built using:

  • C++20
  • Dear ImGui
  • GLFW
  • OpenGL
  • CMake

Linux (Debian/Ubuntu)

sudo apt update
sudo apt install build-essential cmake libglfw3-dev libgl1-mesa-dev

Windows (vcpkg recommended)

git clone https://github.com/microsoft/vcpkg.git
cd vcpkg
.\bootstrap-vcpkg.bat
vcpkg install glfw3

macOS (Homebrew)

brew install glfw

5. Building the Project

Linux / macOS

git clone https://github.com/f3rhd/OoOVisual.git
cd OoOVisual
cmake -S . -B build -DCMAKE_BUILD_TYPE=Release
cmake --build build

Windows (Visual Studio)

cmake -S . -B build -G "Visual Studio 18 2026" -A x64 -DCMAKE_TOOLCHAIN_FILE="C:/path/to/vcpkg/scripts/buildsystems/vcpkg.cmake"

6. Usage

Run the visualizer:

./OoOVisual <input.s>

When launched:

  • Architectural layout is displayed
  • Wires pulse each simulation tick when signals propagate
  • Hover over units to inspect state
  • Double left click → open detailed window
  • Double right click → close detailed window
  • WASD to navigate, +/- to zoom

7. Repository Structure

OoOVisual/
├─ OoOVisual/Core/                    # OoO core implementation 
├─ OoOVisual/Frontend/                # Frontend needed for assembly parsing
├─ OoOVisual/Visualizer/              # ImGui rendering, interactions, camera control
├─ OoOVisual/tests/                   # RISC-V Assembly tests
├─ OoOVisual/vendor/                  # Third-party libraries (GLFW, ImGui)
├─ OoOVisual/main.cpp                 # Entry point
├─ CMakeLists.txt                     # Build configuration
├─ assets/                            # Assets
└─ README.md                          # This file

8. MMIO Register Reference

The simulated CPU exposes a software GPU via memory-mapped I/O. Writing to these addresses issues graphics commands.

Address Name Description
0x00 CMD_TYPE Command type: 1=FILL_RECT, 2=LINE, 3=RECT, 4=TRIANGLE, 5=FILL_TRIANGLE
0x04 X1 Start X coordinate (or triangle point 1 X)
0x08 Y1 Start Y coordinate (or triangle point 1 Y)
0x0C X2 End X coordinate (or triangle point 2 X)
0x10 Y2 End Y coordinate (or triangle point 2 Y)
0x14 COLOR Draw color, packed as 0xRRGGBBAA
0x18 START Write 1 to execute the current command
0x1C X3 Triangle point 3 X (CMD_TYPE = 4 or 5 only)
0x20 Y3 Triangle point 3 Y (CMD_TYPE = 4 or 5 only)

To issue a command, write all parameter registers first, then write 1 to START. The GPU executes synchronously on the START write.


9. Purpose

OoOVisual is intended for:

  • Studying Out-of-Order execution
  • Understanding Tomasulo-style scheduling
  • Visualizing speculative execution and recovery
  • Teaching modern CPU microarchitecture concepts

10. License

This project is licensed under the MIT License.

About

Out of Order Execution Visualizer

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages