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 | Private Member Functions | Private Attributes
InteractiveModeCoherence Class Reference

The InteractiveMode class for coherence protocols. More...

#include <interactive_mode_coherence.h>

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

Public Member Functions

 InteractiveModeCoherence (std::string coherence_protocol_name)
 Construct a new interactive mode cache showcasing a coherence protocol. More...
 
 ~InteractiveModeCoherence ()
 Finalize the interactive mode output.
 
bool evalutateCommand (std::string &cmd)
 Evaluate a command received from the input. More...
 
bool issueBusMsg (bus_msg_e bus_msg)
 Issue a BusRd message to "neighboring caches". More...
 
void printCmdFormatMessage ()
 Write the command format message to stderr.
 
- Public Member Functions inherited from InteractiveMode
 InteractiveMode (std::string p_name)
 Construct a new interactive mode cache. More...
 
virtual ~InteractiveMode ()
 Finalize the interactive mode output.
 
state_e getLineState (uint32_t set_idx, uint32_t way_idx)
 Get the state of a line in the cache. More...
 

Private Member Functions

void receiveEvict (uint32_t cache_id)
 Issue an Evict message to a cache. More...
 
void receivePrRd (uint32_t cache_id)
 Issue a PrWr message to a cache. More...
 
void receivePrWr (uint32_t cache_id)
 Issue a PrRd message to a cache. More...
 
bool receiveBusMsg (bus_msg_e bus_msg, uint32_t cache_id)
 Issue a bus message to "this cache". More...
 
void reset ()
 Revert the system back to the initial state.
 
void printSeparator ()
 Print a horizontal line in the table.
 
void printStats ()
 Print bus events and results of operation.
 

Private Attributes

CoherenceProtocolcoherence_protocol
 Coherence protocol used by this cache.
 
std::vector< bus_eventbus_events
 Vector for holding bus events (including processor read and write). Statistics are individual, rather than cumulative.
 
bus_event command
 The most recent command issued.
 

Additional Inherited Members

- Protected Attributes inherited from InteractiveMode
std::string p_name
 The name of the policy/protocol being run in interactive mode.
 
cache_line lines [N_INTERACTIVE_MODE_LINES]
 The cache lines in interactive mode.
 

Detailed Description

The InteractiveMode class for coherence protocols.

Constructor & Destructor Documentation

◆ InteractiveModeCoherence()

InteractiveModeCoherence::InteractiveModeCoherence ( std::string  coherence_protocol_name)

Construct a new interactive mode cache showcasing a coherence protocol.

Parameters
coherence_protocol_nameThe coherence protocol to use

Member Function Documentation

◆ evalutateCommand()

bool InteractiveModeCoherence::evalutateCommand ( std::string &  cmd)
virtual

Evaluate a command received from the input.

Parameters
cmdThe input command
Returns
True if the command was successful

Implements InteractiveMode.

◆ issueBusMsg()

bool InteractiveModeCoherence::issueBusMsg ( bus_msg_e  bus_msg)
virtual

Issue a BusRd message to "neighboring caches".

Parameters
bus_msgThe specific bus message
Returns
True if the 'COPIES-EXIST' line was asserted

Reimplemented from InteractiveMode.

◆ receiveBusMsg()

bool InteractiveModeCoherence::receiveBusMsg ( bus_msg_e  bus_msg,
uint32_t  cache_id 
)
private

Issue a bus message to "this cache".

Parameters
bus_msgThe specific bus message
cache_idThe cache ID of the recipient
Returns
True if the accessed line was flushed into the bus

◆ receiveEvict()

void InteractiveModeCoherence::receiveEvict ( uint32_t  cache_id)
private

Issue an Evict message to a cache.

Parameters
cache_idThe cache ID of the recipient

◆ receivePrRd()

void InteractiveModeCoherence::receivePrRd ( uint32_t  cache_id)
private

Issue a PrWr message to a cache.

Parameters
cache_idThe cache ID of the recipient

◆ receivePrWr()

void InteractiveModeCoherence::receivePrWr ( uint32_t  cache_id)
private

Issue a PrRd message to a cache.

Parameters
cache_idThe cache ID of the recipient

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