blob: bbbf03c2a04153e008ce145470156760918724c9 (
plain) (
blame)
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
|
#include <stdio.h>
#include <verilated.h>
#include "Vtest_spi_write_read_mode0.h"
using TopModule = Vtest_spi_write_read_mode0;
VerilatedContext *ctx;
TopModule *sim;
static void progress() {
sim->eval();
ctx->timeInc(1);
sim->clk = !sim->clk;
}
static void progress_n(int f) {
for (int i = 0; i < f; i++)
progress();
}
int main(int argc, char **argv) {
ctx = new VerilatedContext;
ctx->traceEverOn(true);
ctx->commandArgs(argc, argv);
sim = new TopModule(ctx);
sim->ss = 0;
sim->clk = 0;
sim->activate = 0;
progress_n(8);
sim->ss = 1;
progress();
sim->data_ctrl = 0b110011011111001100011111;
sim->activate = 1;
while (!sim->master_finished)
progress();
progress_n(5);
sim->ss = 0;
progress_n(5);
sim->final();
delete sim;
return 0;
}
|