-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathverify.cpp
More file actions
54 lines (46 loc) · 978 Bytes
/
verify.cpp
File metadata and controls
54 lines (46 loc) · 978 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
49
50
51
52
53
54
#include <cstdlib>
#include <utility>
#include "cpu_testbench.h"
#define CYCLES 10000
TEST_F(CpuTestbench, TestAddiBne)
{
setupTest("1_addi_bne");
initSimulation();
runSimulation(CYCLES);
EXPECT_EQ(top_->a0, 254);
}
TEST_F(CpuTestbench, TestLiAdd)
{
setupTest("2_li_add");
initSimulation();
runSimulation(CYCLES);
EXPECT_EQ(top_->a0, 1000);
}
TEST_F(CpuTestbench, TestLbuSb)
{
setupTest("3_lbu_sb");
initSimulation();
runSimulation(CYCLES);
EXPECT_EQ(top_->a0, 300);
}
TEST_F(CpuTestbench, TestJalRet)
{
setupTest("4_jal_ret");
initSimulation();
runSimulation(CYCLES);
EXPECT_EQ(top_->a0, 53);
}
TEST_F(CpuTestbench, TestPdf)
{
setupTest("5_pdf");
setData("reference/gaussian.mem");
initSimulation();
runSimulation(CYCLES * 100);
EXPECT_EQ(top_->a0, 15363);
}
int main(int argc, char **argv)
{
testing::InitGoogleTest(&argc, argv);
auto res = RUN_ALL_TESTS();
return res;
}