-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathAdder_Sim.cpp
More file actions
43 lines (36 loc) · 861 Bytes
/
Copy pathAdder_Sim.cpp
File metadata and controls
43 lines (36 loc) · 861 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
#include <verilated.h>
#include <verilated_vcd_c.h>
#include <iostream>
#include "VAdder.h"
using namespace std;
VAdder* 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 VAdder;
tfp = new VerilatedVcdC;
top->trace(tfp, 99);
tfp->open("Adder.vcd");
while(!Verilated::gotFinish() && main_time < sim_time)
{
top->reset = 0;
if (main_time >= 5 && main_time <= 6)
top->io_a = 0;
else if(main_time >= 9 && main_time <= 10)
top->io_a = 2;
else
top->io_a = 0;
top->eval();
tfp->dump(main_time);
main_time++;
}
tfp->close();
delete top;
delete tfp;
exit(0);
return 0;
}