64 lines
1003 B
C++
64 lines
1003 B
C++
#include <stdio.h>
|
|
#include <verilated.h>
|
|
|
|
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;
|
|
sim->rdy = 0;
|
|
|
|
progress_n(8);
|
|
sim->ss = 1;
|
|
sim->rdy = 1;
|
|
progress();
|
|
|
|
#ifndef READ_ONLY
|
|
sim->data_ctrl = 0b110011011111001100011111;
|
|
#endif
|
|
sim->activate = 1;
|
|
|
|
while (!sim->master_finished)
|
|
progress();
|
|
progress_n(5);
|
|
sim->activate = 0;
|
|
sim->ss = 0;
|
|
sim->rdy = 0;
|
|
progress_n(5);
|
|
|
|
#ifndef READ_ONLY
|
|
sim->data_ctrl = 0xFE3456;
|
|
sim->activate = 1;
|
|
sim->ss = 1;
|
|
sim->rdy = 1;
|
|
while (!sim->master_finished)
|
|
progress();
|
|
progress_n(5);
|
|
sim->activate = 0;
|
|
sim->ss = 0;
|
|
sim->rdy = 0;
|
|
progress_n(5);
|
|
#endif
|
|
|
|
sim->final();
|
|
delete sim;
|
|
return 0;
|
|
}
|