From: Jan Michel Date: Wed, 23 Aug 2023 08:56:55 +0000 (+0200) Subject: add option to disable readout of word alignment in media interface X-Git-Url: https://jspc29.x-matter.uni-frankfurt.de/git/?a=commitdiff_plain;h=0c58566b17b68e78717e36fa1ac0043b296d7f03;p=trbnet.git add option to disable readout of word alignment in media interface --- diff --git a/.gitignore b/.gitignore index c6ee483..1dccb1d 100644 --- a/.gitignore +++ b/.gitignore @@ -30,3 +30,4 @@ syn_results *.cmd *.bak* oldfiles +_math_real.vhd diff --git a/media_interfaces/med_ecp3_sfp_sync_4_slave3.vhd b/media_interfaces/med_ecp3_sfp_sync_4_slave3.vhd index 0db57c9..96d957e 100644 --- a/media_interfaces/med_ecp3_sfp_sync_4_slave3.vhd +++ b/media_interfaces/med_ecp3_sfp_sync_4_slave3.vhd @@ -340,8 +340,8 @@ THE_SCI_READER : entity work.sci_reader MEDIA_STATUS_REG_IN(31 downto 0) => stat_rx_control_i(31 downto 0), MEDIA_STATUS_REG_IN(63 downto 32) => stat_tx_control_i(31 downto 0), - MEDIA_STATUS_REG_IN(95 downto 64) => stat_fsm_reset_i(31 downto 0), - MEDIA_STATUS_REG_IN(255 downto 96) => (others => '0'), + MEDIA_STATUS_REG_IN(191 downto 64) => stat_fsm_reset_i(127 downto 0), + MEDIA_STATUS_REG_IN(255 downto 192) => (others => '0'), DEBUG_OUT => open ); diff --git a/media_interfaces/med_ecp5_sfp_sync.vhd b/media_interfaces/med_ecp5_sfp_sync.vhd index dbc7a40..fc9bb90 100644 --- a/media_interfaces/med_ecp5_sfp_sync.vhd +++ b/media_interfaces/med_ecp5_sfp_sync.vhd @@ -13,7 +13,7 @@ use work.med_sync_define.all; entity med_ecp5_sfp_sync is generic( - USE_NEW_ECP5_RESET : integer := c_YES; + USE_NEW_ECP5_RESET : integer := c_NO; SERDES_NUM : integer range 0 to 3 := 0; IS_SYNC_SLAVE : integer := c_YES --select slave mode ); @@ -306,6 +306,9 @@ THE_MED_CONTROL : entity work.med_sync_control ); THE_SCI_READER : entity work.sci_reader + generic map( + USE_WORDALIGN => 0 + ), port map( CLK => SYSCLK, RESET => RESET, diff --git a/media_interfaces/med_ecp5_sfp_sync_2.vhd b/media_interfaces/med_ecp5_sfp_sync_2.vhd index a39e57e..4bcca07 100644 --- a/media_interfaces/med_ecp5_sfp_sync_2.vhd +++ b/media_interfaces/med_ecp5_sfp_sync_2.vhd @@ -394,6 +394,9 @@ end generate; THE_SCI_READER : entity work.sci_reader + generic map( + USE_WORDALIGN => 0 + ), port map( CLK => SYSCLK, RESET => RESET, diff --git a/media_interfaces/sync/sci_reader.vhd b/media_interfaces/sync/sci_reader.vhd index 6aed2f8..86cef6e 100644 --- a/media_interfaces/sync/sci_reader.vhd +++ b/media_interfaces/sync/sci_reader.vhd @@ -9,7 +9,9 @@ library work; use work.config.all; entity sci_reader is - + generic( + USE_WORDALIGN : integer := c_NO + ); port( CLK : in std_logic; RESET : in std_logic; @@ -41,7 +43,7 @@ signal sci_reg_i : std_logic; type sci_ctrl is (IDLE, SCTRL, SCTRL_WAIT, SCTRL_WAIT2, SCTRL_FINISH, GET_WA, GET_WA_WAIT, GET_WA_WAIT2, GET_WA_FINISH); signal sci_state : sci_ctrl; signal sci_timer : unsigned(12 downto 0) := (others => '0'); -signal wa_position : std_logic_vector(15 downto 0); +signal wa_position : std_logic_vector(15 downto 0) := (others => '0'); signal next_sci_wr : std_logic; begin @@ -96,7 +98,7 @@ begin SCI_RD <= BUS_RX.read and not (BUS_RX.addr(6) and not BUS_RX.addr(7) and BUS_RX.addr(8)); next_sci_wr <= BUS_RX.write and not (BUS_RX.addr(6) and not BUS_RX.addr(7) and BUS_RX.addr(8)); sci_state <= SCTRL; - elsif sci_timer(sci_timer'left) = '1' then + elsif sci_timer(sci_timer'left) = '1' and USE_WORDALIGN = c_YES then sci_timer <= (others => '0'); sci_state <= GET_WA; end if; diff --git a/media_interfaces/med_ecp5_sfp_sync_4.vhd b/oldfiles/med_ecp5_sfp_sync_4.vhd similarity index 92% rename from media_interfaces/med_ecp5_sfp_sync_4.vhd rename to oldfiles/med_ecp5_sfp_sync_4.vhd index daa6926..300aeb2 100644 --- a/media_interfaces/med_ecp5_sfp_sync_4.vhd +++ b/oldfiles/med_ecp5_sfp_sync_4.vhd @@ -34,10 +34,10 @@ entity med_ecp5_sfp_sync_4 is --SFP Connection SD_PRSNT_N_IN : in std_logic_vector(3 downto 0); -- SFP Present ('0' = SFP in place, '1' = no SFP mounted) SD_LOS_IN : in std_logic_vector(3 downto 0); -- SFP Loss Of Signal ('0' = OK, '1' = no signal) - SD_TXDIS_OUT : out std_logic_vector(3 downto 0) := x"0" -- SFP disable + SD_TXDIS_OUT : out std_logic_vector(3 downto 0) := x"0"; -- SFP disable --Control Interface --- BUS_RX : in CTRLBUS_RX; --- BUS_TX : out CTRLBUS_TX; + BUS_RX : in CTRLBUS_RX; + BUS_TX : out CTRLBUS_TX -- Status and control port -- STAT_DEBUG : out std_logic_vector (63 downto 0); @@ -112,7 +112,10 @@ begin reset_n <= not RESET; clk_200_ref <= CLK_REF_FULL; -SD_TXDIS_OUT <= not rx_ready; -- when IS_SYNC_SLAVE = 1 else '0'; --slave only switches on when RX is ready + +gen_txdis : for i in 0 to 3 generate + SD_TXDIS_OUT(i) <= not rx_ready(i) when IS_SYNC_SLAVE(i) = 1 else '0'; --slave only switches on when RX is ready +end generate; -- SD_TXDIS_OUT <= RESET; -- gen_slave_clock : if IS_SYNC_SLAVE = c_YES generate @@ -298,7 +301,7 @@ THE_SERDES : entity work.oepserdes ); -gen_channels : for i in 0 to 2 generate +gen_channels : for i in 0 to 3 generate THE_MED_CONTROL : entity work.med_sync_control generic map( IS_SYNC_SLAVE => IS_SYNC_SLAVE(i), @@ -376,32 +379,32 @@ end generate; --- THE_SCI_READER : entity work.sci_reader --- port map( --- CLK => SYSCLK, --- RESET => RESET, --- --- --SCI --- SCI_WRDATA => sci_data_in_i, --- SCI_RDDATA => sci_data_out_i, --- SCI_ADDR => sci_addr_i, --- SCI_SEL => sci_ch_i, --- SCI_RD => sci_read_i, --- SCI_WR => sci_write_i, --- --- WA_POS_OUT => wa_position, --- --- --Slowcontrol --- BUS_RX => BUS_RX, --- BUS_TX => BUS_TX, --- --- MEDIA_STATUS_REG_IN(31 downto 0) => stat_rx_control_i(31 downto 0), --- MEDIA_STATUS_REG_IN(63 downto 32) => stat_tx_control_i(31 downto 0), --- MEDIA_STATUS_REG_IN(95 downto 64) => stat_fsm_reset_i(31 downto 0), --- MEDIA_STATUS_REG_IN(223 downto 96) => stat_med, --- MEDIA_STATUS_REG_IN(255 downto 224) => (others => '0'), --- DEBUG_OUT => open --- ); +THE_SCI_READER : entity work.sci_reader + port map( + CLK => SYSCLK, + RESET => RESET, + + --SCI + SCI_WRDATA => sci_data_in_i, + SCI_RDDATA => sci_data_out_i, + SCI_ADDR => sci_addr_i, + SCI_SEL => sci_ch_i, + SCI_RD => sci_read_i, + SCI_WR => sci_write_i, + + WA_POS_OUT => wa_position, + + --Slowcontrol + BUS_RX => BUS_RX, + BUS_TX => BUS_TX, + + MEDIA_STATUS_REG_IN(31 downto 0) => stat_rx_control_i(31 downto 0), + MEDIA_STATUS_REG_IN(63 downto 32) => stat_tx_control_i(31 downto 0), + MEDIA_STATUS_REG_IN(95 downto 64) => stat_fsm_reset_i(31 downto 0), + MEDIA_STATUS_REG_IN(223 downto 96) => stat_med, + MEDIA_STATUS_REG_IN(255 downto 224) => (others => '0'), + DEBUG_OUT => open + ); end architecture;