CohereSim: A Bus-based Cache Simulator  v3.3
A tool for education in computing - learn about coherence protocols, replacement policies, and SMP vs DSM
Public Member Functions | Data Fields | Protected Attributes | Private Member Functions | Private Attributes
MemorySystem Class Referenceabstract

The MemorySystem class connecting multiple caches and main memory. More...

#include <memory_system.h>

Inheritance diagram for MemorySystem:
Inheritance graph
[legend]
Collaboration diagram for MemorySystem:
Collaboration graph
[legend]

Public Member Functions

 MemorySystem (cache_config &config)
 Construct a new memory system. More...
 
void issuePrRd (addr_t addr, uint32_t cache_id, size_t read_timestamp)
 Issue a PrWr message to a cache. More...
 
void issuePrWr (addr_t addr, uint32_t cache_id, size_t write_timestamp)
 Issue a PrRd message to a cache. More...
 
virtual void issueBusMsg (bus_msg_e bus_msg, addr_t addr, uint32_t cache_id)=0
 Issue a bus message from a cache to all other caches. More...
 
void printStats ()
 Print simulation run statistics in CSV format (headerless)
 

Data Fields

size_t access_timestamp
 The access number of the current memory access.
 
size_t most_recent_sibling
 The most recent timestamp of a cache block across all caches.
 
bool copies_exist
 Flag to indicate if copies of a cache block exist in other caches.
 
bool flushed
 Flag to indicate if a cache flushed one of its lines.
 

Protected Attributes

Cachecaches [MAX_N_CACHES]
 Array of this memory system's caches.
 

Private Member Functions

void verifyTimestamp (addr_t addr, bool write, size_t current_timestamp)
 Check if all valid copies of a cache block have the same timestamp. More...
 

Private Attributes

cache_config config
 Config for this memory system.
 

Detailed Description

The MemorySystem class connecting multiple caches and main memory.

Constructor & Destructor Documentation

◆ MemorySystem()

MemorySystem::MemorySystem ( cache_config config)

Construct a new memory system.

Parameters
configThe configuration of this memory system

Member Function Documentation

◆ issueBusMsg()

virtual void MemorySystem::issueBusMsg ( bus_msg_e  bus_msg,
addr_t  addr,
uint32_t  cache_id 
)
pure virtual

Issue a bus message from a cache to all other caches.

Parameters
bus_msgThe specific bus message
addrThe address accessed
cache_idThe cache ID of the requestor

Implemented in Broadcast.

◆ issuePrRd()

void MemorySystem::issuePrRd ( addr_t  addr,
uint32_t  cache_id,
size_t  read_timestamp 
)

Issue a PrWr message to a cache.

Parameters
addrThe address accessed
cache_idThe cache ID of the recipient
read_timestampThe access number of the current read access

◆ issuePrWr()

void MemorySystem::issuePrWr ( addr_t  addr,
uint32_t  cache_id,
size_t  write_timestamp 
)

Issue a PrRd message to a cache.

Parameters
addrThe address accessed
cache_idThe cache ID of the recipient
write_timestampThe access number of the current write access

◆ verifyTimestamp()

void MemorySystem::verifyTimestamp ( addr_t  addr,
bool  write,
size_t  current_timestamp 
)
private

Check if all valid copies of a cache block have the same timestamp.

Parameters
addrThe memory address in the cache block
writeWhether the current operation is a processor write
current_timestampThe current access number

The documentation for this class was generated from the following files: