This project implements a direct-mapped cache memory using Verilog to demonstrate how cache memory reduces main memory access latency. The design models basic cache behavior including address breakdown, hit/miss detection, and read/write operations, providing a clear understanding of memory hierarchy concepts.
Modern processors operate much faster than main memory, creating a performance gap known as the memory wall. Cache memory bridges this gap by storing frequently accessed data closer to the CPU. A direct-mapped cache offers a simple and fast caching technique where each memory block maps to exactly one cache line.
- Fixed mapping of memory blocks to cache lines
- Address divided into Tag, Index, and Offset fields
- Each cache line stores:
- Data
- Tag
- Valid bit
- Dirty bit
- Cache Hit: Data is returned directly from the cache
- Cache Miss: Data is fetched from main memory and placed into the cache
- Supports Write-Through and Write-Back policies
- Handles both hit and miss scenarios appropriately
- Written in Verilog HDL
- Includes comparator logic for tag matching
- FSM-based control logic manages cache access and memory operations
- Main memory module simulates cache fills and evictions
- Functionality verified using timing diagrams
- Waveform analysis confirms correct behavior for hit, miss, read, and write cases
- Memory hierarchy
- Cache mapping techniques
- Hit and miss handling
- Verilog-based hardware design
- Timing and waveform analysis
- Set-associative cache implementation
- Performance comparison with fully associative cache
- Parameterized cache size and block size