port (
CLOCK_IN : in std_logic; -- oscillator
RESET_FROM_NET : in std_logic;
+ SEND_RESET_IN : in std_logic := '0';
BUS_RX : in CTRLBUS_RX;
BUS_TX : out CTRLBUS_TX;
signal clear_n_i : std_logic := '0';
signal reset_i, reset_rising, last_reset_i : std_logic;
signal debug_reset_handler : std_logic_vector(15 downto 0);
-
+signal send_reset_detect, trb_reset_i : std_logic := '0';
signal pll_lock : std_logic;
attribute syn_keep of clear_n_i : signal is true;
end generate;
-clear_n_i <= timer(24) when rising_edge(clock_200_raw);
+clear_n_i <= timer(22) when rising_edge(clock_200_raw);
process begin
wait until rising_edge(sys_clk_i);
- if timer(24) = '1' then
+ if timer(22) = '1' then
timer <= timer;
elsif reset_rising = '1' then
- timer <= 0;
+ timer <= (others => '0');
elsif pll_lock = '1' then
timer <= timer + 1;
end if;
SYSCLK_IN => sys_clk_i, -- PLL/DLL remastered clock
PLL_LOCKED_IN => pll_lock, -- master PLL lock signal (async)
RESET_IN => '0', -- general reset signal (SYSCLK)
- TRB_RESET_IN => RESET_FROM_NET, -- TRBnet reset signal (SYSCLK)
+ TRB_RESET_IN => trb_reset_i, -- TRBnet reset signal (SYSCLK)
CLEAR_OUT => CLEAR_OUT, -- async reset out, USE WITH CARE!
RESET_OUT => reset_i, -- synchronous reset out (SYSCLK)
DEBUG_OUT => debug_reset_handler
);
RESET_OUT <= reset_i;
-
+send_reset_detect <= SEND_RESET_IN when rising_edge(clock_200_raw);
+trb_reset_i <= RESET_FROM_NET or (send_reset_detect and not SEND_RESET_IN);
+
last_reset_i <= reset_i when rising_edge(clock_200_raw);
reset_rising <= reset_i and not last_reset_i;
status_i(9) <= sed_error_q;
status_i(10) <= sed_edge;
status_i(15 downto 11) <= (others => '0');
-status_i(23 downto 16) <= std_logic_vector(run_counter)(7 downto 0);
-status_i(31 downto 24) <= std_logic_vector(error_counter)(7 downto 0);
+status_i(23 downto 16) <= std_logic_vector(run_counter);
+status_i(31 downto 24) <= std_logic_vector(error_counter);
ERROR_OUT <= sed_error;
DEBUG <= status_i when rising_edge(CLK);