From ef044cdfa31cde4d806ceae7828935bf9ed42e7d Mon Sep 17 00:00:00 2001 From: Jan Michel Date: Wed, 8 May 2024 14:31:12 +0200 Subject: [PATCH] change reboot code to prevent race condition between timer and external reset --- special/fpga_reboot.vhd | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/special/fpga_reboot.vhd b/special/fpga_reboot.vhd index ffa7d79..851d9d5 100644 --- a/special/fpga_reboot.vhd +++ b/special/fpga_reboot.vhd @@ -19,13 +19,15 @@ architecture fpga_reboot_arch of fpga_reboot is signal delayed_restart_fpga : std_logic := '0'; signal restart_fpga_counter : unsigned(11 downto 0); - + signal last_reset : std_logic := '0'; begin PROC_REBOOT : process begin wait until rising_edge(CLK); - if RESET = '1' then + last_reset <= RESET; + + if RESET = '0' and last_reset = '1' then delayed_restart_fpga <= REBOOT_ON_RESET; restart_fpga_counter <= x"000"; else @@ -35,7 +37,7 @@ PROC_REBOOT : process restart_fpga_counter <= x"001"; elsif restart_fpga_counter /= x"000" then restart_fpga_counter <= restart_fpga_counter + 1; - if restart_fpga_counter >= x"800" then + if restart_fpga_counter >= x"a00" then PREPARE_FOR_RELOAD <= '1'; end if; if restart_fpga_counter >= x"F00" then -- 2.43.0