> 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 19:58:48 up 22:56, 2 users, load average: 0.51, 0.62, 0.54
This commit is contained in:
parent
d3d2eaf59e
commit
2d510e0aa3
1 changed files with 5 additions and 2 deletions
|
@ -5,8 +5,10 @@
|
|||
#include <verilated_vcd_c.h>
|
||||
#include "Vexample.h"
|
||||
|
||||
#define MAX_SIM_TIME 100
|
||||
|
||||
int main(int argc, char **argv, char **env) {
|
||||
int round = 100;
|
||||
int sim_time = 0;
|
||||
Verilated::commandArgs(argc, argv);
|
||||
Vexample *top = new Vexample;
|
||||
|
||||
|
@ -14,7 +16,7 @@ int main(int argc, char **argv, char **env) {
|
|||
VerilatedVcdC *m_trace = new VerilatedVcdC;
|
||||
top->trace(m_trace, 5);
|
||||
m_trace->open("waveform.vcd");
|
||||
while (round--) {
|
||||
for (sim_time = 0; sim_time < MAX_SIM_TIME; sim_time++) {
|
||||
int a = rand() & 1;
|
||||
int b = rand() & 1;
|
||||
top->a = a;
|
||||
|
@ -22,6 +24,7 @@ int main(int argc, char **argv, char **env) {
|
|||
top->eval();
|
||||
printf("a = %d, b = %d, f = %d\n", a, b, top->f);
|
||||
assert(top->f == (a ^ b));
|
||||
m_trace->dump(sim_time);
|
||||
}
|
||||
m_trace->close();
|
||||
delete top;
|
||||
|
|
Loading…
Reference in a new issue