GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — GitHub - himanshu5-prog/cache_implementation: The repository simulates direct-mapped , four way set associative and 8 way set associative cache.

BranchesTags
Open more actions menu

Latest commit

 

History

47 Commits
47 Commits

Folders and files

NameName
Last commit message
Last commit date
src
src
 
 
trace
trace
 
 
README
README
 
 
compileCode.tcl
compileCode.tcl
 
 
compileCodeFourWay.tcl
compileCodeFourWay.tcl
 
 
compileCodeSkCache.tcl
compileCodeSkCache.tcl
 
 
compileEightWay.tcl
compileEightWay.tcl
 
 
test_direct_mapped.cc
test_direct_mapped.cc
 
 
test_eightWayCache.cc
test_eightWayCache.cc
 
 
test_fourWayCache.cc
test_fourWayCache.cc
 
 
test_sk_cache.cc
test_sk_cache.cc
 
 

Repository files navigation

################ Cache Implementation ######################
This codebase has cache implementation for direct mapped, 4-way set associative, 8-way set associative and 2-way skewed associative cache. All cache types have total 1024 lines present in them (16 byte lines).

src/cache : Contains Cache class definition (which act as base class)

src/directMapped: Contains DirectMapped class definition which is derived class of Cache class

src/fourWayCache: Contains FourWayCache class definition which is derived class of Cache class

src/eightWayCache: Contains EightWayCache class definition which is derived class of Cache class. Supports LRU, RANDOM and SRRIP replacement policy.

src/victimCache: Contains victim cache class definition (8 lines) which can be used with direct mapped

src/skewedTwoWay: Contains SkTwoWay class definition (2-way skewed associative cache) which is derived class of Cache class.
    Based on "A case for two-way skewed-associative caches" (A. Seznec, ISCA 1993).
    - 2 banks with 512 lines per bank.
    - Each bank uses a different index function, so lines that conflict in one bank usually do not conflict in the other:
        bank 0 index = A1 ^ A2
        bank 1 index = A1 ^ bitreverse(A2)
      where A1 = address bits [12:4] and A2 = address bits [21:13]. Tag = address bits [31:13].
    - Replacement: an empty candidate line is used first, otherwise LRU between the two candidate lines.
    - Dirty lines evicted on a miss are counted as write backs.

compileCode.tcl: Compile command for DirectMapped cache

compileCodeFourWay.tcl: Compile command for four way set associative cache

compileEightWay.tcl: Compile command for eight way set associative cache

compileCodeSkCache.tcl: Compile command for 2-way skewed associative cache

test_direct_mapped.cc: This is test code for direct mapped cache.

test_fourWayCache.cc: This is test code for 4-way set associative cache.

test_eightWayCache.cc: This is test code for 8-way set associative cache. It reads addresses from a trace file.

test_sk_cache.cc: This is test code for 2-way skewed associative cache. It uses asserts to check hit/miss counts,
    no false hits, the skewing benefit (3 lines conflicting in bank 0 all stay in the cache) and write back counting.

trace: Contains trace files used as input for the tests.

### How to run the code

1) Compile the code using compileCode* tcl file (Example of directMapped is provided):

    source compileCode.tcl

2) The binary file will be stored in bin directory. Use this command to run the code:

    ./bin/directMapped

    In codebase, there are debug print statement to help us unnderstand what is happening for each request.
    Different test can be tried by including the test file in compile command.

3) Eight way cache accepts command line options:

    source compileEightWay.tcl
    ./bin/eightWayCache --policy SRRIP --trace trace/stress_trace.txt --debug

    --policy, -p : Replacement policy (LRU, RANDOM, SRRIP). Default is LRU.
    --trace, -t  : Trace file path. Default is trace/simple_trace.txt.
    --debug, -d  : Enable debug prints.

4) Two way skewed associative cache (binary is stored in the top level directory):

    source compileCodeSkCache.tcl
    ./skTwoWayCacheExecutable

About

The repository simulates direct-mapped , four way set associative and 8 way set associative cache.

Topics

cachecache-simulatorcomputer-architecturedirect-mapped-cacheset-associative-cachetrace

Resources

Readme
Activity

Stars

1 star

Watchers

1 watching

Forks

1 fork
Report repository

Releases

Packages

Contributors

Languages

You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.