Skip to main content

A processor cache simulator for the MIPS ISA

Project description

Copyright 2015-2018 Caleb Evans
Released under the MIT license

Build Status Coverage Status

This program simulates a processor cache for the MIPS instruction set architecture. It can simulate all three fundamental caching schemes: direct-mapped, n-way set associative, and fully associative.

The program must be run from the command line and requires Python 3.4+ to run. Executing the program will run the simulation and print an ASCII table containing the details for each supplied word address, as well as the final contents of the cache.

To see example input and output, see examples.txt.

Installing

You can install Cache Simulator via pip (ideally globally):

pip install cache-simulator

Command-line parameters

Required parameters

–cache-size

The size of the cache in words (recall that one word is four bytes in MIPS).

–word-addrs

One or more word addresses (separated by spaces), where each word address is a base-10 positive integer.

Optional parameters

–num-blocks-per-set

The program internally represents all cache schemes using a set associative cache. A value of 1 for this parameter (the default) implies a direct-mapped cache. A value other than 1 implies either a set associative or fully associative cache.

–num-words-per-block

The number of words to store for each block in the cache; the default value is 1.

–num-addr-bits

The number of bits used to represent each given word address; this value is reflected in the BinAddr column in the reference table. If omitted, the default value is the number of bits needed to represent the largest of the given word addresses.

–replacement-policy

The replacement policy to use for the cache. Accepted values are lru (Least Recently Used; the default) and mru (Most Recently Used).

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

cache-simulator-2.0.1.tar.gz (6.5 kB view details)

Uploaded Source

File details

Details for the file cache-simulator-2.0.1.tar.gz.

File metadata

File hashes

Hashes for cache-simulator-2.0.1.tar.gz
Algorithm Hash digest
SHA256 ce8c878e49813b44ed959e9fe3b7c6bba2ec176203dc1e417b0c57ee3ae8a485
MD5 a232735a7817bfd6987a4519cd6f3d9e
BLAKE2b-256 7321a30f4fa52217627038163ffceec9c6c22761198a3f6b6d953a4883bb6096

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page