Skip to content

Repository files navigation

CacheVis-RV

An interactive desktop platform for learning cache mapping, miss behavior, locality, replacement policies, AMAT, and write policies.

Built with Python and PySide6 for computer architecture education and visual experimentation.

Tests Labs Verification Platform Stack Usage

中文说明

CacheVis-RV Home showing eight available labs

60-second demo

A first GUI experience follows this path:

  1. Choose a Lab from Home or the sidebar.
  2. Select a preset or provide a trace.
  3. Load the experiment.
  4. Use Step or Run All.
  5. Inspect the available Evidence, Cache State, Statistics, and Timeline views.

This is the common learning workflow, not a promise that every Lab exposes the same controls or the same set of panels.

Why CacheVis-RV

Cache behavior is easier to understand when addresses, cache lines, evidence, and performance consequences are visible together. CacheVis-RV turns abstract rules into guided, repeatable experiments while keeping the underlying models deterministic and testable.

What you can learn

  • How tag, index, and offset bits map an address into a cache.
  • Why misses are compulsory, conflict, or capacity misses under the strict 3C model.
  • How temporal and spatial locality change cache behavior.
  • Where LRU, FIFO, and deterministic Random replacement decisions diverge.
  • Why hit rate alone does not determine AMAT or total memory cost.
  • How write-through/write-back and allocation choices affect dirty state and traffic.

Eight labs

Group Lab Focus
Learn Address Explorer Address splitting, mapping, cache contents, and timeline
Learn Miss Type Lab Compulsory, conflict, and capacity evidence
Learn Locality Lab Temporal/spatial locality and block reuse
Learn Policy Lab LRU, FIFO, and deterministic Random comparison
Learn Performance Lab AMAT, timing assumptions, sweeps, and trade-offs
Learn Write Policy Lab Write propagation, allocation, dirty eviction, and traffic
Classic Tools Single Experiment Configurable trace simulation and report export
Classic Tools Compare Experiment Side-by-side cache parameter comparison

All eight labs are available. Pages are created lazily and cached so navigation preserves an experiment's state.

Visual tour

Miss Type Lab — strict 3C evidence

Miss Type Lab showing 3C evidence

Policy Lab — LRU, FIFO, and Random side by side

Policy Lab replacement comparison

Performance Lab — hit rate is not AMAT

Performance Lab AMAT sweep

Write Policy Lab — four synchronized policy lanes

Write Policy Lab showing dirty state and traffic

Quick start

Verified environment

The v3.0.0 release was verified with the following environment; these are release verification facts, not minimum-version requirements.

Item Verified with
Operating system Windows 10 / 11
Python 3.12
PySide6 6.11.1
Test runner unittest
GUI validation Qt offscreen smoke and real event-loop startup
Officially verified on Windows 10 and Windows 11. Other platforms have not yet
completed formal verification.
git clone https://github.com/Yucheng-art/CacheVis-RV.git
cd CacheVis-RV
python -m venv .venv
.\.venv\Scripts\python.exe -m pip install --upgrade pip
.\.venv\Scripts\python.exe -m pip install -r requirements.txt
.\.venv\Scripts\python.exe -B .\src\main.py --gui

After setup, the repository-relative helpers are also available:

.\scripts\run_gui.ps1
.\scripts\run_tests.ps1

GUI workflow

  1. Launch the application with --gui or scripts/run_gui.ps1.
  2. Select a Lab from Home or the sidebar.
  3. Choose a preset or enter a supported trace.
  4. Load the experiment to start from its defined initial state.
  5. Use Step for one access or Run All for the remaining accesses.
  6. Observe the Evidence, Cache State, Statistics, and Timeline views that the selected Lab provides.

CLI examples

Run one sequential experiment with an explicit cache configuration:

.\.venv\Scripts\python.exe -B .\src\main.py --trace sequential --count 16 --cache-size 1024 --block-size 16 --ways 2 --policy LRU

Compare associativity on a conflict-oriented trace:

.\.venv\Scripts\python.exe -B .\src\main.py --trace conflict --count 32 --cache-size 1024 --block-size 16 --ways 2 --policy FIFO --compare ways

Export the supported CSV and Markdown reports for a single experiment:

.\.venv\Scripts\python.exe -B .\src\main.py --trace sequential --count 16 --export-dir .\outputs\cli-example

