Skip to content

sriraj0926/Direct-mapping-cache-optimization-in-C-

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 

Repository files navigation

Cache Simulator

This repository contains a simple cache simulator implemented in C. The simulator consists of a memory subsystem with cache and memory modules. The cache is designed as a direct-mapped cache with a write-allocate policy.

Features

  • Cache Simulation: Simulates a direct-mapped cache with read and write operations.
  • Memory Module: Emulates a memory subsystem with random data generation.
  • Cache Miss and Hit Handling: Demonstrates cache hit and miss scenarios and performs appropriate actions.

Implementation Details

  • The cache is implemented with a fixed size and block size defined by constants.
  • Memory is represented as a 2D array.
  • Cache lines are implemented as structs containing validity, tag, and data fields.
  • Cache is initialized and managed in memory-efficient ways.

Usage

To run the cache simulator:

  1. Clone the repository:

    git clone https://github.com/yourusername/cachesimulator.git
  2. Navigate to the cloned directory:

    cd cachesimulator
  3. Compile the source code:

    gcc -o cache cache.c
  4. Run the executable:

    ./cache

Contributions

Contributions are welcome! If you find any issues or have suggestions for improvements, feel free to open an issue or create a pull request.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published