-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathprocessor_impl.hpp
38 lines (29 loc) · 908 Bytes
/
processor_impl.hpp
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
#pragma once
#include "bus.hpp"
#include "cache.hpp"
#include "processor.hpp"
#include "protocol.hpp"
#include "request.hpp"
#include <memory>
#include <vector>
using namespace std;
enum ProcessorState { FREE, LOAD, STORE, NON_MEMORY, MEM_ACCESS };
class ProcessorImpl : public Processor {
private:
shared_ptr<Protocol> protocol;
shared_ptr<Cache> l1Data;
shared_ptr<Bus> bus;
ProcessorState state = FREE;
shared_ptr<Request> currRequest = nullptr;
unsigned int cycles = 0;
unsigned int memCounter = 0;
unsigned int nonMemCounter = 0;
bool done = false;
void execute(unsigned int type, unsigned int value);
public:
ProcessorImpl(unsigned int cacheSize, unsigned int associativity, unsigned int blockSize,
shared_ptr<Bus> bus, shared_ptr<Protocol> protocol);
void executeCycle();
void invalidateCache();
bool isDone();
};