From 8afbb7596a782598044f661d27449300bcfacd65 Mon Sep 17 00:00:00 2001
From: Luke Kenneth Casson Leighton <lkcl@lkcl.net>
Date: Fri, 21 Jan 2022 15:20:04 +0000
Subject: [PATCH] crank up the snapshot window to reasonable (500,000 cycles)
 so that disks do not fill up with 256 mbyte memory-snapshots

---
 verilator/microwatt-verilator.cpp | 2 +-
 verilator/uart-verilator.c        | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/verilator/microwatt-verilator.cpp b/verilator/microwatt-verilator.cpp
index 8f30f0f..45aa336 100644
--- a/verilator/microwatt-verilator.cpp
+++ b/verilator/microwatt-verilator.cpp
@@ -108,7 +108,7 @@ int memdump(vluint64_t time, unsigned char *mem, size_t sz)
 }
 
 // save-trigger offsets
-vluint64_t save_offset = 1000;
+vluint64_t save_offset = 500000;
 vluint64_t save_countdown = save_offset;
 
 // write (masked by sel) to internal mem offset by bram_addr line
diff --git a/verilator/uart-verilator.c b/verilator/uart-verilator.c
index 5f04cee..392bf0c 100644
--- a/verilator/uart-verilator.c
+++ b/verilator/uart-verilator.c
@@ -238,5 +238,5 @@ struct uart_tx_state * uart_get_state(void)
 
 void uart_restore(struct uart_tx_state *new_state)
 {
-    uart = *new_state;
+    memcpy(&uart, new_state, sizeof(struct uart_tx_state));
 }
-- 
2.30.2