blob: 1530f87bfc972bbb308a7fed5e6e91a8912e18e3 (
plain)
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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
|
#include <cmath>
#include <cstddef>
#include <cstdio>
#include <cstdlib>
#include <iostream>
#include <string>
#include <strings.h>
#include <SDL2/SDL.h>
#include <verilated.h>
#if VM_TRACE
#include <verilated_fst_c.h>
#endif
#include "Vtop.h"
#include "remote_bitbang.h"
int main(int argc, char **argv)
{
Verilated::commandArgs(argc, argv);
Vtop top;
#if VM_TRACE
Verilated::traceEverOn(true);
VerilatedFstC trace;
top.trace(&trace, 0);
trace.open("dump.fst");
#endif
int time = 0;
auto cycle = [&]()
{
top.eval();
#if VM_TRACE
trace.dump(time++);
#endif
top.clk = 1;
top.eval();
#if VM_TRACE
trace.dump(time++);
#endif
top.clk = 0;
};
top.clk = 0;
top.rst_n = 0;
top.jtag_tck = 0;
top.jtag_tms = 0;
top.jtag_tdi = 0;
cycle();
top.rst_n = 1;
cycle();
rbs_init(1234);
do {
cycle();
unsigned char tck = top.jtag_tck;
unsigned char tms = top.jtag_tms;
unsigned char tdi = top.jtag_tdi;
unsigned char trstn = 1;
rbs_tick(&tck, &tms, &tdi, &trstn, top.jtag_tdo);
top.jtag_tck = tck;
top.jtag_tms = tms;
top.jtag_tdi = tdi;
} while (!(client_fd < 0));
#if VM_TRACE
trace.close();
#endif
top.final();
return EXIT_SUCCESS;
}
|