Skip to content

Commit

Permalink
Updated application_fpga_verilator.cc to match module application_fpg…
Browse files Browse the repository at this point in the history
…a_sim.

Also include printout of used clock and baud rate speed.
  • Loading branch information
jthornblad committed Nov 25, 2024
1 parent 668d922 commit c833172
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions hw/application_fpga/tb/application_fpga_verilator.cc
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,15 @@
#include <signal.h>
#include <sys/types.h>

#include "Vapplication_fpga.h"
#include "Vapplication_fpga_sim.h"
#include "verilated.h"

// Clock: 18 MHz, 62500 bps
// Divisor = 18E6 / 62500 = 288
#define BIT_DIV 288
#define CPU_CLOCK 18000000
#define BAUD_RATE 62500
#define BIT_DIV (CPU_CLOCK/BAUD_RATE)


struct uart {
int bit_div;
Expand Down Expand Up @@ -294,13 +297,15 @@ int main(int argc, char **argv, char **env)
{
Verilated::commandArgs(argc, argv);
int r = 0, g = 0, b = 0;
Vapplication_fpga top;
Vapplication_fpga_sim top;
struct uart u;
struct pty p;
int err;

if (signal(SIGUSR1, sighandler) == SIG_ERR)
return -1;
printf("cpu clock: %d\n", CPU_CLOCK);
printf("baud rate: %d\n", BAUD_RATE);
printf("generate touch event: \"$ kill -USR1 %d\"\n", (int)getpid());

err = pty_init(&p);
Expand Down

0 comments on commit c833172

Please sign in to comment.