generated from kivikakk/chryse-template
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathTestbench.cc
52 lines (40 loc) · 1.23 KB
/
Testbench.cc
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
#include <cxxrtl/cxxrtl.h>
#include "Testbench.h"
Testbench::Testbench() {
assert(_inst == nullptr);
_inst = this;
}
Testbench::~Testbench() { _inst = nullptr; }
Testbench &Testbench::inst() { return *_inst; }
void Testbench::reset() { p_io__ubtn.set(false); }
bool Testbench::eval(performer *performer) {
int ix = -1;
if (p_io__ds__0)
ix = 0;
if (p_io__ds__1)
ix = 1;
if (p_io__ds__2)
ix = 2;
if (p_io__ds__3)
ix = 3;
if (ix != -1) {
_segacts[ix * 7 + 0] = !p_io__abcdefgp__0;
_segacts[ix * 7 + 1] = !p_io__abcdefgp__1;
_segacts[ix * 7 + 2] = !p_io__abcdefgp__2;
_segacts[ix * 7 + 3] = !p_io__abcdefgp__3;
_segacts[ix * 7 + 4] = !p_io__abcdefgp__4;
_segacts[ix * 7 + 5] = !p_io__abcdefgp__5;
_segacts[ix * 7 + 6] = !p_io__abcdefgp__6;
}
return true;
}
void Testbench::segacts(segment_t out[4 * 7]) const {
memcpy(out, _segacts, sizeof(_segacts));
}
Testbench *Testbench::_inst = nullptr;
std::unique_ptr<cxxrtl_design::bb_p_CXXRTLTestbench>
cxxrtl_design::bb_p_CXXRTLTestbench::create(std::string name,
metadata_map parameters,
metadata_map attributes) {
return std::make_unique<Testbench>();
}