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