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
InteractiveModeReplacer Class Reference

The InteractiveMode class for replacement policies. More...

#include <interactive_mode_replacer.h>

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

Public Member Functions

 InteractiveModeReplacer (std::string replacement_policy_name)
 Construct a new interactive mode cache showcasing a replacement policy. More...
 
 ~InteractiveModeReplacer ()
 Finalize the interactive mode output.
 
bool evalutateCommand (std::string &cmd)
 Evaluate a command received from the input. 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.
 
virtual bool issueBusMsg (bus_msg_e bus_msg)
 Issue a BusRd message to neighboring caches. More...
 
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 receiveAccess (tag_t tag)
 Issue an access to a cache block. More...
 
void reset ()
 Revert the system back to the initial state.
 
void printSeparator ()
 Print a horizontal line in the table.
 
void printStats ()
 Print simulation run statistics in CSV format (headerless)
 

Private Attributes

ReplacementPolicyreplacement_policy
 Coherence protocol used by this cache.
 
char accessee
 The most recent command issued.
 
char victim
 The most recent victim.
 

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 replacement policies.

Constructor & Destructor Documentation

◆ InteractiveModeReplacer()

InteractiveModeReplacer::InteractiveModeReplacer ( std::string  replacement_policy_name)

Construct a new interactive mode cache showcasing a replacement policy.

Parameters
replacement_policy_nameThe replacement policy to use

Member Function Documentation

◆ evalutateCommand()

bool InteractiveModeReplacer::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.

◆ receiveAccess()

void InteractiveModeReplacer::receiveAccess ( tag_t  tag)
private

Issue an access to a cache block.

Parameters
tagThe tag of the block

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