From: hadeshyp Date: Thu, 28 Jan 2010 09:25:13 +0000 (+0000) Subject: *** empty log message *** X-Git-Tag: oldGBE~348 X-Git-Url: https://jspc29.x-matter.uni-frankfurt.de/git/?a=commitdiff_plain;h=bf431dfb95072927b53b201740bb7b197ed5efce;p=trbnet.git *** empty log message *** --- diff --git a/trb_net16_hub_base.vhd b/trb_net16_hub_base.vhd index 06d0ff5..2aa4c29 100644 --- a/trb_net16_hub_base.vhd +++ b/trb_net16_hub_base.vhd @@ -200,7 +200,7 @@ architecture trb_net16_hub_base_arch of trb_net16_hub_base is signal HUB_ADDRESS : std_logic_vector (15 downto 0); signal HUBLOGIC_IPU_STAT_DEBUG : std_logic_vector (31 downto 0); signal HUB_ERROR_BITS : std_logic_vector (16*4*32-1 downto 0); - signal buf_HUB_ERROR_BITS : std_logic_vector ((16*2**(c_MUX_WIDTH-1))*32-1 downto 0); + signal buf_HUB_ALL_ERROR_BITS : std_logic_vector ((16*2**(c_MUX_WIDTH-1))*32-1 downto 0); signal IOBUF_STAT_GEN : std_logic_vector ((MII_NUMBER*2**(c_MUX_WIDTH-1))*32-1 downto 0); signal IOBUF_IBUF_BUFFER : std_logic_vector ((MII_NUMBER*2**(c_MUX_WIDTH-1))*32-1 downto 0); @@ -736,7 +736,7 @@ MED_DATA_OUT <= buf_MED_DATA_OUT; STAT_POINTS_locked => buf_STAT_POINTS_locked((i+1)*32-1 downto i*32), STAT_TIMEOUT => STAT_TIMEOUT((i+1)*32-1 downto i*32), STAT_ERRORBITS => HUB_STAT_ERRORBITS((i+1)*32-1 downto i*32), - STAT_ALL_ERRORBITS => buf_HUB_ERROR_BITS((i+1)*32*16-1 downto i*32*16), + STAT_ALL_ERRORBITS => buf_HUB_ALL_ERROR_BITS((i+1)*32*16-1 downto i*32*16), CTRL_TIMEOUT_TIME => HUB_CTRL_TIMEOUT_TIME(i*4+3 downto i*4), CTRL_activepoints => HUB_CTRL_final_activepoints((i+1)*32-1 downto i*32), CTRL_TIMER_TICK(0) => timer_us_tick, @@ -775,7 +775,7 @@ MED_DATA_OUT <= buf_MED_DATA_OUT; STAT_POINTS_locked => buf_STAT_POINTS_locked((i+1)*32-1 downto i*32), STAT_TIMEOUT => STAT_TIMEOUT((i+1)*32-1 downto i*32), STAT_ERRORBITS => HUB_STAT_ERRORBITS((i+1)*32-1 downto i*32), - STAT_ALL_ERRORBITS => buf_HUB_ERROR_BITS((i+1)*32*16-1 downto i*32*16), + STAT_ALL_ERRORBITS => buf_HUB_ALL_ERROR_BITS((i+1)*32*16-1 downto i*32*16), STAT_FSM => stat_ipu_fsm, CTRL_TIMEOUT_TIME => HUB_CTRL_TIMEOUT_TIME(i*4+3 downto i*4), CTRL_activepoints => HUB_CTRL_final_activepoints((i+1)*32-1 downto i*32), @@ -797,7 +797,7 @@ MED_DATA_OUT <= buf_MED_DATA_OUT; HUB_INIT_DATA_OUT(next_point_num*c_DATA_WIDTH-1 downto first_point_num*c_DATA_WIDTH) <= (others => '0'); HUB_INIT_PACKET_NUM_OUT(next_point_num*c_NUM_WIDTH-1 downto first_point_num*c_NUM_WIDTH) <= (others => '0'); HUB_INIT_READ_IN(next_point_num-1 downto first_point_num) <= (others => '0'); - buf_HUB_ERROR_BITS((i+1)*32-1 downto i*32) <= (others => '0'); + buf_HUB_ALL_ERROR_BITS((i+1)*32-1 downto i*32) <= (others => '0'); end generate; end generate; end generate; @@ -1005,10 +1005,10 @@ HUB_MED_CONNECTED(31 downto MII_NUMBER) <= (others => '1'); end generate; loop_links_2 : for i in 0 to 15 generate - HUB_ERROR_BITS(i*32+7 downto i*32+0) <= buf_HUB_ERROR_BITS(i*32+7 downto i*32+0); - HUB_ERROR_BITS(i*32+15 downto i*32+8) <= buf_HUB_ERROR_BITS(i*32+23 downto i*32+16); - HUB_ERROR_BITS(i*32+23 downto i*32+16) <= buf_HUB_ERROR_BITS(i*32+32*16+7 downto i*32+32*16+0); - HUB_ERROR_BITS(i*32+31 downto i*32+24) <= buf_HUB_ERROR_BITS(i*32+32*16+23 downto i*32+32*16+16); + HUB_ERROR_BITS(i*32+7 downto i*32+0) <= buf_HUB_ALL_ERROR_BITS(i*32+7 downto i*32+0); + HUB_ERROR_BITS(i*32+15 downto i*32+8) <= buf_HUB_ALL_ERROR_BITS(i*32+23 downto i*32+16); + HUB_ERROR_BITS(i*32+23 downto i*32+16) <= buf_HUB_ALL_ERROR_BITS(i*32+32*16+7 downto i*32+32*16+0); + HUB_ERROR_BITS(i*32+31 downto i*32+24) <= buf_HUB_ALL_ERROR_BITS(i*32+32*16+23 downto i*32+32*16+16); end generate; PROC_TIMEOUT : process(CLK) @@ -1040,8 +1040,8 @@ HUB_MED_CONNECTED(31 downto MII_NUMBER) <= (others => '1'); HC_STAT_REGS(36*32+31 downto 36*32) <= (others => '0'); else for i in 0 to MII_NUMBER-1 loop - HC_STAT_REGS(36*32+i) <= HC_STAT_REGS(36*32+i) or buf_HUB_ERROR_BITS(i*32+48*32+1) or buf_HUB_ERROR_BITS(i*32+48*32+3) or - buf_HUB_ERROR_BITS(i*32+48*32+6); + HC_STAT_REGS(36*32+i) <= HC_STAT_REGS(36*32+i) or buf_HUB_ALL_ERROR_BITS(i*32+48*32+1) or buf_HUB_ALL_ERROR_BITS(i*32+48*32+3) or + buf_HUB_ALL_ERROR_BITS(i*32+48*32+6); end loop; end if; end if; diff --git a/trb_net16_hub_ipu_logic.vhd b/trb_net16_hub_ipu_logic.vhd index c9a8015..c3ab43a 100644 --- a/trb_net16_hub_ipu_logic.vhd +++ b/trb_net16_hub_ipu_logic.vhd @@ -1143,8 +1143,11 @@ begin comb_REPLY_POOL_DATA <= (others => '0'); when c_F1 => comb_REPLY_POOL_DATA <= REPLY_combined_trm_F1; + comb_REPLY_POOL_DATA(0) <= REPLY_combined_trm_F1(0) or evt_number_mismatch; + comb_REPLY_POOL_DATA(1) <= REPLY_combined_trm_F1(1) or evt_code_mismatch; when c_F2 => - comb_REPLY_POOL_DATA <= REPLY_combined_trm_F2; + comb_REPLY_POOL_DATA <= REPLY_combined_trm_F2; + comb_REPLY_POOL_DATA(6) <= REPLY_combined_trm_F2(6) or timeout_found; when c_F3 => comb_REPLY_POOL_DATA <= REPLY_combined_trm_F3; if REPLY_POOL_next_read = '1' and (init_locked = '1') then diff --git a/trb_net16_hub_logic.vhd b/trb_net16_hub_logic.vhd index 4927496..11d6a39 100644 --- a/trb_net16_hub_logic.vhd +++ b/trb_net16_hub_logic.vhd @@ -419,14 +419,23 @@ begin gen_reading_trmFn : for i in 0 to POINT_NUMBER-1 generate - reading_trmF0(i) <= not reply_packet_num_in_i(i*c_NUM_WIDTH+1) and not reply_packet_num_in_i(i*c_NUM_WIDTH) - and not reply_packet_num_in_i(i*c_NUM_WIDTH+2) and REPLY_reading_trm(i) and reply_dataready_in_i(i); - reading_trmF1(i) <= not reply_packet_num_in_i(i*c_NUM_WIDTH+1) and reply_packet_num_in_i(i*c_NUM_WIDTH) - and REPLY_reading_trm(i) and reply_dataready_in_i(i); - reading_trmF2(i) <= reply_packet_num_in_i(i*c_NUM_WIDTH+1) and not reply_packet_num_in_i(i*c_NUM_WIDTH) - and REPLY_reading_trm(i) and reply_dataready_in_i(i); - reading_trmF3(i) <= reply_packet_num_in_i(i*c_NUM_WIDTH+1) and reply_packet_num_in_i(i*c_NUM_WIDTH) - and REPLY_reading_trm(i) and reply_dataready_in_i(i); + reading_trmF0(i) <= '1' when reply_packet_num_in_i(i*c_NUM_WIDTH+2 downto i*c_NUM_WIDTH) = c_F0 + and REPLY_reading_trm(i) = '1' and reply_dataready_in_i(i) = '1' else '0'; + reading_trmF1(i) <= '1' when reply_packet_num_in_i(i*c_NUM_WIDTH+2 downto i*c_NUM_WIDTH) = c_F1 + and REPLY_reading_trm(i) = '1' and reply_dataready_in_i(i) = '1' else '0'; + reading_trmF2(i) <= '1' when reply_packet_num_in_i(i*c_NUM_WIDTH+2 downto i*c_NUM_WIDTH) = c_F2 + and REPLY_reading_trm(i) = '1' and reply_dataready_in_i(i) = '1' else '0'; + reading_trmF3(i) <= '1' when reply_packet_num_in_i(i*c_NUM_WIDTH+2 downto i*c_NUM_WIDTH) = c_F3 + and REPLY_reading_trm(i) = '1' and reply_dataready_in_i(i) = '1' else '0'; + +-- not reply_packet_num_in_i(i*c_NUM_WIDTH+1) and not reply_packet_num_in_i(i*c_NUM_WIDTH) +-- and not reply_packet_num_in_i(i*c_NUM_WIDTH+2) and REPLY_reading_trm(i) and reply_dataready_in_i(i); +-- reading_trmF1(i) <= not reply_packet_num_in_i(i*c_NUM_WIDTH+1) and reply_packet_num_in_i(i*c_NUM_WIDTH) +-- and REPLY_reading_trm(i) and reply_dataready_in_i(i); +-- reading_trmF2(i) <= reply_packet_num_in_i(i*c_NUM_WIDTH+1) and not reply_packet_num_in_i(i*c_NUM_WIDTH) +-- and REPLY_reading_trm(i) and reply_dataready_in_i(i); +-- reading_trmF3(i) <= reply_packet_num_in_i(i*c_NUM_WIDTH+1) and reply_packet_num_in_i(i*c_NUM_WIDTH) +-- and REPLY_reading_trm(i) and reply_dataready_in_i(i); end generate; gen_combining_trm : for j in 0 to c_DATA_WIDTH-1 generate @@ -469,9 +478,10 @@ begin for i in 0 to POINT_NUMBER-1 loop if reading_trmF1(i) = '1' then STAT_ALL_ERRORBITS(i*32+31 downto i*32+16) <= reply_data_in_i(i*16+15 downto i*16); - end if; - if reading_trmF2(i) = '1' then + elsif reading_trmF2(i) = '1' then STAT_ALL_ERRORBITS(i*32+15 downto i*32+0) <= reply_data_in_i(i*16+15 downto i*16); + elsif locked = '1' and last_locked = '0' then + STAT_ALL_ERRORBITS(i*32+31 downto i*32) <= (others => '0'); end if; end loop; end if; diff --git a/trb_net16_hub_streaming_port.vhd b/trb_net16_hub_streaming_port.vhd index 38b3b46..3fa6337 100644 --- a/trb_net16_hub_streaming_port.vhd +++ b/trb_net16_hub_streaming_port.vhd @@ -196,7 +196,7 @@ begin --------------------------------------------------------------------- COMMON_CTRL_REGS <= common_ctrl; - common_stat <= COMMON_STAT_REGS; + COMMON_STAT_REGS <= common_stat; MY_ADDRESS_OUT <= my_address; diff --git a/trb_net16_ipudata.vhd b/trb_net16_ipudata.vhd index 1c30ee8..187d57b 100644 --- a/trb_net16_ipudata.vhd +++ b/trb_net16_ipudata.vhd @@ -58,7 +58,8 @@ architecture trb_net16_ipudata_arch of trb_net16_ipudata is signal buf_IPU_ERROR_PATTERN_IN : std_logic_vector(31 downto 0); signal buf_IPU_LENGTH_IN : std_logic_vector(15 downto 0); - signal update_buffers : std_logic; + signal update_buffer_length : std_logic; + signal update_buffer_error : std_logic; signal buf_API_READ_OUT : std_logic; signal buf_API_DATAREADY_OUT : std_logic; signal buf_API_DATA_OUT : std_logic_vector (c_DATA_WIDTH-1 downto 0); @@ -96,7 +97,6 @@ begin state <= START; buf_API_READ_OUT <= '0'; buf_START_READOUT <= '0'; - update_buffers <= '0'; waiting_word <= '0'; buf_API_DATAREADY_OUT <= '0'; first_ipu_read <= '0'; @@ -104,7 +104,6 @@ begin buf_API_READ_OUT <= '1'; first_ipu_read <= '0'; make_compare <= '0'; - update_buffers <= '0'; case state is when START => buf_API_SEND_OUT <= '0'; @@ -125,7 +124,6 @@ begin when WAITING => if IPU_DATAREADY_IN = '1' and API_READ_IN = '1' then first_ipu_read <= '1'; -- read signal for DHDR - update_buffers <= '1'; -- store length and error pattern on separate ports state <= MAKE_DHDR; dhdr_counter <= (others => '0'); make_compare <= '1'; @@ -177,9 +175,6 @@ begin if saved_IPU_READOUT_FINISHED_IN = '1' and waiting_word = '0' and IPU_DATAREADY_IN = '0' and buf_API_DATAREADY_OUT = '0' then state <= START; end if; - if saved_IPU_READOUT_FINISHED_IN = '1' or IPU_READOUT_FINISHED_IN = '1' then - update_buffers <= '1'; - end if; when others => state <= START; @@ -190,6 +185,8 @@ begin buf_IPU_READ <= '1' when API_READ_IN = '1' and waiting_word = '0' and second_word_waiting = '0' and (state = READING or first_ipu_read = '1') else '0'; + update_buffer_length <= '1' when (state = WAITING and IPU_DATAREADY_IN = '1' and API_READ_IN = '1') else '0'; + update_buffer_error <= '1' when (state = READING and IPU_READOUT_FINISHED_IN = '1') else '0'; --------------------------------------------------------------------- --second half of 32bit word has to be sent @@ -229,11 +226,18 @@ begin if RESET = '1' then buf_IPU_LENGTH_IN <= (others => '1'); buf_IPU_ERROR_PATTERN_IN <= (others => '0'); - elsif update_buffers = '1' then - buf_IPU_LENGTH_IN <= IPU_LENGTH_IN; - buf_IPU_ERROR_PATTERN_IN <= IPU_ERROR_PATTERN_IN; - buf_IPU_ERROR_PATTERN_IN(16) <= evt_number_mismatch; - buf_IPU_ERROR_PATTERN_IN(17) <= evt_code_mismatch; + else + if update_buffer_length = '1' then + buf_IPU_LENGTH_IN <= IPU_LENGTH_IN; + elsif buf_IPU_READ = '1' and IPU_DATAREADY_IN = '1' then + buf_IPU_LENGTH_IN <= buf_IPU_LENGTH_IN - 1; + end if; + if update_buffer_error = '1' then + buf_IPU_ERROR_PATTERN_IN <= IPU_ERROR_PATTERN_IN; + buf_IPU_ERROR_PATTERN_IN(16) <= evt_number_mismatch; + buf_IPU_ERROR_PATTERN_IN(17) <= evt_code_mismatch; + buf_IPU_ERROR_PATTERN_IN(18) <= or_all(buf_IPU_LENGTH_IN); + end if; end if; end if; end process; @@ -331,7 +335,8 @@ begin --------------------------------------------------------------------- --Debugging --------------------------------------------------------------------- - STAT_DEBUG <= (others => '0'); + STAT_DEBUG(2 downto 0) <= state_bits; + STAT_DEBUG(31 downto 3) <= (others => '0'); state_bits(0) <= '1' when state = START else '0'; state_bits(1) <= '1' when state = WAITING else '0';