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_coherence.h
Go to the documentation of this file.
1 
4 #pragma once
5 
6 #include <vector>
7 
8 #include "interactive_mode.h"
9 
11 struct bus_event {
13  uint32_t event;
15  uint32_t issuer;
16 
20  bus_event(bus_msg_e bmsg, uint32_t issuer);
24  bus_event(statistic_e stat, uint32_t issuer);
25 };
26 
29 public:
30 
33  InteractiveModeCoherence(std::string coherence_protocol_name);
36 
40  bool evalutateCommand(std::string& cmd);
41 
45  bool issueBusMsg(bus_msg_e bus_msg);
46 
48  void printCmdFormatMessage();
49 
50 private:
51 
54 
57  std::vector<bus_event> bus_events;
58 
61 
64  void receiveEvict(uint32_t cache_id);
67  void receivePrRd(uint32_t cache_id);
70  void receivePrWr(uint32_t cache_id);
71 
76  bool receiveBusMsg(bus_msg_e bus_msg, uint32_t cache_id);
77 
79  void reset();
80 
82  void printSeparator();
84  void printStats();
85 };
The base class for coherence protocols.
Definition: coherence_protocol.h:14
The InteractiveMode class for coherence protocols.
Definition: interactive_mode_coherence.h:28
bus_event command
The most recent command issued.
Definition: interactive_mode_coherence.h:60
InteractiveModeCoherence(std::string coherence_protocol_name)
Construct a new interactive mode cache showcasing a coherence protocol.
Definition: interactive_mode_coherence.cc:35
CoherenceProtocol * coherence_protocol
Coherence protocol used by this cache.
Definition: interactive_mode_coherence.h:53
std::vector< bus_event > bus_events
Vector for holding bus events (including processor read and write). Statistics are individual,...
Definition: interactive_mode_coherence.h:57
void printStats()
Print bus events and results of operation.
Definition: interactive_mode_coherence.cc:250
void reset()
Revert the system back to the initial state.
Definition: interactive_mode_coherence.cc:213
bool issueBusMsg(bus_msg_e bus_msg)
Issue a BusRd message to "neighboring caches".
Definition: interactive_mode_coherence.cc:91
void printSeparator()
Print a horizontal line in the table.
Definition: interactive_mode_coherence.cc:231
bool evalutateCommand(std::string &cmd)
Evaluate a command received from the input.
Definition: interactive_mode_coherence.cc:60
void receivePrWr(uint32_t cache_id)
Issue a PrRd message to a cache.
Definition: interactive_mode_coherence.cc:190
void receivePrRd(uint32_t cache_id)
Issue a PrWr message to a cache.
Definition: interactive_mode_coherence.cc:170
void printCmdFormatMessage()
Write the command format message to stderr.
Definition: interactive_mode_coherence.cc:146
bool receiveBusMsg(bus_msg_e bus_msg, uint32_t cache_id)
Issue a bus message to "this cache".
Definition: interactive_mode_coherence.cc:122
void receiveEvict(uint32_t cache_id)
Issue an Evict message to a cache.
Definition: interactive_mode_coherence.cc:150
~InteractiveModeCoherence()
Finalize the interactive mode output.
Definition: interactive_mode_coherence.cc:54
The InteractiveMode abstract base class.
Definition: interactive_mode.h:9
Declaration of the InteractiveMode base class.
The BusEvent class.
Definition: interactive_mode_coherence.h:11
uint32_t issuer
The id of the resonsible cache.
Definition: interactive_mode_coherence.h:15
bus_event(bus_msg_e bmsg, uint32_t issuer)
Create a new bus event.
Definition: interactive_mode_coherence.cc:32
uint32_t event
The bus event that occurred.
Definition: interactive_mode_coherence.h:13
statistic_e
Cache runtime statistic IDs.
Definition: typedefs.h:115
bus_msg_e
Bus message IDs.
Definition: typedefs.h:92