All options above are provided by the current src/main.py CLI. Run with --help for the complete argument reference.

Example experiments

  • Use Address Explorer to follow 0, 4, 8, 0 one step at a time.
  • Run the three Miss Type presets and inspect the actual-cache/reference-cache evidence.
  • Contrast row-major and column-major matrix access in Locality Lab.
  • Find the first divergence among LRU, FIFO, and Random in Policy Lab.
  • Run Hit Rate Is Not AMAT and compare timing assumptions in Performance Lab.
  • Compare all four write-policy lanes, then separate runtime traffic from final dirty drain.

Project evolution

Version Product stage Stable verification baseline
V1.0 Cache Simulator 46 tests
V2.0 Address Visualization 89 tests
V3.0 Educational Cache Platform v3.0.0 verification baseline: 720 tests, Skip 0

main is the current V3.0 product line, and v3.0.0 is the current formal release. archive/v2 preserves the V2 history as a historical branch; it is not the current development branch and was not merged into main. See VERSION_HISTORY.md for the repository references and version boundaries.

Architecture

The platform shell owns navigation and lazy page creation. Each teaching lab has its own controller, immutable page state/view models, and PySide6 widget tree. Shared cache behavior lives in a GUI-free core package. Compatibility facades keep the established flat imports working for existing callers.

flowchart TD
    Entry["src/main.py"] --> Shell["Platform Shell"]
    Shell --> Registry["Lab Registry"]
    Registry --> Widget["Independent Lab Widget"]
    Widget --> Controller["Lab Controller"]
    Controller --> State["Page State / View Models"]
    Controller --> Core["GUI-free Core"]
Loading
src/main.py
└── cachevis_rv/
    ├── core/          cache configuration, lines, simulator, policies, statistics
    ├── experiments/   reusable runners, parsing, reporting, and services
    ├── gui/           platform shell, registry, Home, sidebar, and theme
    └── labs/          one independent package per lab

Verification

  • The v3.0.0 verification baseline contains 720 unittest tests with no skips.
  • Windows GitHub Actions CI validates the release baseline with Python 3.12.
  • Windows clean-copy installation and the documented Quick Start are verified.
  • Qt offscreen creation/navigation smoke tests pass.
  • The real GUI entry reaches the Qt event loop without a traceback.
  • Core, controller, view-model, registry, parser, invariants, and platform boundaries are tested.

Run the same suite locally:

.\.venv\Scripts\python.exe -B -m unittest discover -s tests -v

Project structure

.github/             Windows CI and issue forms
docs/                architecture, milestone notes, checklists, and screenshots
scripts/             repository-relative PowerShell launchers
src/                 application, core, experiments, GUI, and lab packages
tests/               unittest regression and boundary tests

Supported scope

CacheVis-RV is an educational, deterministic cache-learning platform. It covers address mapping, 3C miss classification, locality evidence, replacement-policy comparison, analytical performance modeling, and write-policy traffic under the explicit assumptions displayed by each lab.

Current limitations

  • It is not a cycle-accurate or RTL simulator.
  • It is not a complete memory-hierarchy or industrial performance model.
  • The write-policy model does not simulate store buffers, write combining, coherence, memory consistency, energy, or pipeline CPI.
  • EXE packaging and formal validation outside Windows 10/11 are not provided.
  • Results apply to the selected configuration, trace, and stated assumptions; they do not establish a universally optimal policy.

Project status

CacheVis-RV V3.0 is the current public release. The application exposes eight available labs, with a v3.0.0 verification baseline of 720 automated tests and no skips. See CHANGELOG.md and the V3.0 release notes.

Copyright and usage

Copyright © 2026 Yucheng Xu. All rights reserved. The code is source-available for portfolio review, educational evaluation, and demonstration. No standard open-source license is granted. See COPYRIGHT.md and THIRD_PARTY_NOTICES.md.

Author / portfolio note

Designed and implemented by Yucheng Xu as a computer architecture education and software-engineering portfolio project. Responsible security reports should follow SECURITY.md and must not include secrets or personal data.

About

Interactive PySide6 desktop platform for learning cache mapping, miss types, locality, replacement policies, AMAT, and write policies.

Topics

Resources

Security policy

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages