All Projects → caleb531 → cache-simulator

caleb531 / cache-simulator

Licence: MIT license
A processor cache simulator for the MIPS architecture

Programming Languages

python
139335 projects - #7 most used programming language

Labels

Projects that are alternatives of or similar to cache-simulator

Redasm
The OpenSource Disassembler
Stars: ✭ 1,042 (+3493.1%)
Mutual labels:  mips
Ubnt Mips Shadowsocks Libev
Cross complie shadowsocks for UBNT devices based on mipsel or mips64
Stars: ✭ 127 (+337.93%)
Mutual labels:  mips
Mipt Mips
Cycle-accurate pre-silicon simulator of RISC-V and MIPS CPUs
Stars: ✭ 250 (+762.07%)
Mutual labels:  mips
Unisimd Assembler
SIMD macro assembler unified for ARM, MIPS, PPC and x86
Stars: ✭ 63 (+117.24%)
Mutual labels:  mips
Ccompiler
c语言编译器,用 lex 和 yacc 工具完成词法分析与语法分析并生成语法树,C++实现了语 法树的解析并生成中间代码,生成中间代码的过程中实现了错误检测。C++实 现了中间代码的优化操作。之后利用 python 对中间代码进行处理并生成 mips 汇编码并且可以成功在 PCSpim(mips 模拟器)上运行。
Stars: ✭ 113 (+289.66%)
Mutual labels:  mips
Cross
“Zero setup” cross compilation and “cross testing” of Rust crates
Stars: ✭ 2,461 (+8386.21%)
Mutual labels:  mips
Mips
MIPS assembler and simulator
Stars: ✭ 38 (+31.03%)
Mutual labels:  mips
defcon26 badgehacking
Notes and things regarding hacking DEFCON 26's badge
Stars: ✭ 27 (-6.9%)
Mutual labels:  mips
Rcore
Rust version of THU uCore OS. Linux compatible.
Stars: ✭ 2,175 (+7400%)
Mutual labels:  mips
Tengine
Tengine is a lite, high performance, modular inference engine for embedded device
Stars: ✭ 4,012 (+13734.48%)
Mutual labels:  mips
Bap
Binary Analysis Platform
Stars: ✭ 1,385 (+4675.86%)
Mutual labels:  mips
Keystone
Keystone assembler framework: Core (Arm, Arm64, Hexagon, Mips, PowerPC, Sparc, SystemZ & X86) + bindings
Stars: ✭ 1,654 (+5603.45%)
Mutual labels:  mips
Openwrt Node Packages
OpenWrt Project Node.js packages. v10.x LTS and v12.x LTS and v14.x LTS
Stars: ✭ 176 (+506.9%)
Mutual labels:  mips
Pseultra
N64 library
Stars: ✭ 60 (+106.9%)
Mutual labels:  mips
COExperiment Repo
支持 45 条 MIPS 指令的单周期处理器 -- 计算机组成原理实验 NUAA Spring 2017
Stars: ✭ 23 (-20.69%)
Mutual labels:  mips
Mips Cpu
A MIPS CPU implemented in Verilog
Stars: ✭ 38 (+31.03%)
Mutual labels:  mips
Mips to c
A MIPS decompiler.
Stars: ✭ 140 (+382.76%)
Mutual labels:  mips
tor-router-nexx-wt3020
Make a cheap TOR router for $10
Stars: ✭ 15 (-48.28%)
Mutual labels:  mips
Awesome-Retro-Docs
A curated collection of technical documentation for Arcades, Handhelds, Consoles, Computers and MCU’s.
Stars: ✭ 128 (+341.38%)
Mutual labels:  mips
Ataraxia
Simple and lightweight source-based multi-platform Linux distribution with musl libc.
Stars: ✭ 226 (+679.31%)
Mutual labels:  mips

Cache Simulator

Copyright 2015-2022 Caleb Evans
Released under the MIT license

tests 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.

For example, the following command simulates a 3-way set associative LRU cache, with 2 words per block. To see all examples and their respective outputs, see examples.txt.

# 3-way set associative (LRU; 2 words per block)
cache-simulator --cache-size 24 --num-blocks-per-set 3 --num-words-per-block 2 --word-addrs 3 180 43 2 191 88 190 14 181 44 186 253

This produces the following output:

     WordAddr      BinAddr          Tag        Index       Offset     Hit/Miss
--------------------------------------------------------------------------------
            3    0000 0011        00000           01            1         miss
          180    1011 0100        10110           10            0         miss
           43    0010 1011        00101           01            1         miss
            2    0000 0010        00000           01            0          HIT
          191    1011 1111        10111           11            1         miss
           88    0101 1000        01011           00            0         miss
          190    1011 1110        10111           11            0          HIT
           14    0000 1110        00001           11            0         miss
          181    1011 0101        10110           10            1          HIT
           44    0010 1100        00101           10            0         miss
          186    1011 1010        10111           01            0         miss
          253    1111 1101        11111           10            1         miss

                                     Cache
--------------------------------------------------------------------------------
         00                  01                  10                  11
--------------------------------------------------------------------------------
       88,89         2,3 42,43 186,187  180,181 44,45 252,253   190,191 14,15

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).

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].