ysyx-workbench/npc/csrc/main.cpp
tracer-ysyx df992995ca > sim RTL
ysyx_22040000 李心杨
Linux calcite 6.1.65 #1-NixOS SMP PREEMPT_DYNAMIC Sun Dec  3 06:32:13 UTC 2023 x86_64 GNU/Linux
 18:31:48  up  21:29,  2 users,  load average: 1.18, 0.83, 0.63
2023-12-23 18:31:48 +08:00

21 lines
497 B
C++

#include <cstdlib>
#include <cassert>
#include <cstdlib>
#include "Vexample.h"
#include "verilated.h"
int main(int argc, char **argv, char **env) {
Verilated::commandArgs(argc, argv);
Vexample *top = new Vexample;
int round = 100;
while (round--) {
int a = rand() & 1;
int b = rand() & 1;
top->a = a;
top->b = b;
top->eval();
printf("a = %d, b = %d, f = %d\n", a, b, top->f);
assert(top->f == (a ^ b));
}
exit(0);
}