-
Notifications
You must be signed in to change notification settings - Fork 3
/
Sim_MuxLookup_Test.cpp
53 lines (42 loc) · 1.05 KB
/
Sim_MuxLookup_Test.cpp
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
#include <verilated.h>
#include <verilated_vcd_c.h>
#include "VMuxLookup_Test.h"
using namespace std;
VMuxLookup_Test *top;
VerilatedVcdC *tfp;
vluint64_t main_time = 0;
const vluint64_t sim_time = 1024;
int main(int argc, char **argv)
{
Verilated::commandArgs(argc, argv);
Verilated::traceEverOn(true);
top = new VMuxLookup_Test;
tfp = new VerilatedVcdC;
top->trace(tfp, 99);
tfp->open("./MuxLookup_Test.vcd");
while(!Verilated::gotFinish() && main_time < sim_time)
{
// Clock
if (main_time % 2)
top->clock = 1;
else
top->clock = 0;
top->io_pc_recover = 1000;
top->io_new_addr = 2000;
// PC_Sel test
if (main_time >= 5 && main_time <= 6)
top->io_PC_Sel = 0;
else if(main_time >= 9 && main_time <= 10)
top->io_PC_Sel = 2;
else
top->io_PC_Sel = 0;
top->eval();
tfp->dump(main_time);
main_time++;
}
tfp->close();
delete top;
delete tfp;
exit(0);
return 0;
}