Abstract
MGSim is an open source discrete event simulator for on-chip hardware components, developed at the University of Amsterdam. It is intended to be a research and teaching vehicle to study the fine-grained hardware/software interactions on many-core and hardware multithreaded processors. It includes support for core models with different instruction sets, a configurable multi-core interconnect, multiple configurable cache and memory models, a dedicated I/O subsystem, and comprehensive monitoring and interaction facilities. The default model configuration shipped with MGSim implements Microgrids, a many-core architecture with hardware concurrency management. MGSim is furthermore written mostly in C++ and uses object classes to represent chip components. It is optimized for architecture models that can be described as process networks.
Introduction: The Need for "Human-Scale" Simulation
As the computing landscape shifts from multi-core to many-core architectures, the interactions between hardware components—such as caches, interconnects, and memory controllers—become increasingly fine-grained and difficult to predict. Researchers and students often face a dilemma when selecting simulation tools. Existing options typically fall into two extremes: partial emulators that lack full-system modeling, or massive, complex full-system simulators like Gem5 that can be overwhelming for those focused on specific micro-architectural features.
MGSim was developed at the University of Amsterdam to provide a "human-scale" infrastructure. It is designed to be accessible enough for a single student to comprehend while remaining sufficiently detailed to support high-level research into multi-processor systems-on-chip (MPSoC) and novel hardware-managed concurrency features.
System Architecture and Methodology
MGSim is built primarily in C++ using an object-oriented approach where chip components are modeled as process networks. This philosophy treats hardware components as independent processes that synchronize via FIFO buffers, making it particularly effective for modeling asynchronous networks-on-chip (NoC).
The Three-Phase Simulation Cycle
To accurately model hardware concurrency and arbitration without the overhead of full gate-level simulation, the MGSim kernel utilizes a three-phase cycle:
- Acquire: Processes declare their intent to use shared resources.
- Check: The kernel resolves arbitration (determining resource allocation) and reports back to the processes.
- Commit: Processes update their internal state and shared storage for the next cycle.
Modular Component Library
The simulator provides a "Lego-like" library of blocks, including processor cores supporting Alpha, SPARC, and MIPS ISAs, configurable caches, and I/O subsystems. A standout feature is the inclusion of advanced memory models like Cache Diffusion Networks (CDMA), which utilize ring-based topologies to migrate data blocks dynamically to where they are most frequently accessed.
Evaluation and Key Results
MGSim is evaluated using standard industry benchmarks to demonstrate its utility and performance:
- Performance: The simulator can model thousands of components at a rate of 100–1000 KIPS (Kilo-Instructions Per Second) on standard desktop hardware. While running approximately 150–200x slower than real hardware (as measured by the Whetstone benchmark), this is highly performant for a cycle-accurate discrete event simulator.
- ISA Flexibility: The authors demonstrated that their six-stage RISC pipeline could emulate multiple instruction sets by swapping top-level ISA definitions while maintaining consistent underlying hardware logic.
- Visualization: The
viewlogutility is a critical component of the toolset, converting event traces into interactive HTML files. This allows researchers to visualize how hardware threads move through the pipeline and interact with the L1 cache in real-time.
Discussion and Future Work
One of MGSim's primary contributions is its support for the Microgrid model, which offloads thread management from software to hardware, enabling much finer-grained parallelism than traditional OS-based approaches. Unlike tools that prioritize absolute accuracy for existing hardware, MGSim prioritizes implementation simplicity and flexibility for exploring future many-core designs.
Despite its strengths, the authors have identified areas for improvement:
- Automatic Deadlock Detection: Implementing automated analysis to detect circular dependencies in hardware models before simulation begins.
- Checkpointing: Adding the ability to save and restore simulation states to improve debugging for long-running software.
- Ecosystem Integration: Exploring cross-tool integration, such as using MGSim’s unique memory models within the Gem5 ecosystem.
Summary updated