Skip to content

Commit 337173e

Browse files
feat: v1.2.2 - Cross-platform Fixes and Windows Support (#4)
v1.2.2 - Cross-platform fixes, Windows support, bug fixes for replacement policy parsing and trace inline comments
1 parent ad8cce9 commit 337173e

File tree

20 files changed

+3688
-2880
lines changed

20 files changed

+3688
-2880
lines changed

.gitignore

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,4 +93,21 @@ test_*.trace
9393
*_test_trace.txt
9494
perf_test_trace.txt
9595

96-
TODO.md
96+
# Development files
97+
TODO.md
98+
99+
# PDF files (avoid committing email attachments, etc.)
100+
*.pdf
101+
102+
# Python artifacts (if using Python tools)
103+
__pycache__/
104+
*.py[cod]
105+
.env
106+
venv/
107+
108+
# Additional IDE files
109+
.clangd/
110+
.cache/clangd/
111+
112+
# CMake user presets
113+
CMakeUserPresets.json

CHANGELOG.md

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,46 @@ All notable changes to the Cache Simulator project will be documented in this fi
55
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
66
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
77

8+
## [1.2.2] - 2026-01-06
9+
10+
### Added
11+
- **Windows Platform Documentation**: Comprehensive guide for building and running on Windows
12+
- Build instructions for GCC, MSVC, and Clang
13+
- Known issues and solutions
14+
- Troubleshooting guide
15+
- **Windows PowerShell Scripts**: Cross-platform build and benchmark scripts
16+
- `build.ps1`: Simple build script for Windows
17+
- `scripts/build_all.ps1`: Comprehensive build with options (Debug, Clean, Tests)
18+
- `scripts/run_benchmarks.ps1`: Benchmark runner for Windows
19+
20+
### Fixed
21+
- **Cross-Platform Header Includes**: Added missing standard library headers for strict compiler compliance
22+
- `cache.h`: Added `#include <array>` for `std::array` usage
23+
- `logger.h`: Added `#include <array>` for `LogLevelNames`
24+
- `trace_utils.h`: Added `#include <functional>` for `std::function`
25+
- `interconnect.h`: Added `#include <cmath>`, `<cstdint>`, `<memory>`, `<optional>`
26+
- **Windows Test Compatibility**: Fixed file locking issues in test files
27+
- `visualization_test.cpp`: Used RAII scope blocks to ensure `ifstream` is closed before `filesystem::remove()`
28+
- `cache_performance_test.cpp`: Used RAII scope blocks to ensure `TraceParser` releases file handle before cleanup
29+
- All 13 tests now pass on Windows
30+
- **JSON Replacement Policy Parsing**: Fixed bug where JSON config files only recognized LRU and NRU policies
31+
- Added support for FIFO, Random, and PLRU replacement policies in the JSON parser
32+
- Both L1 and L2 cache configurations now correctly parse all replacement policy options
33+
- **INI Replacement Policy Parsing**: Added missing replacement policy support to INI config parser
34+
- Both `replacement_policy` and `replacementPolicy` keys are now recognized
35+
- **Profiler Region Naming**: Fixed confusing region names that implied L1/L2 cache mapping
36+
- Renamed to "Low/High Address Region" with explanatory comments
37+
- Added documentation that regions are for pattern analysis, not cache behavior
38+
- **Trace Parser Inline Comments**: Fixed parser to handle inline comments (e.g., `r 0x1000 # comment`)
39+
- Previously, text after `#` on the same line was incorrectly parsed as a processor ID
40+
- Now properly strips inline comments before parsing
41+
- **C++20 Standard**: Updated CMakeLists.txt to require C++20 for designated initializer support
42+
43+
### Technical Details
44+
- Designated initializers (`.field = value`) in multiprocessor code require C++20
45+
- The fixes ensure compatibility across Windows (GCC/MSVC), macOS (Clang/GCC), and Linux (GCC/Clang)
46+
- No functional changes - only build and compatibility improvements
47+
848
## [1.2.1] - 2025-09-02
949

1050
### Fixed

CMakeLists.txt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
cmake_minimum_required(VERSION 3.14)
2-
project(CacheSimulator VERSION 1.2.1 LANGUAGES CXX)
2+
project(CacheSimulator VERSION 1.2.2 LANGUAGES CXX)
33

4-
# Set C++17 as the required standard
5-
set(CMAKE_CXX_STANDARD 17)
4+
# Set C++20 as the required standard (required for designated initializers)
5+
set(CMAKE_CXX_STANDARD 20)
66
set(CMAKE_CXX_STANDARD_REQUIRED ON)
77
set(CMAKE_CXX_EXTENSIONS OFF)
88

README.md

Lines changed: 36 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22

33
# 🚀 Cache Simulator
44

5-
![Version](https://img.shields.io/badge/version-1.2.1-blue)
6-
![C++17](https://img.shields.io/badge/C%2B%2B-17-orange)
5+
![Version](https://img.shields.io/badge/version-1.2.2-blue)
6+
![C++20](https://img.shields.io/badge/C%2B%2B-20-orange)
77
![License](https://img.shields.io/badge/license-MIT-green)
88
![Build Status](https://img.shields.io/badge/build-passing-brightgreen)
99
![PRs Welcome](https://img.shields.io/badge/PRs-welcome-brightgreen.svg?style=flat-square)
@@ -21,15 +21,21 @@
2121

2222
</div>
2323

24-
## ✨ What's New in v1.2.0
24+
## ✨ What's New in v1.2.2
25+
26+
- **🪟 Windows Support**: Full cross-platform compatibility with PowerShell build scripts
27+
- **🐛 Bug Fixes**: Fixed replacement policy parsing for JSON/INI configs (FIFO, Random, PLRU now work)
28+
- **💬 Inline Comments**: Trace files now support comments at end of lines (`r 0x1000 # comment`)
29+
- **📄 Enhanced Docs**: Comprehensive Windows platform guide
30+
31+
### Previous: v1.2.0 Highlights
2532

2633
- **🔄 NRU Replacement Policy**: Efficient Not Recently Used implementation with reference bit tracking
2734
- **💾 Victim Cache**: Reduces conflict misses by up to 25% with configurable fully-associative cache
2835
- **📝 Advanced Write Policies**: No-write-allocate and write combining buffer support
2936
- **⚡ Parallel Processing**: Multi-threaded simulation with up to 4x speedup on 8-core systems
3037
- **🖥️ Multi-Processor Support**: Complete MESI coherence protocol with directory-based tracking
3138
- **📊 Statistical Visualization**: Built-in ASCII charts including line graphs, pie charts, and heatmaps
32-
- **🔧 Enhanced Tools**: Cache analyzer and performance comparison utilities
3339

3440
## 🎯 Key Features
3541

@@ -63,12 +69,13 @@
6369
## 🚀 Quick Start
6470

6571
### Prerequisites
66-
- C++17 compatible compiler (GCC 7+, Clang 5+, MSVC 19.14+)
72+
- C++20 compatible compiler (GCC 10+, Clang 10+, MSVC 2019+)
6773
- CMake 3.14+ or GNU Make
6874
- Optional: Python 3.6+ for visualization scripts
6975

7076
### Installation
7177

78+
#### Linux / macOS (Bash)
7279
```bash
7380
# Clone the repository
7481
git clone https://github.com/muditbhargava66/CacheSimulator.git
@@ -79,10 +86,30 @@ mkdir build && cd build
7986
cmake -DCMAKE_BUILD_TYPE=Release ..
8087
cmake --build . -j$(nproc)
8188

82-
# Or build with Make
83-
make -j$(nproc)
89+
# Or use the build script
90+
./build.sh
91+
```
92+
93+
#### Windows (PowerShell)
94+
```powershell
95+
# Clone the repository
96+
git clone https://github.com/muditbhargava66/CacheSimulator.git
97+
cd CacheSimulator
98+
99+
# Use the PowerShell build script
100+
.\build.ps1
101+
102+
# Or build manually
103+
mkdir build; cd build
104+
cmake -DCMAKE_BUILD_TYPE=Release ..
105+
cmake --build . --parallel
106+
107+
# Run tests
108+
ctest --output-on-failure
84109
```
85110

111+
> **📖 See [docs/WINDOWS.md](docs/WINDOWS.md) for detailed Windows instructions.**
112+
86113
### Basic Usage
87114

88115
```bash
@@ -297,7 +324,7 @@ If you use this simulator in your research, please cite:
297324
@software{CacheSimulator2025,
298325
author = {Mudit Bhargava},
299326
title = {Cache Simulator: A C++17 Cache and Memory Hierarchy Simulator},
300-
version = {1.2.1},
327+
version = {1.2.2},
301328
year = {2025},
302329
url = {https://github.com/muditbhargava66/CacheSimulator}
303330
}
@@ -332,7 +359,7 @@ This simulator is ideal for:
332359
📫 **Contact**: [@muditbhargava66](https://github.com/muditbhargava66)
333360
🐛 **Report Issues**: [Issue Tracker](https://github.com/muditbhargava66/CacheSimulator/issues)
334361

335-
© 2025 Mudit Bhargava. [MIT License](LICENSE)
362+
© 2026 Mudit Bhargava. [MIT License](LICENSE)
336363
<!-- Copyright symbol using HTML entity for better compatibility -->
337364

338365
</div>

build.ps1

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
# Build script for Cache Simulator on Windows
2+
# PowerShell equivalent of build.sh
3+
4+
$ErrorActionPreference = "Stop"
5+
6+
# Get number of CPU cores
7+
$NUM_CORES = [Environment]::ProcessorCount
8+
if ($NUM_CORES -eq 0) { $NUM_CORES = 4 }
9+
10+
Write-Host "Building Cache Simulator v1.2.2" -ForegroundColor Cyan
11+
Write-Host "Detected $NUM_CORES CPU cores" -ForegroundColor Gray
12+
13+
# Create build directory if it doesn't exist
14+
if (-not (Test-Path "build")) {
15+
New-Item -ItemType Directory -Path "build" | Out-Null
16+
}
17+
18+
Set-Location build
19+
20+
# Configure with CMake
21+
Write-Host "`nConfiguring with CMake..." -ForegroundColor Yellow
22+
cmake -DCMAKE_BUILD_TYPE=Release ..
23+
24+
if ($LASTEXITCODE -ne 0) {
25+
Write-Host "CMake configuration failed!" -ForegroundColor Red
26+
Set-Location ..
27+
exit 1
28+
}
29+
30+
# Build
31+
Write-Host "`nBuilding with $NUM_CORES parallel jobs..." -ForegroundColor Yellow
32+
cmake --build . --parallel $NUM_CORES
33+
34+
if ($LASTEXITCODE -eq 0) {
35+
Write-Host "`nBuild successful!" -ForegroundColor Green
36+
Write-Host ""
37+
Write-Host "To run tests:" -ForegroundColor Cyan
38+
Write-Host " ctest --output-on-failure"
39+
Write-Host ""
40+
Write-Host "To run the simulator:" -ForegroundColor Cyan
41+
Write-Host " .\bin\cachesim.exe <trace_file>"
42+
Write-Host " .\bin\cachesim.exe --config <config_file> <trace_file>"
43+
Write-Host ""
44+
Write-Host "Available tools:" -ForegroundColor Cyan
45+
Write-Host " .\bin\tools\cache_analyzer.exe"
46+
Write-Host " .\bin\tools\trace_generator.exe"
47+
}
48+
else {
49+
Write-Host "Build failed!" -ForegroundColor Red
50+
Set-Location ..
51+
exit 1
52+
}
53+
54+
Set-Location ..

build.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ else
1111
NUM_CORES=$(nproc 2>/dev/null || echo 4)
1212
fi
1313

14-
echo "Building Cache Simulator v1.1.0"
14+
echo "Building Cache Simulator v1.2.2"
1515
echo "Detected $NUM_CORES CPU cores"
1616

1717
# Create build directory if it doesn't exist

0 commit comments

Comments
 (0)