Giter VIP home page Giter VIP logo

vaquierm / mips-processor-simulation Goto Github PK

View Code? Open in Web Editor NEW
1.0 1.0 0.0 7.98 MB

๐Ÿ’พ Improvement to a MIPS processor simulation written in Java. Benchmarks used to track improvements of specific changes

Assembly 2.58% Shell 0.01% Python 0.95% HTML 10.64% JavaScript 2.81% CSS 2.63% Java 43.54% Haskell 0.17% TeX 22.52% Makefile 0.88% Jupyter Notebook 13.26%
mips-assembly mips-architecture mips-simulator pipeline-processor

mips-processor-simulation's Introduction

MIPS-Processor-Simulation

The proposed project is to explore the effects of different cache structures on the read, write and overall average memory access time as well as the total number of stalls in the pipeline due to structural hazards caused by the memory module. The simulator that was modified is EduMIPS64

Repository Structure

The Benchmarks folder is as was provided to us, while the remainder is the actual edumips64 implementation.

All configuration JSON files used for testing can be found in cache_config/configs/ and the resulting JSON files corresponding to these tests can be found in cache_config/results/. The majority of the cache implementation code is located in edumips64/cache/, and the ui adjustments were done in the main class like the other buttons.

The python/ folder contains all the jupyter notebooks used for calculating the results and generating the graphs of the cache behaviour.

Cache Abstraction Class Diagram

Below is the class diagram of the new module that was developed to simulate a cache. TheCacheMan-ageris the most important class were most of the calls from the existing system go through. thesetupmethod can ingest the file path of the JSON configuration file which will create a set ofDirectMapped-CacheLayerandSetAssociativeCacheLayerobjects that represents the configuration. Later on, whenmemory accesses are made, thecalculateLatencymethod is called to calculate how many cycles a parti-cluar access at a specific address takes with the current cache state.The only two concrete classes for Cache layers are theDirectMappedCacheLayerand theSetAssociative-CacheLayerwhich have different internal mechanics for placing and replacing blocks. However both ofthese classes implement theICacheLayerinterface which concists of all methods needed by theCache-Managerto calculate the memory latency for the whole cache structure. The general fields shared amongall types of caches are stored in theCacheLayerabstract class.Lastly, theCacheBlockis the abstraction for a block in the cache. It is contained by theCacheLayerclass so that it can keep track of all the block currently in that layer and the validity of each block.SetAssociativeCacheLayeruses thePriorityCacheBlockto keep track of what to evict next with respectto its eviction policy.

Results found

For each test, a particular parameter of the cache was changed in an isolated way. The results can be seen in the /pyhon folder of the improved repository. The metric that is observed is the average memory access time measured in clock cycles.

How to load a new cache configuration and export statistics

1. Load the configuration file

2. Load the simulation file

3. Run the simulation

F4 for running te whole progream F7 for single step

4. Export statistics

5. Either: Clear the current cache config or load a new config

Format of configuration file

There are certain parameters that are required to load a cache configuration, such as mmat and caches. Caches can be left as an empty list if there are no caches in the specified configuration. However, if there is a cache object then the following parameters that will need to be provided are size, blockSize, accessTime, mappingScheme and writeStrategy. Size and blockSize have to be powers of 2, must have a postfix of B, KB or MB to indicate bytes, kilobytes or megabytes and must have a blockSize smaller or equal to size. AccessTime should preferably for a cache be smaller than the main memory access time. For mappingScheme the options are:

  • DIRECT
  • N_WAY_SET_ASSOCIATIVE_LRU (where N is an integer multiple of 2)
  • N_WAY_SET_ASSOCIATIVE_FIFO
  • N_WAY_SET_ASSOCIATIVE_RANDOM
  • FULLY_ASSOCIATIVE_LRU
  • FULLY_ASSOCIATIVE_RANDOM
  • FULLY_ASSOCIATIVE_FIFO

Lastly for writeStrategy, the available options are:

  • WRITEBACK (which uses a write back write allocate strategy)
  • WRITETHROUGH (which uses a write through no write allocate strategy)

Format of the result files

The result file contains all the information that was already in the configuration file such that the user can see what the configuration that was used for the run. The name of the benchmark file that the test ran on is also included as benchmark_name. Additionally, the average memory access time overall, for read accesses, and for write accesses (amat, amat_read, amat_write} respectively). Finally, The hit rate of each cache layer is present so that the user can identify were the bottleneck is when the average memory access time is higher than expected.

mips-processor-simulation's People

Contributors

samcleland034 avatar tanklesxl avatar vaquierm avatar

Stargazers

 avatar

Watchers

 avatar

mips-processor-simulation's Issues

Write a parser class to read in the configuration JSON file

When the user will configure his cache, the file they selected will go through this parser and create the cache objects to be stored in the Memory class.
This shouldnt do all this extra stuff, just a method that takes in the file path then creates a list of caches based on that.
We should also find a way to return the main memory access time as well.
Remember to throw some exceptions as well. Whoever calls this will have to catch them

Bug in loading json

If you load config, run, export, then load a new config, the new config doesnt get registered properly. I think it might be an issue with needing to reset the Cachemanager before doing setup again, easy fix will do tonight or tomorrow.

Modify UI to show Memory stalls statistic

Just an extra field with all the other stats
Make a way to make it invisible as well. for when we run the ap normally. And it appears when we go in the Real-Cache mode

Change the format of results file

The result file should have more things

{
  "mmat" : 50,
  "totalStalls" : 1365,
  "benchmark" : "<benchmarkFileName>"
  "caches" : [
    {
      "size" : "64B",
      "blockSize" : "8B",
      "accessTime" : 5,
      "mappingScheme" : "4_WAY_SET_ASSOCIATIVE_LRU",
      "writeStrategy" :  "WRITE_BACK",
      "hitRate" = 0.24
    },
    {
      "size" : "128B",
      "blockSize" : "16B",
      "accessTime" : 15,
      "mappingScheme" : "FULLY_ASSOCIATIVE_FIFO",
      "writeStrategy" :  "WRITE_THROUGH",
      "hitRate" = 0.76
    }
  ]
}

This way we keep track of more things for when we feed these files to the python scripts

We could extend the mini class CacheLayerConfig in CacheManager to so that we can add an extra fleid called hitRate. That object can then be serrialized to a JSON with the json jar library.
The benchmark name and main memory access time should also be included in the result file

Make a utility class that can write the stats to a file

Stats should be written to a file when a button is pressed (Just like a button wherever in the screen always enabled).
Format can be CSV with nice labels, or JSON/XML

Also the user should ideally chose where they are writing this file

Make sure that the configuration is somehpw saved here too so we know what the cache setup was for those stats

Make a button to reset cache configs to default

Under the loadJSON button in the Cache config tab makse a button Reset which resets the cache config to 0 latency.

basically just call cachemanager.reset()

Dont forget to disable the busson once the program is started. should only be accessible when we are at the start of the program

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.