How adamozh/cache-coherence-simulator works
This is a trace-driven cache-coherence simulator: a command-line run selects a protocol and cache parameters, loads benchmark trace files as processor inputs, advances processors and the bus cycle by cycle, then reports per-processor and bus statistics. MESI, MOESI, and Dragon are distinct coherence strategies; the bus handles shared requests and coherence activity, while the cache hierarchy models stored lines. The source index supports the module relationships shown, but several implementation excerpts were not provided, so uncertain internal calls are omitted.
Main entry points: coherence.cpp Simulation driver · processor_impl.cpp Processor execution · bus_impl.cpp Bus processing · cache.cpp Cache lookup
Components 17
Simulation runtime
- Simulation driver
coherence.cpp - Benchmark traces
- Processor execution
processor_impl.cpp - Bus requests
request.hpp - Bus processing
bus_impl.cpp - Bus interface
bus.hpp
Coherence protocols
- Dragon bus
bus_impl_dragon.cpp - MOESI bus
bus_impl_moesi.cpp - Protocol interface
protocol.hpp - MESI protocol
mesi.cpp - MOESI protocol
moesi.cpp - Dragon protocol
dragon.cpp
Cache storage
- Cache lookup
cache.cpp - Cache sets
cache_set.cpp - Cache lines
cache_line.cpp - Coherence states
state.hpp
Other components
- Simulator user
Connections 30
- Simulator user → Simulation driver: runs
README.md - Simulation driver → Benchmark traces: reads traces
coherence.cpp - Simulation driver → Processor execution: creates processors
coherence.cpp - Simulation driver → Bus processing: selects bus
coherence.cpp - Simulation driver → MESI protocol: selects protocol
coherence.cpp - Simulation driver → MOESI protocol: selects protocol
coherence.cpp - Simulation driver → Dragon protocol: selects protocol
coherence.cpp - Simulation driver → Processor execution: advances cycles
coherence.cpp - Simulation driver → Bus processing: advances cycles
coherence.cpp - Processor execution → Protocol interface: dispatches loads/stores
processor_impl.cpp - Processor execution → Cache lookup: uses cache
- Processor execution → Bus processing: issues requests
- Processor execution → Bus requests: creates requests
- Bus processing → Bus requests: processes requests
bus_impl.cpp - Bus processing → Processor execution: queries processors
bus_impl.cpp - Bus processing → Bus interface: implements
- Dragon bus → Bus processing: extends
- MOESI bus → Bus processing: extends
- MESI protocol → Protocol interface: implements
- MOESI protocol → Protocol interface: implements
- Dragon protocol → Protocol interface: implements
- MESI protocol → Cache lookup: uses cache
- MOESI protocol → Cache lookup: uses cache
- Dragon protocol → Cache lookup: uses cache
- Cache lookup → Cache sets: organizes sets
- Cache sets → Cache lines: stores lines
- Cache lookup → Coherence states: tracks states
- Processor execution → Coherence states: reads and updates
- Simulation driver → Processor execution: reports statistics
coherence.cpp - Simulation driver → Bus processing: reports statistics
coherence.cpp