-
Notifications
You must be signed in to change notification settings - Fork 17
Expand file tree
/
Copy pathverify.cpp
More file actions
48 lines (42 loc) · 910 Bytes
/
verify.cpp
File metadata and controls
48 lines (42 loc) · 910 Bytes
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 "testbench.h"
#include <cstdlib>
class CpuTestbench : public Testbench
{
protected:
void initializeInputs() override
{
top->clk = 1;
top->rst = 0;
}
};
TEST_F(CpuTestbench, BaseProgramTest)
{
system("./compile.sh asm/program.S");
for (int i = 0; i < 1000; i++)
{
runSimulation(1);
if (top->a0 == 254)
{
SUCCEED();
}
}
FAIL() << "Counter did not reach 254";
}
// Note this is how we are going to test your CPU. Do not worry about this for
// now, as it requires a lot more instructions to function
/**
*
TEST_F(CpuTestbench, Return5Test)
{
system("./compile.sh c/return_5.c");
runSimulation(100);
EXPECT_EQ(top->a0, 5);
}
*/
int main(int argc, char **argv)
{
Verilated::commandArgs(argc, argv);
testing::InitGoogleTest(&argc, argv);
auto res = RUN_ALL_TESTS();
return res;
}