2022-07-20 19:41:54 -04:00
|
|
|
#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;
|
2022-07-21 01:53:38 -04:00
|
|
|
sim->rdy = 0;
|
2022-07-20 19:41:54 -04:00
|
|
|
|
|
|
|
progress_n(8);
|
|
|
|
sim->ss = 1;
|
2022-07-21 01:53:38 -04:00
|
|
|
sim->rdy = 1;
|
2022-07-20 19:41:54 -04:00
|
|
|
progress();
|
|
|
|
|
|
|
|
sim->data_ctrl = 0b110011011111001100011111;
|
|
|
|
sim->activate = 1;
|
|
|
|
|
|
|
|
while (!sim->master_finished)
|
|
|
|
progress();
|
|
|
|
progress_n(5);
|
2022-07-21 01:53:38 -04:00
|
|
|
sim->activate = 0;
|
|
|
|
sim->ss = 0;
|
|
|
|
sim->rdy = 0;
|
|
|
|
progress_n(5);
|
|
|
|
|
|
|
|
sim->data_ctrl = 0xFE3456;
|
|
|
|
sim->activate = 1;
|
|
|
|
sim->ss = 1;
|
|
|
|
sim->rdy = 1;
|
|
|
|
while (!sim->master_finished)
|
|
|
|
progress();
|
|
|
|
progress_n(5);
|
|
|
|
sim->activate = 0;
|
2022-07-20 19:41:54 -04:00
|
|
|
sim->ss = 0;
|
2022-07-21 01:53:38 -04:00
|
|
|
sim->rdy = 0;
|
2022-07-20 19:41:54 -04:00
|
|
|
progress_n(5);
|
|
|
|
|
|
|
|
sim->final();
|
|
|
|
delete sim;
|
|
|
|
return 0;
|
|
|
|
}
|