CohereSim: A Bus-based Cache Simulator  v3.3
A tool for education in computing - learn about coherence protocols, replacement policies, and SMP vs DSM
interactive_mode.h
Go to the documentation of this file.
1 
4 #pragma once
5 
6 #include "cache_abc.h"
7 
9 class InteractiveMode : public CacheABC {
10 public:
11 
14  InteractiveMode(std::string p_name) : p_name(p_name) {}
16  virtual ~InteractiveMode() {}
17 
21  virtual bool evalutateCommand(std::string& cmd) = 0;
22 
26  virtual bool issueBusMsg(bus_msg_e bus_msg) { return false; }
27 
32  state_e getLineState(uint32_t set_idx, uint32_t way_idx) { return lines[way_idx].state; }
33 
35  virtual void printCmdFormatMessage() = 0;
36 
37 protected:
38 
40  std::string p_name;
41 
44 
45 private:
46 
48  virtual void reset() = 0;
49 
51  virtual void printSeparator() = 0;
53  virtual void printStats() = 0;
54 };
Declaration of the cache interface class.
The cache interface.
Definition: cache_abc.h:9
The InteractiveMode abstract base class.
Definition: interactive_mode.h:9
virtual void printSeparator()=0
Print a horizontal line in the table.
virtual ~InteractiveMode()
Finalize the interactive mode output.
Definition: interactive_mode.h:16
state_e getLineState(uint32_t set_idx, uint32_t way_idx)
Get the state of a line in the cache.
Definition: interactive_mode.h:32
cache_line lines[N_INTERACTIVE_MODE_LINES]
The cache lines in interactive mode.
Definition: interactive_mode.h:43
std::string p_name
The name of the policy/protocol being run in interactive mode.
Definition: interactive_mode.h:40
virtual bool evalutateCommand(std::string &cmd)=0
Evaluate a command received from the input.
virtual void reset()=0
Revert the system back to the initial state.
virtual void printStats()=0
Print results after each operation to the table.
virtual bool issueBusMsg(bus_msg_e bus_msg)
Issue a BusRd message to neighboring caches.
Definition: interactive_mode.h:26
InteractiveMode(std::string p_name)
Construct a new interactive mode cache.
Definition: interactive_mode.h:14
virtual void printCmdFormatMessage()=0
Write the command format message to stderr.
Cache line fields (without data field)
Definition: typedefs.h:152
state_e state
State the line is in.
Definition: typedefs.h:156
#define N_INTERACTIVE_MODE_LINES
The number of cache lines that interactive mode uses.
Definition: typedefs.h:15
state_e
Cache line state.
Definition: typedefs.h:64
bus_msg_e
Bus message IDs.
Definition: typedefs.h:92