]> jspc29.x-matter.uni-frankfurt.de Git - trb3sc.git/commitdiff
add reload-on-reset option to trb3sc_tools
authorJan Michel <j.michel@gsi.de>
Tue, 28 Jun 2022 14:53:18 +0000 (16:53 +0200)
committerJan Michel <j.michel@gsi.de>
Tue, 28 Jun 2022 14:53:18 +0000 (16:53 +0200)
code/trb3sc_tools.vhd

index 4c65c92767be49e792b09ed1d6a55811ec69e6c7..e9f228b0f1c981c6420eca483bc301afb5c88dc2 100644 (file)
@@ -9,6 +9,9 @@ library work;
   use work.config.all;
 
 entity trb3sc_tools is
+  generic (
+    HEADER_PAGE_ADDR    : std_logic_vector(15 downto 0) := x"7000"
+    );
   port(
     CLK         : in std_logic;
     RESET       : in std_logic;
@@ -80,6 +83,7 @@ signal flash_cs_s, flash_clk_s, flash_out_s  : std_logic;
 signal debug_rx, debug_tx : std_logic;
 signal debug_status : std_logic_vector(31 downto 0);
 signal additional_reg_i : std_logic_vector(31 downto 0);
+signal control_reg_i    : std_logic_vector(15 downto 0);
 
 begin
 
@@ -92,7 +96,7 @@ begin
       PORT_ADDRESSES   => (0 => x"0000", 1 => x"0400", 2 => x"0480", 3 => x"0500", 4 => x"0600", 
                            5 => x"0180", 6 => x"0f00", 7 => x"0f80", 8 => x"0580", others => x"0000"),
       PORT_ADDR_MASK   => (0 => 9,       1 => 5,       2 => 5,       3 => 2,       4 => 2,       
-                           5 => 4,       6 => 7,       7 => 7,       8 => 0,       others => 0),
+                           5 => 4,       6 => 7,       7 => 7,       8 => 1,       others => 0),
       PORT_MASK_ENABLE => 1
       )
     port map(
@@ -137,6 +141,7 @@ begin
       BUS_TX               => busflash_tx,
       
       DO_REBOOT_IN         => REBOOT_IN,     
+      REBOOT_ON_RESET      => control_reg_i(15),
       PROGRAMN             => PROGRAMN,
       
       SPI_CS_OUT           => flash_cs_i,
@@ -150,6 +155,9 @@ begin
 -- Load Settings from Flash
 ---------------------------------------------------------------------------      
 THE_FLASH_REGS : entity work.load_settings
+  generic map(
+    HEADER_PAGE_ADDR => HEADER_PAGE_ADDR
+    )
   port map(
     CLK        => CLK,
     RST        => RESET,
@@ -388,10 +396,18 @@ proc_add_reg : process begin
   busctrl_tx.unknown <= '0';
   
   if busctrl_rx.read = '1' then
-    busctrl_tx.data(additional_reg_i'left downto 0) <= additional_reg_i;
+    if busctrl_rx.addr(0) = '0' then
+      busctrl_tx.data(additional_reg_i'left downto 0) <= additional_reg_i;
+    else
+      busctrl_tx.data(control_reg_i'left downto 0)    <= control_reg_i;   
+    end if;
     busctrl_tx.ack <= '1';
   elsif busctrl_rx.write = '1' then
-    additional_reg_i <= busctrl_rx.data(additional_reg_i'left downto 0);
+    if busctrl_rx.addr(0) = '0' then
+      additional_reg_i <= busctrl_rx.data(additional_reg_i'left downto 0);
+    else
+      control_reg_i    <= busctrl_rx.data(control_reg_i'left downto 0);
+    end if;
     busctrl_tx.ack <= '1';
   end if;
 end process;