blob: 9bc71f6e1a41e5be1f2922fedfd14cd1eed67d23 (
plain)
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
|
#include "controller.h"
#include "cache.h"
#include "dram.h"
#include "ex.h"
#include "id.h"
#include "if.h"
#include "mm.h"
#include "wb.h"
#include <algorithm>
#include <catch2/catch_test_macros.hpp>
#include <vector>
class ControllerPipeFixture
{
public:
ControllerPipeFixture()
{
this->d = new Dram(1);
this->c = new Cache(this->d, 5, 0, 0);
IF *f = new IF(nullptr);
ID *d = new ID(f);
EX *e = new EX(d);
MM *m = new MM(e);
WB *w = new WB(m);
this->stage_num = 5;
this->ct = new Controller(w, this->c, true);
}
~ControllerPipeFixture()
{
delete this->ct;
delete this->c;
};
void fill_pipe()
{
InstrDTO *i = nullptr;
int j;
for (j = 0; j < this->stage_num + 1; ++j) {
i = this->ct->advance(READY);
REQUIRE(i == nullptr);
}
}
int stage_num;
Cache *c;
Dram *d;
Controller *ct;
};
|