Skip to content

efg/CohereSim

Repository files navigation

CohereSim

[TOC]

About

CohereSim is aimed at providing runtime metrics of a DSM processor to enhance education in computer architecture, wherein it enables students to compare a variety of caches and draw conclusions about the impact of the cache size, line size, associativity, coherence protocol and replacement policy.

VersionProgrammerDescription
1.0Ahmad Samih & Yan SolihinInitial Version
2.0Ed GehringerRevised for Spring 2015
3.0Anthony SpendloveComplete rewrite for Spring 2025
3.1Anthony SpendloveAdd batch mode (parallel execution)
3.1.1Anthony SpendloveTrace file chunks are "double buffered" in batch mode
3.2Anthony SpendloveAdded write timestamp debugging feature, consistency refactorings, bugfixes, portability and cross-platform edits
3.3Anthony SpendloveAdded directory protocol program structure

(Version history begins with v3.0)

This software operates under the GNU General Public License v3.0.

The repo is found on my GitHub. A copy of this documentation is hosted on my GitHub Pages.

Roadmap

  • Implement Directory Protocols
  • Compressed Trace Files
  • More Protocols and Policies

CohereSim Simulator

Installation

This repository uses sub-modules to generate trace files for the simulation. If you do not wish to generate trace files, then the sub-modules can be left empty (uninitialized). If you do want to generate trace files, then:

  • If you already downloaded this repo, then run git submodule update --init from the root directory.
  • If not, then simply include the --recurse-submodules option in the git clone command.

Build & Run

The provided make file in the root directory is used to build CohereSim. It currently has four targets:

  • all: (Incremental) build, default target
  • rebuild: Fully re-compile all source files
  • clean: Remove files generated by the build and run process
  • *.bin: Run CohereSim in batch metrics mode, using configs.txt as the configuration list and *.bin as the trace file

For more information on running CohereSim and its modes of operation, see the CohereSim manual.

Development

For further development, a development manual is included in this documentation.

Tool Suite

Doxygen Documentation

The codebase and tool suite are documented using Doxygen style comments. As such, the Doxyfile is provided at the root directory and configured to generate HTML documentation of this software suite. To generate this documentation, simply issue doxygen on the command line in the same directory as this file. The resulting documentation will be available at docs/html/index.html.

Template File Generation

CohereSim was built to be extended, and thus template files and a template generator script are provided to automate the boilerplate code.

See the template file generation guide to learn how to create new source files using the provided templates.

Trace File Generation

CohereSim reads in memory trace files to simulate cache behavior and record statistics. These are binary files comprised of a series of 5-byte memory accesses. Each memory access is structured as follows:

  • The first 7 bits (7 high bits) are the CPU core ID that performs the memory access
  • The 8th bit (LSB) is the operation (1 = write, 0 = read)
  • The remaining 4 bytes are the 32-bit memory address accessed, stored in little endian byte ordering

For example, a trace of 09 70 7D 11 00 evaluates to a write operation by CPU core 4 at address 0x00117D70.

See the trace file generation guide to learn how to create your own trace files.

Folder Structure

PathDescription
๐Ÿ— bin/Build directory
๐Ÿ“‚ docs/Documentation files
๐Ÿ— html/Generated HTML documentation
๐Ÿ“‚ pages/Custom documentation pages
๐Ÿ“„ cache_sim.mdCohereSim operation manual
๐Ÿ“„ development.mdDeveloper manual
๐Ÿ“„ exit_codes.mdCohereSim exit code explanation
๐Ÿ“„ gen_traces.mdTrace file generation manual
๐Ÿ“„ templates.mdTemplate file generation manual
๐Ÿ“„ custom_doxygen.cssStylesheet for doxygen documentation
๐Ÿ“‚ src/CohereSim source files (see file list)
๐Ÿ“‚ template/Template files & generator script
๐Ÿ“„ coherence_c.tmpltCoherence protocol source file template
๐Ÿ“„ coherence_h.tmpltCoherence protocol header file template
๐Ÿ“„ directory_c.tmpltDirectory protocol source file template
๐Ÿ“„ directory_h.tmpltDirectory protocol header file template
๐Ÿ“„ interactive_c.tmpltInteractive mode source file template
๐Ÿ“„ interactive_h.tmpltInteractive mode header file template
๐Ÿ“œ mksrc.shSource file generator script
๐Ÿ“„ replacement_c.tmpltReplacement policy source file template
๐Ÿ“„ replacement_h.tmpltReplacement policy header file template
๐Ÿ“‚ tools/First- and third-party tool suite for trace file generation
๐Ÿ“ฆ gem5/gem5 computer hardware simulator
๐Ÿ“ฆ parsec-benchmark/PARSEC benchmark suite
๐Ÿ“„ extractor.cTranslator program from gem5 output into trace file binary format
๐Ÿ“œ gem5_config.pygem5 configuration for trace file generation
๐Ÿ“œ gen_trace.shTrace file generation script
๐Ÿ“œ get_platform.shPlatform string generator
๐Ÿ— traces/Generated trace files
๐Ÿ“„ .gitignoreGit ignore list
๐Ÿ“„ .gitmodulesGit sub-module list
๐Ÿ“„ configs.txtExample configs file
๐Ÿ“œ DoxyfileDoxygen script for generating documentation
๐Ÿ”— index.htmlLink to generated HTML documentation
๐Ÿ“„ LICENSELicense file
๐Ÿ“œ MakefileMake script for building and running CohereSim
๐Ÿ“„ README.mdReadme file
๐Ÿ“„ sequence7.2.txtCache line access sequence from the textbook
๐Ÿ“„ sequence7.6.txtCache line access sequence from the textbook
  • ๐Ÿ“‚: Folder
  • ๐Ÿ—: Folder excluded by .gitignore
  • ๐Ÿ“ฆ: GitHub sub-module
  • ๐Ÿ“„: File
  • ๐Ÿ“œ: Script file
  • ๐Ÿ”—: Link to file

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • C++86.6%
  • Shell7.2%
  • C4.6%
  • Other1.6%