From 26011388e42e05d4913d54b1f0a2ee345645dd57 Mon Sep 17 00:00:00 2001 From: hadeshyp Date: Wed, 1 Aug 2012 08:22:25 +0000 Subject: [PATCH] *** empty log message *** --- lattice/ecp3/lattice_ecp2m_fifo.vhd | 13 ++ trb_net16_hub_func.vhd | 3 +- trb_net16_hub_streaming_port.vhd | 2 +- trb_net16_hub_streaming_port_sctrl.vhd | 9 +- trb_net16_hub_streaming_port_sctrl_cts.vhd | 161 +++++++++++++-------- 5 files changed, 117 insertions(+), 71 deletions(-) diff --git a/lattice/ecp3/lattice_ecp2m_fifo.vhd b/lattice/ecp3/lattice_ecp2m_fifo.vhd index e14c049..2fe7250 100644 --- a/lattice/ecp3/lattice_ecp2m_fifo.vhd +++ b/lattice/ecp3/lattice_ecp2m_fifo.vhd @@ -272,6 +272,19 @@ package lattice_ecp2m_fifo is AlmostFull: out std_logic); end component; +component fifo_19x16 is + port ( + Data: in std_logic_vector(18 downto 0); + Clock: in std_logic; + WrEn: in std_logic; + RdEn: in std_logic; + Reset: in std_logic; + Q: out std_logic_vector(18 downto 0); + WCNT: out std_logic_vector(4 downto 0); + Empty: out std_logic; + Full: out std_logic; + AlmostFull: out std_logic); +end component; end package; diff --git a/trb_net16_hub_func.vhd b/trb_net16_hub_func.vhd index b08cca6..1d4408b 100644 --- a/trb_net16_hub_func.vhd +++ b/trb_net16_hub_func.vhd @@ -833,7 +833,8 @@ component trb_net16_hub_streaming_port_sctrl_cts is REGIO_WRITE_ACK_IN : in std_logic := '0'; REGIO_UNKNOWN_ADDR_IN : in std_logic := '0'; REGIO_TIMEOUT_OUT : out std_logic; - + EXTERNAL_SEND_RESET : in std_logic := '0'; + TIMER_TICKS_OUT : out std_logic_vector(1 downto 0); -- Debug and Status Ports ---------------------------------------------------------- HUB_STAT_CHANNEL : out std_logic_vector (4*16-1 downto 0); diff --git a/trb_net16_hub_streaming_port.vhd b/trb_net16_hub_streaming_port.vhd index 5cd947e..c1c8d7a 100644 --- a/trb_net16_hub_streaming_port.vhd +++ b/trb_net16_hub_streaming_port.vhd @@ -302,7 +302,7 @@ begin hub_ctrl_debug(2 downto 0) <= not io_error_in; hub_ctrl_debug(31 downto 3) <= (others => '0'); - + TIMER_TICKS_OUT <= timer_ticks; --------------------------------------------------------------------- -- I/O Buffers --------------------------------------------------------------------- diff --git a/trb_net16_hub_streaming_port_sctrl.vhd b/trb_net16_hub_streaming_port_sctrl.vhd index a7ba654..491a6b2 100644 --- a/trb_net16_hub_streaming_port_sctrl.vhd +++ b/trb_net16_hub_streaming_port_sctrl.vhd @@ -219,17 +219,14 @@ begin --generate media resync - gen_resync : for i in 0 to mii-1 generate + gen_resync : for i in 0 to mii generate MED_CTRL_OP(13+i*16 downto i*16) <= (others => '0'); MED_CTRL_OP(14+i*16) <= HUB_MED_CTRL_OP(14+i*16); MED_CTRL_OP(15+i*16) <= hub_make_network_reset ; end generate; - MED_CTRL_OP(13+mii*16 downto mii*16) <= (others => '0'); - MED_CTRL_OP(14+mii*16) <= '0'; - MED_CTRL_OP(15+mii*16) <= hub_make_network_reset; - hub_make_network_reset <= MED_STAT_OP(15+mii*16) or external_send_reset_long; + hub_make_network_reset <= external_send_reset_long; make_gbe_reset : process begin wait until rising_edge(CLK); @@ -340,7 +337,7 @@ begin HUB_STAT_GEN => buf_HUB_STAT_GEN ); - hub_ctrl_debug(2 downto 0) <= not io_error_in; + hub_ctrl_debug(2 downto 0) <= not ERROR_OK; hub_ctrl_debug(31 downto 3) <= (others => '0'); HUB_STAT_GEN <= buf_HUB_STAT_GEN; TIMER_TICKS_OUT <= timer_ticks; diff --git a/trb_net16_hub_streaming_port_sctrl_cts.vhd b/trb_net16_hub_streaming_port_sctrl_cts.vhd index 1a6e5c0..4700b5f 100644 --- a/trb_net16_hub_streaming_port_sctrl_cts.vhd +++ b/trb_net16_hub_streaming_port_sctrl_cts.vhd @@ -175,7 +175,8 @@ entity trb_net16_hub_streaming_port_sctrl_cts is REGIO_WRITE_ACK_IN : in std_logic := '0'; REGIO_UNKNOWN_ADDR_IN : in std_logic := '0'; REGIO_TIMEOUT_OUT : out std_logic; - + EXTERNAL_SEND_RESET : in std_logic := '0'; + TIMER_TICKS_OUT : out std_logic_vector(1 downto 0); -- Debug and Status Ports ---------------------------------------------------------- HUB_STAT_CHANNEL : out std_logic_vector (4*16-1 downto 0); @@ -193,25 +194,25 @@ end entity; architecture trb_net16_hub_streaming_arch of trb_net16_hub_streaming_port_sctrl_cts is -constant mii : integer := MII_NUMBER-1; +constant mii : integer := MII_NUMBER; constant DATA_INTERFACE_NUMBER : integer := RDO_ADDITIONAL_PORT + 1; -signal hub_init_dataready_out : std_logic_vector(4 downto 0); -signal hub_reply_dataready_out : std_logic_vector(4 downto 0); -signal hub_init_dataready_in : std_logic_vector(4 downto 0); -signal hub_reply_dataready_in : std_logic_vector(4 downto 0); -signal hub_init_read_out : std_logic_vector(4 downto 0); -signal hub_reply_read_out : std_logic_vector(4 downto 0); -signal hub_init_read_in : std_logic_vector(4 downto 0); -signal hub_reply_read_in : std_logic_vector(4 downto 0); -signal hub_init_data_out : std_logic_vector(79 downto 0); -signal hub_reply_data_out : std_logic_vector(79 downto 0); -signal hub_init_data_in : std_logic_vector(79 downto 0); -signal hub_reply_data_in : std_logic_vector(79 downto 0); -signal hub_init_packet_num_out : std_logic_vector(14 downto 0); -signal hub_reply_packet_num_out : std_logic_vector(14 downto 0); -signal hub_init_packet_num_in : std_logic_vector(14 downto 0); -signal hub_reply_packet_num_in : std_logic_vector(14 downto 0); +signal hub_init_dataready_out : std_logic_vector(5 downto 0); +signal hub_reply_dataready_out : std_logic_vector(5 downto 0); +signal hub_init_dataready_in : std_logic_vector(5 downto 0); +signal hub_reply_dataready_in : std_logic_vector(5 downto 0); +signal hub_init_read_out : std_logic_vector(5 downto 0); +signal hub_reply_read_out : std_logic_vector(5 downto 0); +signal hub_init_read_in : std_logic_vector(5 downto 0); +signal hub_reply_read_in : std_logic_vector(5 downto 0); +signal hub_init_data_out : std_logic_vector(80 downto 0); +signal hub_reply_data_out : std_logic_vector(80 downto 0); +signal hub_init_data_in : std_logic_vector(80 downto 0); +signal hub_reply_data_in : std_logic_vector(80 downto 0); +signal hub_init_packet_num_out : std_logic_vector(15 downto 0); +signal hub_reply_packet_num_out : std_logic_vector(15 downto 0); +signal hub_init_packet_num_in : std_logic_vector(15 downto 0); +signal hub_reply_packet_num_in : std_logic_vector(15 downto 0); signal cts_init_data_out : std_logic_vector(15 downto 0); signal cts_init_dataready_out : std_logic; @@ -238,7 +239,6 @@ signal io_dataready_in : std_logic_vector(3 downto 0); signal io_read_out : std_logic_vector(3 downto 0); signal io_data_in : std_logic_vector(4*16-1 downto 0); signal io_packet_num_in : std_logic_vector(4*3-1 downto 0); -signal io_error_in : std_logic_vector(2 downto 0); signal reset_i : std_logic; @@ -351,7 +351,8 @@ signal regio_dataready_i : std_logic; signal regio_write_ack_i : std_logic; signal regio_no_more_data_i: std_logic; signal regio_unknown_addr_i: std_logic; - +signal external_send_reset_long : std_logic; +signal external_send_reset_timer : std_logic; begin --------------------------------------------------------------------- @@ -365,7 +366,7 @@ begin begin if rising_edge(CLK) then reset_i <= RESET; - reset_i_mux_io <= MED_STAT_OP(mii*16+14) or reset_i; + reset_i_mux_io <= RESET; --MED_STAT_OP(mii*16+14) or end if; end process; @@ -376,13 +377,25 @@ begin MED_CTRL_OP(14+i*16) <= HUB_MED_CTRL_OP(14+i*16); MED_CTRL_OP(15+i*16) <= hub_make_network_reset ; end generate; - MED_CTRL_OP(13+mii*16 downto mii*16) <= (others => '0'); - MED_CTRL_OP(14+mii*16) <= '0'; - MED_CTRL_OP(15+mii*16) <= hub_make_network_reset; - - - hub_make_network_reset <= MED_STAT_OP(15) or MED_STAT_OP(15+mii*16); - +-- MED_CTRL_OP(13+mii*16 downto mii*16) <= (others => '0'); +-- MED_CTRL_OP(14+mii*16) <= '0'; +-- MED_CTRL_OP(15+mii*16) <= hub_make_network_reset; + + + hub_make_network_reset <= external_send_reset_long or MED_STAT_OP(15+4*16); --MED_STAT_OP(15) or MED_STAT_OP(15+(mii-1)*16); + + make_gbe_reset : process begin + wait until rising_edge(CLK); + if(EXTERNAL_SEND_RESET = '1') then + external_send_reset_long <= '1'; + external_send_reset_timer <= '1'; + end if; + if timer_ticks(0) = '1' or reset_i = '1' then + external_send_reset_timer <= '0'; + external_send_reset_long <= external_send_reset_timer; + end if; + end process; + --------------------------------------------------------------------- -- Connecting I/O --------------------------------------------------------------------- @@ -439,33 +452,33 @@ begin MED_STAT_OP => med_stat_op(mii*16-1 downto 0), MED_CTRL_OP => HUB_MED_CTRL_OP(mii*16-1 downto 0), - INT_INIT_DATAREADY_OUT(4 downto 0) => hub_init_dataready_out, - INT_INIT_DATA_OUT(79 downto 0) => hub_init_data_out, - INT_INIT_PACKET_NUM_OUT(14 downto 0) => hub_init_packet_num_out, - INT_INIT_READ_IN(4 downto 0) => hub_init_read_in, - INT_INIT_DATAREADY_IN(4 downto 0) => hub_init_dataready_in, - INT_INIT_DATA_IN(79 downto 0) => hub_init_data_in, - INT_INIT_PACKET_NUM_IN(14 downto 0) => hub_init_packet_num_in, - INT_INIT_READ_OUT(4 downto 0) => hub_init_read_out, - INT_REPLY_DATAREADY_OUT(4 downto 0) => hub_reply_dataready_out, - INT_REPLY_DATA_OUT(79 downto 0) => hub_reply_data_out, - INT_REPLY_PACKET_NUM_OUT(14 downto 0) => hub_reply_packet_num_out, - INT_REPLY_READ_IN(4 downto 0) => hub_reply_read_in, - INT_REPLY_DATAREADY_IN(4 downto 0) => hub_reply_dataready_in, - INT_REPLY_DATA_IN(79 downto 0) => hub_reply_data_in, - INT_REPLY_PACKET_NUM_IN(14 downto 0) => hub_reply_packet_num_in, - INT_REPLY_READ_OUT(4 downto 0) => hub_reply_read_out, + INT_INIT_DATAREADY_OUT => hub_init_dataready_out, + INT_INIT_DATA_OUT => hub_init_data_out, + INT_INIT_PACKET_NUM_OUT => hub_init_packet_num_out, + INT_INIT_READ_IN => hub_init_read_in, + INT_INIT_DATAREADY_IN => hub_init_dataready_in, + INT_INIT_DATA_IN => hub_init_data_in, + INT_INIT_PACKET_NUM_IN => hub_init_packet_num_in, + INT_INIT_READ_OUT => hub_init_read_out, + INT_REPLY_DATAREADY_OUT => hub_reply_dataready_out, + INT_REPLY_DATA_OUT => hub_reply_data_out, + INT_REPLY_PACKET_NUM_OUT => hub_reply_packet_num_out, + INT_REPLY_READ_IN => hub_reply_read_in, + INT_REPLY_DATAREADY_IN => hub_reply_dataready_in, + INT_REPLY_DATA_IN => hub_reply_data_in, + INT_REPLY_PACKET_NUM_IN => hub_reply_packet_num_in, + INT_REPLY_READ_OUT => hub_reply_read_out, --REGIO INTERFACE - REGIO_ADDR_OUT => regio_addr_out, - REGIO_READ_ENABLE_OUT => regio_read_enable_out, - REGIO_WRITE_ENABLE_OUT => regio_write_enable_out, - REGIO_DATA_OUT => regio_data_out, - REGIO_DATA_IN => regio_data_in, - REGIO_DATAREADY_IN => regio_dataready_in, - REGIO_NO_MORE_DATA_IN => regio_no_more_data_in, - REGIO_WRITE_ACK_IN => regio_write_ack_in, - REGIO_UNKNOWN_ADDR_IN => regio_unknown_addr_in, - REGIO_TIMEOUT_OUT => regio_timeout_out, + REGIO_ADDR_OUT => regio_addr_i, + REGIO_READ_ENABLE_OUT => regio_read_enable_i, + REGIO_WRITE_ENABLE_OUT => regio_write_enable_i, + REGIO_DATA_OUT => regio_data_out_i, + REGIO_DATA_IN => regio_data_in_i, + REGIO_DATAREADY_IN => regio_dataready_i, + REGIO_NO_MORE_DATA_IN => regio_no_more_data_i, + REGIO_WRITE_ACK_IN => regio_write_ack_i, + REGIO_UNKNOWN_ADDR_IN => regio_unknown_addr_i, + REGIO_TIMEOUT_OUT => regio_timeout_i, TIMER_TICKS_OUT => timer_ticks, ONEWIRE => ONEWIRE, ONEWIRE_MONITOR_IN => ONEWIRE_MONITOR_IN, @@ -482,7 +495,7 @@ begin HUB_STAT_GEN => buf_HUB_STAT_GEN ); - hub_ctrl_debug(2 downto 0) <= not io_error_in; + hub_ctrl_debug(2 downto 0) <= not ERROR_OK; hub_ctrl_debug(31 downto 3) <= (others => '0'); HUB_STAT_GEN <= buf_HUB_STAT_GEN; @@ -555,6 +568,13 @@ begin trg_apl_error_pattern_in(23 downto 16) <= CTS_TRG_RND_CODE_IN; trg_apl_error_pattern_in(31 downto 24) <= CTS_TRG_INFORMATION_IN(7 downto 0); CTS_TRG_BUSY_OUT <= trg_apl_run_out; + + hub_reply_dataready_in(2) <= '0'; + hub_reply_data_in(47 downto 32) <= (others => '0'); + hub_reply_packet_num_in(8 downto 6) <= (others => '0'); + hub_init_read_in(2) <= '0'; + + PROC_TRG_STATUS_BITS : process(CLK) begin @@ -592,10 +612,10 @@ begin -- IPU Channel Sender --------------------------------------------------------------------- - hub_reply_data_in(31 downto 16) <= (others => '0'); - hub_reply_packet_num_in(5 downto 3) <= (others => '0'); - hub_reply_dataready_in(1) <= '0'; - hub_init_read_in(1) <= '1'; + hub_reply_data_in(63 downto 48) <= (others => '0'); + hub_reply_packet_num_in(11 downto 9) <= (others => '0'); + hub_reply_dataready_in(3) <= '0'; + hub_init_read_in(3) <= '1'; THE_STREAMING : trb_net16_api_ipu_streaming_internal port map( @@ -671,7 +691,11 @@ begin TRG_RELEASE_IN => lvl1_trg_release, TRG_ERROR_PATTERN_IN => lvl1_error_pattern ); - + + hub_init_dataready_in(0) <= '0'; + hub_init_data_in(15 downto 0) <= (others => '0'); + hub_init_packet_num_in(2 downto 0) <= (others => '0'); + hub_reply_read_in(0) <= '0'; RDO_LVL1_HANDLER : handler_lvl1 generic map ( @@ -779,6 +803,11 @@ begin STAT_FIFO_TO_APL => open ); + hub_init_dataready_in(1) <= '0'; + hub_init_data_in(31 downto 16) <= (others => '0'); + hub_init_packet_num_in(5 downto 3) <= (others => '0'); + hub_reply_read_in(1) <= '0'; + RDO_IPUDATA_APL : trb_net16_ipudata port map( CLK => CLK, @@ -953,14 +982,20 @@ begin GSC_REPLY_DATA_OUT <= hub_reply_data_out(79 downto 64); GSC_REPLY_PACKET_NUM_OUT <= hub_reply_packet_num_out(14 downto 12); hub_reply_read_in(4) <= GSC_REPLY_READ_IN; - GSC_BUSY_OUT <= buf_HUB_STAT_GEN(4); + GSC_BUSY_OUT <= buf_HUB_STAT_GEN(3); + + hub_reply_dataready_in(4) <= '0'; + hub_reply_data_in(79 downto 64) <= (others => '0'); + hub_reply_packet_num_in(14 downto 12) <= (others => '0'); + hub_init_read_in(4) <= '1'; - ------------------------------------------------- -- Common Status Register ------------------------------------------------- - proc_gen_common_stat_regs : process(common_stat, stat_lvl1_handler, lvl1_trg_information, lvl1_trg_type, lvl1_trg_number, lvl1_trg_code) + proc_gen_common_stat_regs : process(common_stat, stat_lvl1_handler, lvl1_trg_information, + lvl1_trg_type, lvl1_trg_number, lvl1_trg_code, + stat_counters_lvl1_handler, int_trigger_num) begin COMMON_STAT_REGS <= common_stat; COMMON_STAT_REGS(4) <= stat_lvl1_handler(12); -- 2.43.0