From f1992daba85c03e0acf843a9625a5cc6d363feb1 Mon Sep 17 00:00:00 2001 From: hadeshyp Date: Wed, 17 Feb 2010 16:33:45 +0000 Subject: [PATCH] *** empty log message *** --- trb_net16_hub_logic.vhd | 22 +++++++++++----------- trb_net16_hub_streaming_port.vhd | 8 +++++--- trb_net16_med_16_IC.vhd | 4 ++-- 3 files changed, 18 insertions(+), 16 deletions(-) diff --git a/trb_net16_hub_logic.vhd b/trb_net16_hub_logic.vhd index 11d6a39..607a92b 100644 --- a/trb_net16_hub_logic.vhd +++ b/trb_net16_hub_logic.vhd @@ -1,7 +1,7 @@ LIBRARY IEEE; USE IEEE.std_logic_1164.ALL; -USE IEEE.std_logic_ARITH.ALL; -USE IEEE.std_logic_UNSIGNED.ALL; +-- USE IEEE.std_logic_ARITH.ALL; +-- USE IEEE.std_logic_UNSIGNED.ALL; use ieee.numeric_std.all; library work; @@ -99,8 +99,8 @@ architecture trb_net16_hub_logic_arch of trb_net16_hub_logic is type state_type is (SENDING_DATA, SENDING_REPLY_TRM); signal current_state, next_state : state_type; - signal packet_counter : std_logic_vector(c_NUM_WIDTH-1 downto 0); - signal data_counter : std_logic_vector(7 downto 0); + signal packet_counter : unsigned(c_NUM_WIDTH-1 downto 0); + signal data_counter : unsigned(7 downto 0); signal SEQ_NR : std_logic_vector(7 downto 0); signal comb_REPLY_POOL_DATAREADY : std_logic; signal comb_REPLY_POOL_DATA : std_logic_vector(c_DATA_WIDTH-1 downto 0); @@ -543,7 +543,7 @@ begin timeout_found <= or_all(connection_timed_out); if REPLY_DATAREADY_IN(i) = '1' or real_activepoints(i) = '0' or locked = '0' or locking_point(i) = '1' or reg_CTRL_TIMEOUT_TIME = x"F" then timeout_counter(i) <= (others => '0'); - elsif timeout_counter(i)(conv_integer(reg_CTRL_TIMEOUT_TIME(2 downto 0)&'1')) = '1' then + elsif timeout_counter(i)(to_integer(unsigned(reg_CTRL_TIMEOUT_TIME(2 downto 0)&'1'))) = '1' then connection_timed_out(i) <= '1'; elsif timer_ms_tick = '1' then timeout_counter(i) <= timeout_counter(i) + to_unsigned(1,1); @@ -561,12 +561,12 @@ begin begin if rising_edge(CLK) then if reset_i = '1' or locked = '0' then - packet_counter <= c_H0; + packet_counter <= unsigned(c_H0); elsif comb_REPLY_POOL_DATAREADY = '1' then - if packet_counter = c_max_word_number then + if packet_counter = unsigned(c_max_word_number) then packet_counter <= (others => '0'); else - packet_counter <= packet_counter + 1; + packet_counter <= packet_counter + to_unsigned(1,1); end if; end if; end if; @@ -580,7 +580,7 @@ begin data_counter <= (others => '0'); elsif comb_REPLY_POOL_PACKET_NUM = c_H0 and comb_REPLY_POOL_DATAREADY = '1' and comb_REPLY_POOL_DATA(2 downto 0) = TYPE_DAT then - data_counter <= data_counter + 1; + data_counter <= data_counter + to_unsigned(1,1); end if; end if; end process; @@ -681,7 +681,7 @@ begin release_locked <= '0'; next_state <= current_state; comb_REPLY_POOL_DATAREADY <= '0'; - comb_REPLY_POOL_PACKET_NUM <= packet_counter; + comb_REPLY_POOL_PACKET_NUM <= std_logic_vector(packet_counter); comb_REPLY_POOL_DATA <= (others => '0'); next_waiting_for_init_finish <= waiting_for_init_finish; @@ -702,7 +702,7 @@ begin next_state <= SENDING_DATA; next_waiting_for_init_finish <= '0'; end if; - case packet_counter is + case std_logic_vector(packet_counter) is when c_F0 => comb_REPLY_POOL_DATA <=REPLY_combined_trm_F0; when c_F1 => diff --git a/trb_net16_hub_streaming_port.vhd b/trb_net16_hub_streaming_port.vhd index 92ebc7f..0aa9258 100644 --- a/trb_net16_hub_streaming_port.vhd +++ b/trb_net16_hub_streaming_port.vhd @@ -200,9 +200,11 @@ begin begin tmp15 := '0'; tmp13 := '0'; - for i in 0 to MII_NUMBER loop - tmp15 := tmp or MED_STAT_OP(i*16+15) when MII_IS_UPLINK = 1 else tmp15; - tmp13 := tmp or MED_STAT_OP(i*16+13) when MII_IS_UPLINK = 1 else tmp13; + for i in 0 to MII_NUMBER-1 loop + if MII_IS_UPLINK(i) = 1 then + tmp15 := tmp15 or MED_STAT_OP(i*16+15); + tmp13 := tmp13 or MED_STAT_OP(i*16+13); + end if; end loop; hub_make_network_reset <= tmp15; hub_got_network_reset <= tmp13; diff --git a/trb_net16_med_16_IC.vhd b/trb_net16_med_16_IC.vhd index 1d470ed..eef805a 100644 --- a/trb_net16_med_16_IC.vhd +++ b/trb_net16_med_16_IC.vhd @@ -130,7 +130,7 @@ begin reg0_DATA_CTRL_IN <= buf_DATA_CTRL_IN; end if; end process; - THE_INPUT_SYNC : process(DATA_CLK_IN) + THE_INPUT_SYNC_2 : process(DATA_CLK_IN) begin if rising_edge(DATA_CLK_IN) then reg_DATA_IN <= reg0_DATA_IN; @@ -192,7 +192,7 @@ begin begin if rising_edge(CLK) then if RESET = '1' then - rx_counter <= c_H0; + rx_counter <= unsigned(c_H0); elsif buf_MED_DATAREADY_OUT = '1' and CLK_EN = '1' then if rx_counter = unsigned(c_max_word_number) then rx_counter <= (others => '0'); -- 2.43.0