-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsnoop.h
65 lines (54 loc) · 1.2 KB
/
snoop.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
// _SNOOP_H_
#ifndef _SNOOP_H_
#define _SNOOP_H_
#include <string>
#include <iostream>
#include <stdio.h>
#include <stdlib.h>
#include <assert.h>
#include <time.h>
#include <queue>
#include <vector>
#include <tuple>
#include <utility>
#include <algorithm>
#include "cache.h"
#include "protocol.h"
#include "memops.h"
#include "snoop_config.h"
#define READ 1
#define WRITE 2
#define RESPONSE 3
#define WRITEBACK 4
#define MEM -1
using namespace std;
class Snoop {
public:
Snoop();
~Snoop();
void Run();
private:
class BusObj
{
public:
BusObj(int op, int wait_cycles, int src, int dest, long address,
bool exclusive_response);
int op;
int wait_cycles;
int src;
int dest;
long address;
bool exclusive_response;
};
queue<BusObj> bus;
queue<int> req_buffer;
vector<MemOps*> processor_ops;
vector<Cache_Base*> caches;
vector<bool> pending;
Protocol* ptc;
vector<int> random_selector;
void resume(int id, BusObj & bus_obj, bool exclusive);
void access_writeback_updatestate(int id, long address, int src,
bool exclusive = false);
};
#endif // _SNOOP_H_