9086/system/testbench.cpp

34 lines
659 B
C++

#include "Vsystem.h"
#include "verilated.h"
#include "stdio.h"
Vsystem *system_state;
void tick() {
system_state->clock = 1;
system_state->eval();
system_state->clock = 0;
system_state->eval();
//printf("tick() %04x\n",system_state->address_bus);
//trace->dump(timestamp);
//timestamp += 500/MHz;
}
int main(int argc, char** argv) {
VerilatedContext* contextp = new VerilatedContext;
contextp->commandArgs(argc, argv);
system_state = new Vsystem{contextp};
system_state->reset=1;
tick();
system_state->reset=0;
tick();
system_state->reset=1;
while(!contextp->gotFinish()){
tick();
}
delete system_state;
delete contextp;
return 0;
}