From 8f0ebf761b07eb92cc7bacf86e88f04d0c768f30 Mon Sep 17 00:00:00 2001 From: hadaq Date: Fri, 25 Aug 2006 14:20:14 +0000 Subject: [PATCH] locked working in ibuf, Ingo --- testbench/trb_net_ibuf_testbench.vhd | 6 ++++-- trb_net_ibuf.vhd | 20 ++++++++++++++------ 2 files changed, 18 insertions(+), 8 deletions(-) diff --git a/testbench/trb_net_ibuf_testbench.vhd b/testbench/trb_net_ibuf_testbench.vhd index c07daa6..8cd1f34 100644 --- a/testbench/trb_net_ibuf_testbench.vhd +++ b/testbench/trb_net_ibuf_testbench.vhd @@ -33,7 +33,8 @@ architecture trb_net_ibuf_testbench_arch of trb_net_ibuf_testbench is signal read_f2 : std_logic_vector(3 downto 0) := (others => '0'); signal read_f1 : std_logic_vector(3 downto 0) := (others => '0'); signal stat_buffer : std_logic_vector(31 downto 0) := (others => '0'); - + signal stat_locked : std_logic_vector(15 downto 0) := (others => '0'); + signal waiter : std_logic := '0'; @@ -81,7 +82,8 @@ begin INT_DATA_OUT => int_data_out, INT_READ_IN => int_read_in, CTRL_LOCKED => (others => '0'), - STAT_BUFFER => stat_buffer + STAT_BUFFER => stat_buffer, + STAT_LOCKED => stat_locked ); clk <= not clk after 10ns; diff --git a/trb_net_ibuf.vhd b/trb_net_ibuf.vhd index bc0de5a..1f3a69a 100644 --- a/trb_net_ibuf.vhd +++ b/trb_net_ibuf.vhd @@ -69,7 +69,7 @@ signal filtered_read_out : std_logic; signal got_ack_internal, reg_ack_internal : std_logic; --should be raised for 1 cycle when ack --arrived -signal is_locked, got_locked : std_logic; +signal is_locked, got_locked,release_locked : std_logic; signal got_eob_out, reg_eob_out: std_logic; signal tmp_INT_DATAREADY_OUT: std_logic; signal current_last_header, next_last_header : std_logic_vector(50 downto 0); @@ -183,10 +183,10 @@ INT_DATAREADY_OUT <= tmp_INT_DATAREADY_OUT; -- this process control the read of the internal point from the fifo FILTER_OUT: process (INT_READ_IN, INT_HEADER_IN, fifo_data_out, - current_last_header) + current_last_header, release_locked, is_locked) begin -- process - got_locked <= '0'; + got_locked <= is_locked; fifo_read <= '0'; got_eob_out <= '0'; next_last_header <= current_last_header; @@ -196,7 +196,9 @@ INT_DATAREADY_OUT <= tmp_INT_DATAREADY_OUT; if fifo_data_out(TYPE_POSITION) = TYPE_TRM then got_eob_out <= '1'; fifo_read <= '1'; - + if release_locked = '0' then + got_locked <= '1'; + end if; else -- no TRM, normal read got_eob_out <= '0'; fifo_read <= '1'; @@ -217,7 +219,9 @@ INT_DATAREADY_OUT <= tmp_INT_DATAREADY_OUT; - +release_locked <= CTRL_LOCKED(0); +STAT_LOCKED(0) <= is_locked; +STAT_LOCKED(15 downto 1) <= (others => '0'); reg_locked: process(CLK) begin @@ -227,7 +231,11 @@ reg_locked: process(CLK) reg_eob_out <= '0'; current_last_header <= (others => '0'); elsif CLK_EN = '1' then - is_locked <= got_locked; + if release_locked = '1' then + is_locked <= '0'; + else + is_locked <= got_locked; + end if; reg_eob_out <= got_eob_out; current_last_header <= next_last_header; else -- 2.43.0