CohereSim: A Bus-based Cache Simulator  v3.3
A tool for education in computing - learn about coherence protocols, replacement policies, and SMP vs DSM
Data Structures | Macros
coherence_protocol.h File Reference

Definition of the coherence protocol base class. More...

#include "cache_abc.h"
Include dependency graph for coherence_protocol.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

class  CoherenceProtocol
 The base class for coherence protocols. More...
 

Macros

#define STATE_ERR   std::cerr << __FILE__ << ':' << __FUNCTION__ << ": Cache line in invalid state: " << (int)(line->state) << std::endl
 Error message printed when a cache line is in a state not supported by the coherence protocol.
 
#define UNIMPLEMENTED   std::cerr << "Call of unimplemented bus message: " << __FUNCTION__ << std::endl; return false
 Error message printed when a cache issues a bus message not supported by the coherence protocol.
 
#define ADD_COHERENCE_TO_CMD_LINE(coh_prot)
 Create a mapping in 'coherence_map' from a string containing the class name to a factory method for the class. More...
 

Detailed Description

Definition of the coherence protocol base class.

Macro Definition Documentation

◆ ADD_COHERENCE_TO_CMD_LINE

#define ADD_COHERENCE_TO_CMD_LINE (   coh_prot)
Value:
static int register_coherence = []() { \
if (coherence_map == nullptr) coherence_map = new std::map<std::string, coh_factory_t, ci_less>(); \
(*coherence_map)[#coh_prot] = [](CacheABC& cache) { return new coh_prot(cache); }; return 0; }()
std::map< std::string, coh_factory_t, ci_less > * coherence_map
A map from coherence protocol names to their factory functions.
Definition: main.cc:19
Comparator functor for strings, case insensitive.
Definition: typedefs.h:182
std::function< CoherenceProtocol *(CacheABC &)> coh_factory_t
Coherence protocol factory function signature.
Definition: typedefs.h:201

Create a mapping in 'coherence_map' from a string containing the class name to a factory method for the class.

Parameters
coh_protThe coherence protocol type