]> jspc29.x-matter.uni-frankfurt.de Git - trbnet.git/commitdiff
fix reboot on reset sequence for ECP5
authorJan Michel <michel@physik.uni-frankfurt.de>
Mon, 21 Oct 2024 08:21:22 +0000 (10:21 +0200)
committerJan Michel <michel@physik.uni-frankfurt.de>
Mon, 21 Oct 2024 08:21:22 +0000 (10:21 +0200)
special/fpga_reboot.vhd

index 851d9d5cbd1f061dcaf142dc60542bae875dc181..9f745a380a2c2ce14e44c26988deb1ecc5ee0e19 100644 (file)
@@ -18,22 +18,27 @@ architecture fpga_reboot_arch of fpga_reboot is
 
 
   signal delayed_restart_fpga : std_logic := '0';
-  signal restart_fpga_counter : unsigned(11 downto 0);  
+  signal restart_fpga_counter : unsigned(11 downto 0) := x"000";  
   signal last_reset : std_logic := '0';
+  signal last_delayed_restart_fpga : std_logic;
 begin
 
 PROC_REBOOT : process
   begin
     wait until rising_edge(CLK);
     last_reset <= RESET;
-    
-    if RESET = '0' and last_reset = '1' then
-      delayed_restart_fpga   <= REBOOT_ON_RESET;
-      restart_fpga_counter   <= x"000";
-    else
+    -- last_delayed_restart_fpga <= delayed_restart_fpga;
+    -- if RESET = '0' and last_reset = '1' then
+    --   delayed_restart_fpga   <= REBOOT_ON_RESET;
+    --   if REBOOT_ON_RESET = '1' then
+    --     restart_fpga_counter   <= x"F00";
+    --   else
+    --     restart_fpga_counter   <= x"000";      
+    --   end if;
+    -- else
       delayed_restart_fpga     <= '0';
       PREPARE_FOR_RELOAD       <= '0';
-      if DO_REBOOT = '1' then
+      if DO_REBOOT = '1'  or (RESET = '0' and last_reset = '1' and REBOOT_ON_RESET = '1') then
         restart_fpga_counter   <= x"001";
       elsif restart_fpga_counter /= x"000" then
         restart_fpga_counter   <= restart_fpga_counter + 1;
@@ -44,9 +49,9 @@ PROC_REBOOT : process
           delayed_restart_fpga <= '1';
         end if;
       end if;
-    end if;
+    -- end if;
   end process;    
 
-PROGRAMN                 <= not delayed_restart_fpga;    
+PROGRAMN                 <= not (delayed_restart_fpga);-- or last_delayed_restart_fpga);
     
 end architecture;