-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathAdderTestBench.hpp
45 lines (35 loc) · 1.13 KB
/
AdderTestBench.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
39
40
41
42
43
44
45
/**
* @file AdderTestBench.hpp.h
* @author ottojo
* @date 3/27/21
* Description here TODO
*/
#ifndef SYSTEMCKLAUSUR_ADDERTESTBENCH_HPP
#define SYSTEMCKLAUSUR_ADDERTESTBENCH_HPP
#include <systemc.h>
class AdderTestBench : sc_module {
public:
sc_out<int> num1;
sc_out<int> num2;
sc_in<int> res;
void compute() {
num1 = 0;
num2 = 0;
std::cout << "At time " << sc_time_stamp() << ": initializing " << std::endl;
for (int a = -500; a < 500; a++) {
for (int b = -500; b < 500; b++) {
std::cout << "At time " << sc_time_stamp() << ": testing " << a << "+" << b << std::endl;
num1 = a;
num2 = b;
wait(1, SC_PS);
std::cout << "Result: " << res << std::endl;
assert(res == a + b);
}
}
}
SC_HAS_PROCESS(AdderTestBench);
explicit AdderTestBench(const sc_module_name &name) : sc_module(name) {
SC_THREAD(compute);
}
};
#endif //SYSTEMCKLAUSUR_ADDERTESTBENCH_HPP