URL
https://opencores.org/ocsvn/wbuart32/wbuart32/trunk
[/] [wbuart32/] [trunk/] [bench/] [cpp/] [helloworld.cpp] - Diff between revs 5 and 6
Go to most recent revision |
Show entire file |
Details |
Blame |
View Log
Rev 5 |
Rev 6 |
Line 42... |
Line 42... |
#include <string.h>
|
#include <string.h>
|
#include <time.h>
|
#include <time.h>
|
#include <sys/types.h>
|
#include <sys/types.h>
|
#include <signal.h>
|
#include <signal.h>
|
#include "verilated.h"
|
#include "verilated.h"
|
|
#include "verilated_vcd_c.h"
|
#include "Vhelloworld.h"
|
#include "Vhelloworld.h"
|
#include "uartsim.h"
|
#include "uartsim.h"
|
|
|
int main(int argc, char **argv) {
|
int main(int argc, char **argv) {
|
Verilated::commandArgs(argc, argv);
|
Verilated::commandArgs(argc, argv);
|
Vhelloworld tb;
|
Vhelloworld tb;
|
UARTSIM *uart;
|
UARTSIM *uart;
|
int port = 0;
|
int port = 0;
|
unsigned setup = 25, testcount = 0;
|
unsigned setup = 868, clocks = 0, baudclocks;
|
|
|
tb.i_setup = setup;
|
tb.i_setup = setup;
|
uart = new UARTSIM(port);
|
uart = new UARTSIM(port);
|
uart->setup(tb.i_setup);
|
uart->setup(tb.i_setup);
|
|
baudclocks = tb.i_setup & 0xfffffff;
|
|
|
while(testcount++ < 0x7f000000) {
|
#define VCDTRACE
|
|
#ifdef VCDTRACE
|
|
Verilated::traceEverOn(true);
|
|
VerilatedVcdC* tfp = new VerilatedVcdC;
|
|
tb.trace(tfp, 99);
|
|
tfp->open("helloworld.vcd");
|
|
#define TRACE_POSEDGE tfp->dump(10*clocks)
|
|
#define TRACE_NEGEDGE tfp->dump(10*clocks+5)
|
|
#define TRACE_CLOSE tfp->close()
|
|
#else
|
|
#define TRACE_POSEDGE
|
|
#define TRACE_NEGEDGE
|
|
#define TRACE_CLOSE
|
|
#endif
|
|
|
|
clocks = 0;
|
|
while(clocks < 16*32*baudclocks) {
|
|
|
tb.i_clk = 1;
|
tb.i_clk = 1;
|
tb.eval();
|
tb.eval();
|
|
TRACE_POSEDGE;
|
tb.i_clk = 0;
|
tb.i_clk = 0;
|
tb.eval();
|
tb.eval();
|
|
TRACE_NEGEDGE;
|
|
|
(*uart)(tb.o_uart_tx);
|
(*uart)(tb.o_uart_tx);
|
|
clocks++;
|
}
|
}
|
|
|
|
TRACE_CLOSE;
|
printf("\n\nSimulation complete\n");
|
printf("\n\nSimulation complete\n");
|
}
|
}
|
|
|
No newline at end of file
|
No newline at end of file
|
© copyright 1999-2024
OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.