]> jspc29.x-matter.uni-frankfurt.de Git - soda.git/commitdiff
tx_control replaced by special soda-version to remedy latancy problems.
authorPeter Lemmens <p.j.j.lemmens@rug.nl>
Thu, 10 Oct 2013 14:25:55 +0000 (16:25 +0200)
committerPeter Lemmens <p.j.j.lemmens@rug.nl>
Thu, 10 Oct 2013 14:25:55 +0000 (16:25 +0200)
Still occasional reset problems: got_link_ready_i sometimes goes low, indicating link-loss

Dedicated signal introduced for LINK_PHASE (for proper start of 8-bit tx in 16-bit interface) and
TX_DLM_INIT (early warning to tx_control state-machine; 1st byte loss is mended.

18 files changed:
sfp_1_200_int.txt [new symlink]
soda_client.ldf
soda_source.ldf
source/med_ecp3_sfp_sync_down.vhd
source/serdes_sync_downstream.ipx
source/serdes_sync_downstream.lpc
source/serdes_sync_downstream.txt
source/serdes_sync_downstream.vhd
source/serdes_sync_upstream.ipx
source/serdes_sync_upstream.lpc
source/serdes_sync_upstream.txt
source/soda_calibration_timer.vhd
source/soda_components.vhd
source/soda_packet_builder.vhd
source/soda_reply_handler.vhd
source/soda_source.vhd
source/trb3_periph_sodaclient.vhd
source/trb3_periph_sodasource.vhd

diff --git a/sfp_1_200_int.txt b/sfp_1_200_int.txt
new file mode 120000 (symlink)
index 0000000..65141a0
--- /dev/null
@@ -0,0 +1 @@
+../trbnet/media_interfaces/ecp3_sfp/sfp_1_200_int.txt
\ No newline at end of file
index 9b9b10f06eb372493627caaff2b80ad1bff221a9..4e9700bf653e72aa9c060fc5393c5ab2f5c59a8b 100644 (file)
@@ -4,7 +4,7 @@
         <Option name="HDL type" value="VHDL"/>
     </Options>
     <Implementation title="soda_client" dir="soda_client" description="soda_client" default_strategy="Strategy1">
-        <Options def_top="trb3_periph_sodaclient" top="trb3_periph_sodaclient"/>
+        <Options top="trb3_periph_sodaclient"/>
         <Source name="source/version.vhd" type="VHDL" type_short="VHDL">
             <Options/>
         </Source>
         <Source name="source/serdes_sync_upstream.ipx" type="IPX_Module" type_short="IPX">
             <Options/>
         </Source>
+        <Source name="source/soda_SOB_faker.vhd" type="VHDL" type_short="VHDL">
+            <Options/>
+        </Source>
+        <Source name="source/soda_calibration_timer.vhd" type="VHDL" type_short="VHDL">
+            <Options/>
+        </Source>
+        <Source name="source/soda_reply_handler.vhd" type="VHDL" type_short="VHDL">
+            <Options/>
+        </Source>
         <Source name="../trbnet/trb_net_components.vhd" type="VHDL" type_short="VHDL">
             <Options/>
         </Source>
         <Source name="../trbnet/special/spi_flash_and_fpga_reload.vhd" type="VHDL" type_short="VHDL">
             <Options/>
         </Source>
-        <Source name="source/soda_reply_handler.vhd" type="VHDL" type_short="VHDL">
-            <Options/>
-        </Source>
-        <Source name="source/soda_calibration_timer.vhd" type="VHDL" type_short="VHDL">
-            <Options/>
-        </Source>
-        <Source name="source/soda_SOB_faker.vhd" type="VHDL" type_short="VHDL">
-            <Options/>
-        </Source>
         <Source name="source/trb3_periph_sodaclient.vhd" type="VHDL" type_short="VHDL">
             <Options top_module="trb3_periph_sodaclient"/>
         </Source>
index 369f753d0236e06d2565d7088112b1e9b439cecb..8455f1247df470fd493defd31128cbb7a7caaf02 100644 (file)
         <Source name="source/soda_reply_handler.vhd" type="VHDL" type_short="VHDL">
             <Options/>
         </Source>
+        <Source name="source/posedge_to_pulse.vhd" type="VHDL" type_short="VHDL">
+            <Options/>
+        </Source>
+        <Source name="source/soda_tx_control.vhd" type="VHDL" type_short="VHDL">
+            <Options/>
+        </Source>
         <Source name="../trbnet/trb_net16_term_buf.vhd" type="VHDL" type_short="VHDL">
             <Options/>
         </Source>
         <Source name="../trbnet/media_interfaces/sync/rx_reset_fsm.vhd" type="VHDL" type_short="VHDL">
             <Options/>
         </Source>
-        <Source name="../trbnet/media_interfaces/sync/tx_control.vhd" type="VHDL" type_short="VHDL">
-            <Options/>
-        </Source>
         <Source name="../trbnet/media_interfaces/sync/tx_reset_fsm.vhd" type="VHDL" type_short="VHDL">
             <Options/>
         </Source>
         <Source name="../trbnet/media_interfaces/ecp3_sfp/sfp_1_200_int.vhd" type="VHDL" type_short="VHDL">
             <Options/>
         </Source>
-        <Source name="source/posedge_to_pulse.vhd" type="VHDL" type_short="VHDL">
-            <Options/>
-        </Source>
         <Source name="soda_source.lpf" type="Logic Preference" type_short="LPF">
             <Options/>
         </Source>
index 361f15947bdf2dcd9f3d9b5c22058c878304eae4..378b7c790354b163bd0a9ae2c8f7bd1e7bb7bb6f 100644 (file)
@@ -9,61 +9,61 @@ library work;
 use work.trb_net_std.all;
 use work.trb_net_components.all;
 use work.med_sync_define.all;
+use work.soda_components.all;
 
 entity med_ecp3_sfp_sync_down is
-  generic(
-    SERDES_NUM : integer range 0 to 3 := 0;
---     MASTER_CLOCK_SWITCH : integer := c_NO;   --just for debugging, should be NO
-    IS_SYNC_SLAVE   : integer := c_NO       --select slave mode
-    );
-  port(
-    CLK                : in  std_logic; -- _internal_ 200 MHz reference clock
-    SYSCLK             : in  std_logic; -- 100 MHz main clock net, synchronous to RX clock
-    RESET              : in  std_logic; -- synchronous reset
-    CLEAR              : in  std_logic; -- asynchronous reset
-    --Internal Connection TX
-    MED_DATA_IN        : in  std_logic_vector(c_DATA_WIDTH-1 downto 0);
-    MED_PACKET_NUM_IN  : in  std_logic_vector(c_NUM_WIDTH-1 downto 0);
-    MED_DATAREADY_IN   : in  std_logic;
-    MED_READ_OUT       : out std_logic := '0';
-    --Internal Connection RX
-    MED_DATA_OUT       : out std_logic_vector(c_DATA_WIDTH-1 downto 0) := (others => '0');
-    MED_PACKET_NUM_OUT : out std_logic_vector(c_NUM_WIDTH-1 downto 0) := (others => '0');
-    MED_DATAREADY_OUT  : out std_logic := '0';
-    MED_READ_IN        : in  std_logic;
-    CLK_RX_HALF_OUT    : out std_logic := '0';  --received 100 MHz
-    CLK_RX_FULL_OUT    : out std_logic := '0';  --received 200 MHz
-    
-    --Sync operation
-    RX_DLM             : out std_logic := '0';
-    RX_DLM_WORD        : out std_logic_vector(7 downto 0) := x"00";
-    TX_DLM             : in  std_logic := '0';
-    TX_DLM_WORD        : in  std_logic_vector(7 downto 0) := x"00";
-    
-    --SFP Connection
-    SD_RXD_P_IN        : in  std_logic;
-    SD_RXD_N_IN        : in  std_logic;
-    SD_TXD_P_OUT       : out std_logic;
-    SD_TXD_N_OUT       : out std_logic;
-    SD_REFCLK_P_IN     : in  std_logic;  --not used
-    SD_REFCLK_N_IN     : in  std_logic;  --not used
-    SD_PRSNT_N_IN      : in  std_logic;  -- SFP Present ('0' = SFP in place, '1' = no SFP mounted)
-    SD_LOS_IN          : in  std_logic;  -- SFP Loss Of Signal ('0' = OK, '1' = no signal)
-    SD_TXDIS_OUT       : out  std_logic := '0'; -- SFP disable
-    --Control Interface
-    SCI_DATA_IN        : in  std_logic_vector(7 downto 0) := (others => '0');
-    SCI_DATA_OUT       : out std_logic_vector(7 downto 0) := (others => '0');
-    SCI_ADDR           : in  std_logic_vector(8 downto 0) := (others => '0');
-    SCI_READ           : in  std_logic := '0';
-    SCI_WRITE          : in  std_logic := '0';
-    SCI_ACK            : out std_logic := '0';
-    SCI_NACK           : out std_logic := '0';
-    -- Status and control port
-    STAT_OP            : out std_logic_vector (15 downto 0);
-    CTRL_OP            : in  std_logic_vector (15 downto 0) := (others => '0');
-    STAT_DEBUG         : out std_logic_vector (63 downto 0);
-    CTRL_DEBUG         : in  std_logic_vector (63 downto 0) := (others => '0')
-   );
+       generic(        SERDES_NUM : integer range 0 to 3 := 0;
+                               IS_SYNC_SLAVE   : integer := c_NO);       --select slave mode
+       port(
+               CLK                : in  std_logic; -- _internal_ 200 MHz reference clock
+               SYSCLK             : in  std_logic; -- 100 MHz main clock net, synchronous to RX clock
+               RESET              : in  std_logic; -- synchronous reset
+               CLEAR              : in  std_logic; -- asynchronous reset
+               --Internal Connection TX
+               MED_DATA_IN        : in  std_logic_vector(c_DATA_WIDTH-1 downto 0);
+               MED_PACKET_NUM_IN  : in  std_logic_vector(c_NUM_WIDTH-1 downto 0);
+               MED_DATAREADY_IN   : in  std_logic;
+               MED_READ_OUT       : out std_logic := '0';
+               --Internal Connection RX
+               MED_DATA_OUT       : out std_logic_vector(c_DATA_WIDTH-1 downto 0) := (others => '0');
+               MED_PACKET_NUM_OUT : out std_logic_vector(c_NUM_WIDTH-1 downto 0) := (others => '0');
+               MED_DATAREADY_OUT  : out std_logic := '0';
+               MED_READ_IN        : in  std_logic;
+               CLK_RX_HALF_OUT    : out std_logic := '0';  --received 100 MHz
+               CLK_RX_FULL_OUT    : out std_logic := '0';  --received 200 MHz
+
+               --Sync operation
+               RX_DLM             : out std_logic := '0';
+               RX_DLM_WORD        : out std_logic_vector(7 downto 0) := x"00";
+               TX_DLM             : in  std_logic := '0';
+               TX_DLM_WORD        : in  std_logic_vector(7 downto 0) := x"00";\r
+               TX_DLM_INIT                             : in std_logic := '0';  --PL!\r
+               LINK_PHASE_OUT                  : out   std_logic := '0';       --PL!
+
+               --SFP Connection
+               SD_RXD_P_IN        : in  std_logic;
+               SD_RXD_N_IN        : in  std_logic;
+               SD_TXD_P_OUT       : out std_logic;
+               SD_TXD_N_OUT       : out std_logic;
+               SD_REFCLK_P_IN     : in  std_logic;  --not used
+               SD_REFCLK_N_IN     : in  std_logic;  --not used
+               SD_PRSNT_N_IN      : in  std_logic;  -- SFP Present ('0' = SFP in place, '1' = no SFP mounted)
+               SD_LOS_IN          : in  std_logic;  -- SFP Loss Of Signal ('0' = OK, '1' = no signal)
+               SD_TXDIS_OUT       : out  std_logic := '0'; -- SFP disable
+               --Control Interface
+               SCI_DATA_IN        : in  std_logic_vector(7 downto 0) := (others => '0');
+               SCI_DATA_OUT       : out std_logic_vector(7 downto 0) := (others => '0');
+               SCI_ADDR           : in  std_logic_vector(8 downto 0) := (others => '0');
+               SCI_READ           : in  std_logic := '0';
+               SCI_WRITE          : in  std_logic := '0';
+               SCI_ACK            : out std_logic := '0';
+               SCI_NACK           : out std_logic := '0';
+               -- Status and control port
+               STAT_OP            : out std_logic_vector (15 downto 0);
+               CTRL_OP            : in  std_logic_vector (15 downto 0) := (others => '0');
+               STAT_DEBUG         : out std_logic_vector (63 downto 0);
+               CTRL_DEBUG         : in  std_logic_vector (63 downto 0) := (others => '0')
+       );
 end entity;
 
 
@@ -108,12 +108,14 @@ signal rx_k              : std_logic;
 signal rx_error          : std_logic;
 
 signal rst_n             : std_logic;
+signal rst                                             : std_logic;            -- PL!
 signal rx_serdes_rst     : std_logic;
 signal tx_serdes_rst     : std_logic;
 signal tx_pcs_rst        : std_logic;
 signal rx_pcs_rst        : std_logic;
 signal rst_qd            : std_logic;
 signal serdes_rst_qd     : std_logic;
+signal sd_los_i          : std_logic;  --PL!
 
 signal rx_los_low        : std_logic;
 signal lsm_status        : std_logic;
@@ -137,6 +139,7 @@ signal tx_allow           : std_logic;
 signal rx_allow           : std_logic;
 signal tx_allow_q         : std_logic;
 signal rx_allow_q         : std_logic;
+signal link_phase_S                    : std_logic;    --PL!
 signal request_retr_i     : std_logic;
 signal start_retr_i       : std_logic;
 signal request_retr_position_i  : std_logic_vector(7 downto 0);
@@ -170,7 +173,9 @@ CLK_RX_FULL_OUT <= clk_rx_full;
 SD_TXDIS_OUT <= '0'; --not (rx_allow_q or not IS_SLAVE);   --slave only switches on when RX is ready
 
 
-rst_n <= not CLEAR;
+--rst_n <= not CLEAR;  PL!
+rst_n <= not (CLEAR or sd_los_i or internal_make_link_reset_out);
+rst   <=     (CLEAR or sd_los_i or internal_make_link_reset_out);
 
 
 gen_slave_clock : if IS_SYNC_SLAVE = c_YES generate
@@ -191,7 +196,7 @@ THE_SERDES : entity work.serdes_sync_downstream
     hdinn_ch0            => SD_RXD_N_IN,
     hdoutp_ch0           => SD_TXD_P_OUT,
     hdoutn_ch0           => SD_TXD_N_OUT,
-    rxiclk_ch0           => clk_200_i,
+--    rxiclk_ch0           => clk_200_i,
     txiclk_ch0           => clk_200_i,
     rx_full_clk_ch0      => clk_rx_full,
     rx_half_clk_ch0      => clk_rx_half,
@@ -262,18 +267,18 @@ THE_TX_FSM : tx_reset_fsm
     );
 
 -- Master does not do bit-locking    
-wa_position_rx <= wa_position when (IS_SYNC_SLAVE = 1) else x"0000";
+wa_position_rx <= wa_position when (IS_SYNC_SLAVE = c_YES) else x"0000";
 
 
 --Slave enables RX/TX when sync is done, Master waits additional time to make sure link is stable
 PROC_ALLOW : process begin
   wait until rising_edge(clk_200_i);
-  if rx_fsm_state = x"6" and (IS_SYNC_SLAVE = 1 or start_timer(start_timer'left) = '1') then
+  if rx_fsm_state = x"6" and (IS_SYNC_SLAVE = c_YES or start_timer(start_timer'left) = '1') then
     rx_allow <= '1';
   else
     rx_allow <= '0';
   end if;
-  if rx_fsm_state = x"6" and (IS_SYNC_SLAVE = 1 or start_timer(start_timer'left) = '1') then
+  if rx_fsm_state = x"6" and (IS_SYNC_SLAVE = c_YES or start_timer(start_timer'left) = '1') then
     tx_allow <= '1';
   else
     tx_allow <= '0';
@@ -299,38 +304,40 @@ end process;
 -------------------------------------------------      
 -- TX Data
 -------------------------------------------------         
-THE_TX : tx_control
-  port map(
-    CLK_200                => clk_200_i,
-    CLK_100                => SYSCLK,
-    RESET_IN               => CLEAR,
-
-    TX_DATA_IN             => MED_DATA_IN,
-    TX_PACKET_NUMBER_IN    => MED_PACKET_NUM_IN,
-    TX_WRITE_IN            => MED_DATAREADY_IN,
-    TX_READ_OUT            => MED_READ_OUT,
-
-    TX_DATA_OUT            => tx_data,
-    TX_K_OUT               => tx_k,
-
-    REQUEST_RETRANSMIT_IN  => request_retr_i,             --TODO
-    REQUEST_POSITION_IN    => request_retr_position_i,    --TODO
-
-    START_RETRANSMIT_IN    => start_retr_i,               --TODO
-    START_POSITION_IN      => request_retr_position_i,    --TODO
-
-    SEND_DLM               => TX_DLM,
-    SEND_DLM_WORD          => TX_DLM_WORD,
-    
-    SEND_LINK_RESET_IN     => CTRL_OP(15),
-    TX_ALLOW_IN            => tx_allow,
-    RX_ALLOW_IN            => rx_allow,
-
-    DEBUG_OUT              => debug_tx_control_i,
-    STAT_REG_OUT           => stat_tx_control_i
-    );  
-
-
+THE_TX : soda_tx_control
+       port map(
+               CLK_200                                         => clk_200_i,
+               CLK_100                                         => SYSCLK,
+               RESET_IN                                                => rst,         --CLEAR, PL!
+
+               TX_DATA_IN                                      => MED_DATA_IN,
+               TX_PACKET_NUMBER_IN             => MED_PACKET_NUM_IN,
+               TX_WRITE_IN                                     => MED_DATAREADY_IN,
+               TX_READ_OUT                                     => MED_READ_OUT,
+
+               TX_DATA_OUT                                     => tx_data,
+               TX_K_OUT                                                => tx_k,
+
+               REQUEST_RETRANSMIT_IN   => request_retr_i,             --TODO
+               REQUEST_POSITION_IN             => request_retr_position_i,    --TODO
+
+               START_RETRANSMIT_IN             => start_retr_i,               --TODO
+               START_POSITION_IN                       => request_retr_position_i,    --TODO
+\r
+               TX_DLM_INIT                                     =>      TX_DLM_INIT,
+               SEND_DLM                                                => TX_DLM,
+               SEND_DLM_WORD                           => TX_DLM_WORD,
+
+               SEND_LINK_RESET_IN              => CTRL_OP(15),
+               TX_ALLOW_IN                                     => tx_allow,
+               RX_ALLOW_IN                                     => rx_allow,\r
+               LINK_PHASE_OUT                          =>      link_phase_S,           --PL!
+
+               DEBUG_OUT                                       => debug_tx_control_i,
+               STAT_REG_OUT                            => stat_tx_control_i
+);  
+
+LINK_PHASE_OUT         <= link_phase_S;                --PL!
 -------------------------------------------------      
 -- RX Data
 -------------------------------------------------             
@@ -338,7 +345,7 @@ THE_RX_CONTROL : rx_control
   port map(
     CLK_200                        => clk_200_i,
     CLK_100                        => SYSCLK,
-    RESET_IN                       => CLEAR,
+    RESET_IN                       => rst,             --CLEAR, PL!
 
     RX_DATA_OUT                    => MED_DATA_OUT,
     RX_PACKET_NUMBER_OUT           => MED_PACKET_NUM_OUT,
@@ -483,8 +490,8 @@ debug_reg(63 downto 40) <= debug_rx_control_i(23 downto 0);
       
 STAT_DEBUG <= debug_reg;
 
-internal_make_link_reset_out <= make_link_reset_i when IS_SYNC_SLAVE = 1 else '0';
-
+internal_make_link_reset_out <= make_link_reset_i when IS_SYNC_SLAVE = c_YES else '0';
+sd_los_i <= SD_LOS_IN when rising_edge(SYSCLK);        -- PL!
 
 STAT_OP(15) <= send_link_reset_i when rising_edge(SYSCLK);
 STAT_OP(14) <= '0';
index 60b86453d152047a6cad4b895e8c6700dd060775..472bcbacecbd51d15bb38730838ac282c26a1669 100644 (file)
@@ -1,10 +1,11 @@
 <?xml version="1.0" encoding="UTF-8"?>
-<DiamondModule name="serdes_sync_downstream" module="PCS" VendorName="Lattice Semiconductor Corporation" generator="IPexpress" date="2013 09 11 08:27:01.177" version="8.1" type="IP" synthesis="synplify" source_format="VHDL">
+<DiamondModule name="serdes_sync_downstream" module="serdes_sync_downstream" VendorName="Lattice Semiconductor Corporation" generator="IPexpress" date="2013 10 02 10:05:44.402" version="8.1" type="Module" synthesis="synplify" source_format="VHDL">
   <Package>
-               <File name="serdes_sync_downstream.lpc" type="lpc" modified="2013 09 11 08:26:59.000"/>
-               <File name="serdes_sync_downstream.pp" type="pp" modified="2013 09 11 08:26:59.000"/>
-               <File name="serdes_sync_downstream.sym" type="sym" modified="2013 09 11 08:26:59.000"/>
-               <File name="serdes_sync_downstream.tft" type="tft" modified="2013 09 11 08:26:59.000"/>
-               <File name="serdes_sync_downstream.txt" type="pcs_module" modified="2013 09 11 08:26:59.000"/>
+               <File name="serdes_sync_downstream.lpc" type="lpc" modified="2013 10 02 10:05:42.000"/>
+               <File name="serdes_sync_downstream.pp" type="pp" modified="2013 10 02 10:05:42.000"/>
+               <File name="serdes_sync_downstream.sym" type="sym" modified="2013 10 02 10:05:43.000"/>
+               <File name="serdes_sync_downstream.tft" type="tft" modified="2013 10 01 11:57:48.000"/>
+               <File name="serdes_sync_downstream.txt" type="pcs_module" modified="2013 10 02 10:05:42.000"/>
+               <File name="serdes_sync_downstream.vhd" type="top_level_vhdl" modified="2013 10 01 11:57:48.000"/>
   </Package>
 </DiamondModule>
index 40b281237936c27c67414fd3d0a6e401effa9dde..687f5e43e08940181f6a14d9bb7a68a4ddb26db5 100644 (file)
@@ -16,8 +16,8 @@ CoreRevision=8.1
 ModuleName=serdes_sync_downstream
 SourceFormat=VHDL
 ParameterFileVersion=1.0
-Date=09/11/2013
-Time=08:26:59
+Date=10/02/2013
+Time=10:05:42
 
 [Parameters]
 Verilog=0
@@ -55,7 +55,7 @@ _tx_data_width0=8
 _tx_data_width1=8
 _tx_data_width2=8
 _tx_data_width3=8
-_tx_fifo0=DISABLED
+_tx_fifo0=ENABLED
 _tx_fifo1=ENABLED
 _tx_fifo2=ENABLED
 _tx_fifo3=ENABLED
@@ -91,7 +91,7 @@ _rx_data_width0=8
 _rx_data_width1=8
 _rx_data_width2=8
 _rx_data_width3=8
-_rx_fifo0=ENABLED
+_rx_fifo0=DISABLED
 _rx_fifo1=ENABLED
 _rx_fifo2=ENABLED
 _rx_fifo3=ENABLED
index 7ea13c86a94cea103b8ec94387011cd617daae09..5883a95e2e44cdd0ad983bcb600cf9ccf73b7283 100644 (file)
@@ -19,8 +19,8 @@ CH0_RX_DATA_RATE        "FULL"
 CH0_TX_DATA_RATE        "FULL"
 CH0_TX_DATA_WIDTH       "8"
 CH0_RX_DATA_WIDTH        "8"
-CH0_TX_FIFO       "DISABLED"
-CH0_RX_FIFO        "ENABLED"
+CH0_TX_FIFO       "ENABLED"
+CH0_RX_FIFO        "DISABLED"
 CH0_TDRV      "0"
 #CH0_TX_FICLK_RATE      200
 #CH0_RXREFCLK_RATE        "200"
@@ -52,7 +52,7 @@ CCLMARK                 "7"
 CH0_SSLB                "DISABLED"
 CH0_SPLBPORTS           "DISABLED"
 CH0_PCSLBPORTS          "DISABLED"
-INT_ALL                 "DISABLED"
+INT_ALL                 "ENABLED"
 QD_REFCK2CORE           "DISABLED"
 
 
index 36d0a695002d612765d96e3a8189afb722a88b8c..7070523edc633563761499f7413e8ce83bdae11c 100644 (file)
@@ -1538,7 +1538,6 @@ entity serdes_sync_downstream is
     hdinp_ch0, hdinn_ch0    :   in std_logic;
     hdoutp_ch0, hdoutn_ch0   :   out std_logic;
     sci_sel_ch0    :   in std_logic;
-    rxiclk_ch0    :   in std_logic;
     txiclk_ch0    :   in std_logic;
     rx_full_clk_ch0   :   out std_logic;
     rx_half_clk_ch0   :   out std_logic;
@@ -2199,7 +2198,7 @@ port map  (
   PCIE_PHYSTATUS_0 => open,
   SCISELCH0 => sci_sel_ch0,
   SCIENCH0 => fpsc_vhi,
-  FF_RXI_CLK_0 => rxiclk_ch0,
+  FF_RXI_CLK_0 => fpsc_vlo,
   FF_TXI_CLK_0 => txiclk_ch0,
   FF_EBRD_CLK_0 => fpsc_vlo,
   FF_RX_F_CLK_0 => rx_full_clk_ch0,
index 1e5e015b679c91247f6902fb7a9e6bfff08b8157..0148d226bdb8c6738ee2a90d04e0aacf801d036d 100644 (file)
@@ -1,11 +1,11 @@
 <?xml version="1.0" encoding="UTF-8"?>
-<DiamondModule name="serdes_sync_upstream" module="serdes_sync_upstream" VendorName="Lattice Semiconductor Corporation" generator="IPexpress" date="2013 09 11 07:50:28.463" version="8.1" type="Module" synthesis="synplify" source_format="VHDL">
+<DiamondModule name="serdes_sync_upstream" module="serdes_sync_upstream" VendorName="Lattice Semiconductor Corporation" generator="IPexpress" date="2013 10 02 09:44:25.936" version="8.1" type="Module" synthesis="synplify" source_format="VHDL">
   <Package>
-               <File name="serdes_sync_upstream.lpc" type="lpc" modified="2013 09 11 07:50:24.000"/>
-               <File name="serdes_sync_upstream.pp" type="pp" modified="2013 09 11 07:50:24.000"/>
-               <File name="serdes_sync_upstream.sym" type="sym" modified="2013 09 11 07:50:24.000"/>
-               <File name="serdes_sync_upstream.tft" type="tft" modified="2013 09 11 07:50:24.000"/>
-               <File name="serdes_sync_upstream.txt" type="pcs_module" modified="2013 09 11 07:50:24.000"/>
-               <File name="serdes_sync_upstream.vhd" type="top_level_vhdl" modified="2013 09 11 07:50:24.000"/>
+               <File name="serdes_sync_upstream.lpc" type="lpc" modified="2013 10 02 09:44:23.000"/>
+               <File name="serdes_sync_upstream.pp" type="pp" modified="2013 10 02 09:44:23.000"/>
+               <File name="serdes_sync_upstream.sym" type="sym" modified="2013 10 02 09:44:24.000"/>
+               <File name="serdes_sync_upstream.tft" type="tft" modified="2013 10 02 09:44:23.000"/>
+               <File name="serdes_sync_upstream.txt" type="pcs_module" modified="2013 10 02 09:44:23.000"/>
+               <File name="serdes_sync_upstream.vhd" type="top_level_vhdl" modified="2013 10 02 09:44:23.000"/>
   </Package>
 </DiamondModule>
index 0ea1ddd55cc50a260b459d68cc57b70ca04d64bc..6abc82d9f14640918d620ae75b82feb4aa180203 100644 (file)
@@ -16,8 +16,8 @@ CoreRevision=8.1
 ModuleName=serdes_sync_upstream
 SourceFormat=VHDL
 ParameterFileVersion=1.0
-Date=09/11/2013
-Time=07:50:24
+Date=10/02/2013
+Time=09:44:23
 
 [Parameters]
 Verilog=0
index 1c55bd727e250ff3bb7b2528a3cd5bb4c41765cc..5883a95e2e44cdd0ad983bcb600cf9ccf73b7283 100644 (file)
@@ -52,7 +52,7 @@ CCLMARK                 "7"
 CH0_SSLB                "DISABLED"
 CH0_SPLBPORTS           "DISABLED"
 CH0_PCSLBPORTS          "DISABLED"
-INT_ALL                 "DISABLED"
+INT_ALL                 "ENABLED"
 QD_REFCK2CORE           "DISABLED"
 
 
index 658a53f6915abd3db23b470ac13adf6ee38796f7..0f1269fc97ed63f268ea788112008fc841238a47 100644 (file)
@@ -12,7 +12,7 @@ use work.soda_components.all;
 \r
 entity soda_calibration_timer is\r
        port(\r
-               SYSCLK                                          : in    std_logic; -- fabric clock\r
+               SODACLK                                         : in    std_logic; -- fabric clock\r
                RESET                                                   : in    std_logic; -- synchronous reset\r
                CLEAR                                                   : in    std_logic; -- asynchronous reset\r
                CLK_EN                                          : in    std_logic; \r
@@ -31,9 +31,9 @@ architecture Behavioral of soda_calibration_timer is
 \r
 begin\r
 \r
-       packet_fsm_proc : process(SYSCLK)--, RESET, packet_state_S, crc_valid_S, START_OF_SUPERBURST, soda_cmd_strobe_S)\r
+       packet_fsm_proc : process(SODACLK)--, RESET, packet_state_S, crc_valid_S, START_OF_SUPERBURST, soda_cmd_strobe_S)\r
        begin\r
-               if rising_edge(SYSCLK) then\r
+               if rising_edge(SODACLK) then\r
                        if (RESET='1') then
                                CALIB_VALID_OUT                                 <= '0';\r
                                CALIB_TIME_OUT                                          <= (others => '0');
index a378d25396a7c48d48a8aea084f9197b6bc3d2b9..35decf067a033d9264e7a792fc06808dab127cbf 100644 (file)
@@ -9,6 +9,8 @@ use work.trb_net16_hub_func.all;
 
 package soda_components is
 
+       constant        c_NOT_IN_SYNC                   : std_logic     := '1';
+       constant        c_IN_SYNC                               : std_logic     := '0';
        constant        c_HUB_CHILDREN                  : natural range 1 to 4 := 2;
        type            t_HUB_DLM                               is array(c_HUB_CHILDREN-1 downto 0) of std_logic;\r
        type            t_HUB_DLM_WORD                  is array(c_HUB_CHILDREN-1 downto 0) of std_logic_vector(7 downto 0);
@@ -42,7 +44,7 @@ package soda_components is
                        CLEAR                                                   : in    std_logic; -- asynchronous reset
                        CLK_EN                                          : in    std_logic;
                        --Internal Connection
-                       LINK_PHASE_IN                           : in    std_logic_vector(1 downto 0) := (others => '0');
+                       LINK_PHASE_IN                           : in    std_logic := '0';
                        SODA_CMD_STROBE_IN              : in    std_logic := '0';       -- 
                        START_OF_SUPERBURST             : in    std_logic := '0';
                        SUPER_BURST_NR_IN                       : in    std_logic_vector(30 downto 0) := (others => '0');
@@ -100,6 +102,9 @@ package soda_components is
                        RX_DLM_IN                               : in std_logic;
                        TX_DLM_OUT                              : out   std_logic;
                        TX_DLM_WORD_OUT         : out   std_logic_vector(7 downto 0) := (others => '0');
+                       TX_DLM_INIT_OUT         : out   std_logic       := '0'; --PL!
+                       LINK_PHASE_IN                   : in    std_logic       := '0'; --PL!
+
 
                        SODA_DATA_IN                    : in    std_logic_vector(31 downto 0) := (others => '0');
                        SODA_DATA_OUT                   : out   std_logic_vector(31 downto 0) := (others => '0');
@@ -181,7 +186,7 @@ package soda_components is
 
        component soda_reply_handler
                port(
-                       SYSCLK                                          : in    std_logic; -- fabric clock
+                       SODACLK                                         : in    std_logic; -- fabric clock
                        RESET                                                   : in    std_logic; -- synchronous reset
                        CLEAR                                                   : in    std_logic; -- asynchronous reset
                        CLK_EN                                          : in    std_logic;
@@ -197,7 +202,7 @@ package soda_components is
 
        component soda_calibration_timer\r
                port(\r
-                       SYSCLK                                          : in    std_logic; -- fabric clock\r
+                       SODACLK                                         : in    std_logic; -- fabric clock\r
                        RESET                                                   : in    std_logic; -- synchronous reset\r
                        CLEAR                                                   : in    std_logic; -- asynchronous reset\r
                        CLK_EN                                          : in    std_logic; \r
@@ -257,59 +262,59 @@ package soda_components is
        end component;
        
 component med_ecp3_sfp_sync_down is
-  generic(
-    SERDES_NUM : integer range 0 to 3 := 0;
---     MASTER_CLOCK_SWITCH : integer := c_NO;   --just for debugging, should be NO
-    IS_SYNC_SLAVE   : integer := c_NO       --select slave mode
-    );
-  port(
-    CLK                : in  std_logic; -- _internal_ 200 MHz reference clock
-    SYSCLK             : in  std_logic; -- 100 MHz main clock net, synchronous to RX clock
-    RESET              : in  std_logic; -- synchronous reset
-    CLEAR              : in  std_logic; -- asynchronous reset
-    --Internal Connection TX
-    MED_DATA_IN        : in  std_logic_vector(c_DATA_WIDTH-1 downto 0);
-    MED_PACKET_NUM_IN  : in  std_logic_vector(c_NUM_WIDTH-1 downto 0);
-    MED_DATAREADY_IN   : in  std_logic;
-    MED_READ_OUT       : out std_logic := '0';
-    --Internal Connection RX
-    MED_DATA_OUT       : out std_logic_vector(c_DATA_WIDTH-1 downto 0) := (others => '0');
-    MED_PACKET_NUM_OUT : out std_logic_vector(c_NUM_WIDTH-1 downto 0) := (others => '0');
-    MED_DATAREADY_OUT  : out std_logic := '0';
-    MED_READ_IN        : in  std_logic;
-    CLK_RX_HALF_OUT    : out std_logic := '0';  --received 100 MHz
-    CLK_RX_FULL_OUT    : out std_logic := '0';  --received 200 MHz
-    
-    --Sync operation
-    RX_DLM             : out std_logic := '0';
-    RX_DLM_WORD        : out std_logic_vector(7 downto 0) := x"00";
-    TX_DLM             : in  std_logic := '0';
-    TX_DLM_WORD        : in  std_logic_vector(7 downto 0) := x"00";
-    
-    --SFP Connection
-    SD_RXD_P_IN        : in  std_logic;
-    SD_RXD_N_IN        : in  std_logic;
-    SD_TXD_P_OUT       : out std_logic;
-    SD_TXD_N_OUT       : out std_logic;
-    SD_REFCLK_P_IN     : in  std_logic;  --not used
-    SD_REFCLK_N_IN     : in  std_logic;  --not used
-    SD_PRSNT_N_IN      : in  std_logic;  -- SFP Present ('0' = SFP in place, '1' = no SFP mounted)
-    SD_LOS_IN          : in  std_logic;  -- SFP Loss Of Signal ('0' = OK, '1' = no signal)
-    SD_TXDIS_OUT       : out  std_logic := '0'; -- SFP disable
-    --Control Interface
-    SCI_DATA_IN        : in  std_logic_vector(7 downto 0) := (others => '0');
-    SCI_DATA_OUT       : out std_logic_vector(7 downto 0) := (others => '0');
-    SCI_ADDR           : in  std_logic_vector(8 downto 0) := (others => '0');
-    SCI_READ           : in  std_logic := '0';
-    SCI_WRITE          : in  std_logic := '0';
-    SCI_ACK            : out std_logic := '0';
-    SCI_NACK           : out std_logic := '0';
-    -- Status and control port
-    STAT_OP            : out std_logic_vector (15 downto 0);
-    CTRL_OP            : in  std_logic_vector (15 downto 0) := (others => '0');
-    STAT_DEBUG         : out std_logic_vector (63 downto 0);
-    CTRL_DEBUG         : in  std_logic_vector (63 downto 0) := (others => '0')
-   );
+       generic(
+               SERDES_NUM                              : integer range 0 to 3 := 0;
+               IS_SYNC_SLAVE                   : integer := c_NO);       --select slave mode
+       port(
+               CLK                : in  std_logic; -- _internal_ 200 MHz reference clock
+               SYSCLK             : in  std_logic; -- 100 MHz main clock net, synchronous to RX clock
+               RESET              : in  std_logic; -- synchronous reset
+               CLEAR              : in  std_logic; -- asynchronous reset
+               --Internal Connection TX
+               MED_DATA_IN        : in  std_logic_vector(c_DATA_WIDTH-1 downto 0);
+               MED_PACKET_NUM_IN  : in  std_logic_vector(c_NUM_WIDTH-1 downto 0);
+               MED_DATAREADY_IN   : in  std_logic;
+               MED_READ_OUT       : out std_logic := '0';
+               --Internal Connection RX
+               MED_DATA_OUT       : out std_logic_vector(c_DATA_WIDTH-1 downto 0) := (others => '0');
+               MED_PACKET_NUM_OUT : out std_logic_vector(c_NUM_WIDTH-1 downto 0) := (others => '0');
+               MED_DATAREADY_OUT  : out std_logic := '0';
+               MED_READ_IN        : in  std_logic;
+               CLK_RX_HALF_OUT    : out std_logic := '0';  --received 100 MHz
+               CLK_RX_FULL_OUT    : out std_logic := '0';  --received 200 MHz
+
+               --Sync operation
+               RX_DLM             : out std_logic := '0';
+               RX_DLM_WORD        : out std_logic_vector(7 downto 0) := x"00";
+               TX_DLM             : in  std_logic := '0';
+               TX_DLM_WORD        : in  std_logic_vector(7 downto 0) := x"00";\r
+               TX_DLM_INIT                             : in  std_logic := '0'; --PL!\r
+               LINK_PHASE_OUT                  : out std_logic := '0'; --PL!
+
+               --SFP Connection
+               SD_RXD_P_IN        : in  std_logic;
+               SD_RXD_N_IN        : in  std_logic;
+               SD_TXD_P_OUT       : out std_logic;
+               SD_TXD_N_OUT       : out std_logic;
+               SD_REFCLK_P_IN     : in  std_logic;  --not used
+               SD_REFCLK_N_IN     : in  std_logic;  --not used
+               SD_PRSNT_N_IN      : in  std_logic;  -- SFP Present ('0' = SFP in place, '1' = no SFP mounted)
+               SD_LOS_IN          : in  std_logic;  -- SFP Loss Of Signal ('0' = OK, '1' = no signal)
+               SD_TXDIS_OUT       : out  std_logic := '0'; -- SFP disable
+               --Control Interface
+               SCI_DATA_IN        : in  std_logic_vector(7 downto 0) := (others => '0');
+               SCI_DATA_OUT       : out std_logic_vector(7 downto 0) := (others => '0');
+               SCI_ADDR           : in  std_logic_vector(8 downto 0) := (others => '0');
+               SCI_READ           : in  std_logic := '0';
+               SCI_WRITE          : in  std_logic := '0';
+               SCI_ACK            : out std_logic := '0';
+               SCI_NACK           : out std_logic := '0';
+               -- Status and control port
+               STAT_OP            : out std_logic_vector (15 downto 0);
+               CTRL_OP            : in  std_logic_vector (15 downto 0) := (others => '0');
+               STAT_DEBUG         : out std_logic_vector (63 downto 0);
+               CTRL_DEBUG         : in  std_logic_vector (63 downto 0) := (others => '0')
+       );
 end component;
 
 component med_ecp3_sfp_sync_up is
@@ -341,7 +346,7 @@ component med_ecp3_sfp_sync_up is
     RX_DLM_WORD        : out std_logic_vector(7 downto 0) := x"00";
     TX_DLM             : in  std_logic := '0';
     TX_DLM_WORD        : in  std_logic_vector(7 downto 0) := x"00";
-    
+
     --SFP Connection
     SD_RXD_P_IN        : in  std_logic;
     SD_RXD_N_IN        : in  std_logic;
@@ -368,4 +373,38 @@ component med_ecp3_sfp_sync_up is
    );
 end component;
 \r
+component soda_tx_control
+  port(
+    CLK_200                                                                    : in  std_logic;
+    CLK_100                                                                    : in  std_logic;
+    RESET_IN                                                           : in  std_logic;
+
+    TX_DATA_IN                                                         : in  std_logic_vector(15 downto 0);
+    TX_PACKET_NUMBER_IN                                        : in  std_logic_vector(2 downto 0);
+    TX_WRITE_IN                                                        : in  std_logic;
+    TX_READ_OUT                                                        : out std_logic;
+
+    TX_DATA_OUT                                                        : out std_logic_vector( 7 downto 0);
+    TX_K_OUT                                                           : out std_logic;
+
+    REQUEST_RETRANSMIT_IN                              : in  std_logic := '0';
+    REQUEST_POSITION_IN                                        : in  std_logic_vector( 7 downto 0) := (others => '0');
+
+    START_RETRANSMIT_IN                                        : in  std_logic := '0';
+    START_POSITION_IN                                  : in  std_logic_vector( 7 downto 0) := (others => '0');
+    --send_dlm: 200 MHz, 1 clock strobe, data valid until next DLM
+    TX_DLM_INIT                                                        : in  std_logic := '0';
+    SEND_DLM                                                           : in  std_logic := '0';
+    SEND_DLM_WORD                                                      : in  std_logic_vector( 7 downto 0) := (others => '0');
+    
+    SEND_LINK_RESET_IN                                 : in  std_logic := '0';
+    TX_ALLOW_IN                                                        : in  std_logic := '0';
+    RX_ALLOW_IN                                                        : in  std_logic := '0';
+        LINK_PHASE_OUT                                         : out std_logic := '0';
+
+    DEBUG_OUT                                                          : out std_logic_vector(31 downto 0);
+    STAT_REG_OUT                                                       : out std_logic_vector(31 downto 0)
+    );
+end component;\r
+\r
 end package;
index 3f68c1e335a9916a94c68e75c917cdaf75996616..81ff2fcbf5a11c73a570faf80d2500c390ebe20a 100644 (file)
@@ -16,7 +16,7 @@ entity soda_packet_builder is
                CLEAR                                                   : in    std_logic; -- asynchronous reset\r
                CLK_EN                                          : in    std_logic; \r
                --Internal Connection\r
-               LINK_PHASE_IN                           : in    std_logic_vector(1 downto 0) := (others => '0');
+               LINK_PHASE_IN                           : in    std_logic := '0';       --_vector(1 downto 0) := (others => '0');
                SODA_CMD_STROBE_IN              : in    std_logic := '0';       -- \r
                START_OF_SUPERBURST             : in    std_logic := '0';\r
                SUPER_BURST_NR_IN                       : in    std_logic_vector(30 downto 0) := (others => '0');\r
@@ -49,6 +49,7 @@ architecture Behavioral of soda_packet_builder is
                                                                                                        c_WAIT4CMD1, c_CMD1, c_CMD2, c_CMD3, c_CMD4, c_CMD5, c_CMD6, c_CMD7, c_CMD8
                                                                                                );\r
        signal  packet_state_S                          :       packet_state_type := c_IDLE;\r
+       \r
 \r
 begin\r
 \r
@@ -72,7 +73,7 @@ begin
        TX_DLM_OUT                                      <=      soda_pkt_valid_S;\r
        \r
        \r
-       packet_fsm_proc : process(SODACLK)--, RESET, packet_state_S, crc_valid_S, START_OF_SUPERBURST, soda_cmd_strobe_S)\r
+       packet_fsm_proc : process(SODACLK)\r
        begin\r
                if rising_edge(SODACLK) then\r
                        if (RESET='1') then\r
@@ -81,142 +82,173 @@ begin
                                case packet_state_S is\r
                                        when c_IDLE     =>\r
                                                if (START_OF_SUPERBURST='1') then
-                                                       if (LINK_PHASE_IN = "00") then\r
-                                                               packet_state_S  <= c_BST1;
+                                                       if (LINK_PHASE_IN = c_IN_SYNC) then\r
+                                                               packet_state_S          <= c_BST1;
+                                                               soda_pkt_valid_S        <= '1';
+                                                               soda_pkt_word_S <= '1' & super_burst_nr_S(30 downto 24);
                                                        else
-                                                               packet_state_S  <= c_WAIT4BST1;
+                                                               packet_state_S          <= c_WAIT4BST1;
+                                                               soda_pkt_valid_S        <= '0';
                                                        end if;\r
                                                elsif (soda_cmd_strobe_S='1') then\r
-                                                       if (LINK_PHASE_IN = "00") then\r
-                                                               packet_state_S  <= c_CMD1;\r
+                                                       if (LINK_PHASE_IN = c_IN_SYNC) then\r
+                                                               packet_state_S          <= c_CMD1;\r
+                                                               soda_pkt_valid_S        <= '1';
+                                                               soda_pkt_word_S <= '0' & soda_cmd_word_S(30 downto 24);
                                                        else
-                                                               packet_state_S  <= c_WAIT4CMD1;
+                                                               packet_state_S          <= c_WAIT4CMD1;
+                                                               soda_pkt_valid_S        <= '0';\r
                                                        end if;\r
                                                else
                                                        packet_state_S  <=      c_IDLE;
+                                                       TIME_CAL_OUT                    <= '0';
+                                                       soda_pkt_valid_S                <= '0';
+                                                       soda_pkt_word_S         <= (others=>'0');
                                                end if;\r
                                        when c_WAIT4BST1        =>\r
-                                               if (LINK_PHASE_IN = "00") then\r
-                                                       packet_state_S  <= c_BST1;
-                                               else
-                                                       packet_state_S  <= c_WAIT4BST1;
-                                               end if;\r
+                                               packet_state_S  <= c_BST1;
+                                               soda_pkt_valid_S                <= '1';
+                                               soda_pkt_word_S         <= '1' & super_burst_nr_S(30 downto 24);
                                        when c_BST1     =>\r
                                                packet_state_S  <= c_BST2;\r
+                                               soda_pkt_valid_S                <= '0';
                                        when c_BST2     =>\r
                                                packet_state_S  <= c_BST3;\r
+                                               soda_pkt_valid_S                <= '1';
+                                               soda_pkt_word_S         <= super_burst_nr_S(23 downto 16);
                                        when c_BST3     =>\r
                                                packet_state_S  <= c_BST4;\r
+                                               soda_pkt_valid_S                <= '0';
                                        when c_BST4     =>\r
                                                packet_state_S  <= c_BST5;\r
+                                               soda_pkt_valid_S                <= '1';
+                                               soda_pkt_word_S         <= super_burst_nr_S(15 downto 8);
                                        when c_BST5     =>\r
                                                packet_state_S  <= c_BST6;\r
+                                               soda_pkt_valid_S                <= '0';
                                        when c_BST6     =>\r
                                                packet_state_S  <= c_BST7;\r
+                                               soda_pkt_valid_S                <= '1';
+                                               soda_pkt_word_S         <= super_burst_nr_S(7 downto 0);
                                        when c_BST7     =>\r
                                                packet_state_S  <= c_BST8;\r
+                                               soda_pkt_valid_S                <= '0';
                                        when c_BST8     =>\r
                                                if (soda_cmd_strobe_S='0') then\r
                                                        packet_state_S  <= c_IDLE;\r
                                                else\r
                                                        packet_state_S  <= c_CMD1;\r
                                                end if;\r
+                                               soda_pkt_valid_S                <= '0';
+                                               soda_pkt_word_S         <= (others=>'0');
                                        when c_WAIT4CMD1        =>\r
-                                               if (LINK_PHASE_IN = "00") then
-                                                       packet_state_S  <= c_CMD1;\r
-                                               else
-                                                       packet_state_S  <= c_WAIT4CMD1;
-                                               end if;\r
+                                               packet_state_S  <= c_CMD1;\r
+                                               soda_pkt_valid_S                <= '1';
+                                               soda_pkt_word_S         <= '0' & soda_cmd_word_S(30 downto 24);
                                        when c_CMD1     =>\r
-                                                       packet_state_S  <= c_CMD2;\r
+                                               packet_state_S  <= c_CMD2;\r
+                                               soda_pkt_valid_S                <= '0';
                                        when c_CMD2     =>\r
-                                                       packet_state_S  <= c_CMD3;\r
+                                               packet_state_S  <= c_CMD3;\r
+                                               soda_pkt_valid_S                <= '1';
+                                               soda_pkt_word_S         <= soda_cmd_word_S(23 downto 16);
                                        when c_CMD3     =>\r
-                                                       packet_state_S  <= c_CMD4;\r
+                                               packet_state_S  <= c_CMD4;\r
+                                               soda_pkt_valid_S                <= '0';
                                        when c_CMD4     =>\r
-                                                       packet_state_S  <= c_CMD5;\r
+                                               packet_state_S  <= c_CMD5;\r
+                                               soda_pkt_valid_S                <= '1';
+                                               soda_pkt_word_S         <= soda_cmd_word_S(15 downto 8);
                                        when c_CMD5     =>\r
-                                                       packet_state_S  <= c_CMD6;\r
+                                               packet_state_S  <= c_CMD6;\r
+                                               soda_pkt_valid_S                <= '0';
                                        when c_CMD6     =>\r
-                                                       packet_state_S  <= c_CMD7;\r
+                                               packet_state_S  <= c_CMD7;\r
+                                               soda_pkt_valid_S                <= '1';
+                                               soda_pkt_word_S         <= soda_cmd_word_S(7 downto 0);
                                        when c_CMD7     =>\r
                                                if (crc_valid_S = '0') then
                                                        packet_state_S  <= c_ERROR;\r
                                                else
                                                        packet_state_S  <= c_CMD8;\r
                                                end if;\r
+                                               soda_pkt_valid_S                <= '0';
                                        when c_CMD8     =>
                                                packet_state_S          <= c_IDLE;\r
+                                               soda_pkt_valid_S                <= '0';
+                                               soda_pkt_word_S         <= (others=>'0');
                                        when c_ERROR    =>
                                                packet_state_S          <= c_IDLE;\r
+                                               soda_pkt_valid_S                <= '0';
                                        when others     =>\r
                                                packet_state_S          <= c_IDLE;\r
+                                               soda_pkt_valid_S                <= '0';
                                end case;\r
                        end if;\r
                end if;\r
        end process;\r
 \r
-       soda_packet_fill_proc : process(SODACLK, packet_state_S)\r
-       begin\r
-               if rising_edge(SODACLK) then\r
-                       case packet_state_S is\r
-                                       when c_IDLE     =>\r
-                                               TIME_CAL_OUT                    <= '0';\r
-                                               soda_pkt_valid_S                <= '0';\r
-                                               soda_pkt_word_S         <= (others=>'0');\r
-                                       when c_WAIT4BST1        =>              -- no need to do anything just yet.\r
-                                       when c_BST1     =>\r
-                                               soda_pkt_valid_S                <= '1';\r
-                                               soda_pkt_word_S         <= '1' & super_burst_nr_S(30 downto 24);\r
-                                       when c_BST2     =>\r
-                                               soda_pkt_valid_S                <= '0';\r
-                                       when c_BST3     =>\r
-                                               soda_pkt_valid_S                <= '1';\r
-                                               soda_pkt_word_S         <= super_burst_nr_S(23 downto 16);\r
-                                       when c_BST4     =>\r
-                                               soda_pkt_valid_S                <= '0';\r
-                                       when c_BST5     =>\r
-                                               soda_pkt_valid_S                <= '1';\r
-                                               soda_pkt_word_S         <= super_burst_nr_S(15 downto 8);\r
-                                       when c_BST6     =>\r
-                                               soda_pkt_valid_S                <= '0';\r
-                                       when c_BST7     =>\r
-                                               soda_pkt_valid_S                <= '1';\r
-                                               soda_pkt_word_S         <= super_burst_nr_S(7 downto 0);\r
-                                               EXPECTED_REPLY_OUT      <= super_burst_nr_S(7 downto 0);\r
-                                       when c_BST8     =>\r
-                                               soda_pkt_valid_S                <= '0';\r
-                                       when c_WAIT4CMD1        =>              -- no need to do anything just yet.\r
-                                       when c_CMD1     =>\r
-                                               soda_pkt_valid_S                <= '1';\r
-                                               soda_pkt_word_S         <= '0' & soda_cmd_word_S(30 downto 24);\r
-                                       when c_CMD2     =>\r
-                                               soda_pkt_valid_S                <= '0';\r
-                                       when c_CMD3     =>\r
-                                               soda_pkt_valid_S                <= '1';\r
-                                               soda_pkt_word_S         <= soda_cmd_word_S(23 downto 16);\r
-                                       when c_CMD4     =>\r
-                                               soda_pkt_valid_S                <= '0';\r
-                                       when c_CMD5     =>\r
-                                               soda_pkt_valid_S                <= '1';\r
-                                               soda_pkt_word_S         <= soda_cmd_word_S(15 downto 8);\r
-                                       when c_CMD6     =>\r
-                                               soda_pkt_valid_S                <= '0';\r
-                                       when c_CMD7     =>\r
-                                               soda_pkt_valid_S                <= '1';\r
-                                               soda_pkt_word_S         <= crc_out_S;
-                                               EXPECTED_REPLY_OUT      <= crc_out_S;
-                                               TIME_CAL_OUT                    <= '1';\r
-                                       when c_CMD8     =>
-                                               TIME_CAL_OUT                    <= '0';\r
-                                               soda_pkt_valid_S                <= '0';\r
-                                       when others     =>\r
-                                               TIME_CAL_OUT                    <= '0';\r
-                                               soda_pkt_valid_S                <= '0';\r
-                                               soda_pkt_word_S         <= (others=>'0');\r
-                       end case;               \r
-               end if;\r
-       end process;\r
+       --soda_packet_fill_proc : process(SODACLK, packet_state_S)\r
+       --begin\r
+               --if rising_edge(SODACLK) then\r
+                       --case packet_state_S is\r
+                                       --when c_IDLE   =>\r
+                                               --TIME_CAL_OUT                  <= '0';\r
+                                               --soda_pkt_valid_S              <= '0';\r
+                                               --soda_pkt_word_S               <= (others=>'0');\r
+                                       --when c_WAIT4BST1      =>              -- no need to do anything just yet.\r
+                                       --when c_BST1   =>\r
+                                               --soda_pkt_valid_S              <= '1';\r
+                                               --soda_pkt_word_S               <= '1' & super_burst_nr_S(30 downto 24);\r
+                                       --when c_BST2   =>\r
+                                               --soda_pkt_valid_S              <= '0';\r
+                                       --when c_BST3   =>\r
+                                               --soda_pkt_valid_S              <= '1';\r
+                                               --soda_pkt_word_S               <= super_burst_nr_S(23 downto 16);\r
+                                       --when c_BST4   =>\r
+                                               --soda_pkt_valid_S              <= '0';\r
+                                       --when c_BST5   =>\r
+                                               --soda_pkt_valid_S              <= '1';\r
+                                               --soda_pkt_word_S               <= super_burst_nr_S(15 downto 8);\r
+                                       --when c_BST6   =>\r
+                                               --soda_pkt_valid_S              <= '0';\r
+                                       --when c_BST7   =>\r
+                                               --soda_pkt_valid_S              <= '1';\r
+                                               --soda_pkt_word_S               <= super_burst_nr_S(7 downto 0);\r
+                                               --EXPECTED_REPLY_OUT    <= super_burst_nr_S(7 downto 0);\r
+                                       --when c_BST8   =>\r
+                                               --soda_pkt_valid_S              <= '0';\r
+                                       --when c_WAIT4CMD1      =>              -- no need to do anything just yet.\r
+                                       --when c_CMD1   =>\r
+                                               --soda_pkt_valid_S              <= '1';\r
+                                               --soda_pkt_word_S               <= '0' & soda_cmd_word_S(30 downto 24);\r
+                                       --when c_CMD2   =>\r
+                                               --soda_pkt_valid_S              <= '0';\r
+                                       --when c_CMD3   =>\r
+                                               --soda_pkt_valid_S              <= '1';\r
+                                               --soda_pkt_word_S               <= soda_cmd_word_S(23 downto 16);\r
+                                       --when c_CMD4   =>\r
+                                               --soda_pkt_valid_S              <= '0';\r
+                                       --when c_CMD5   =>\r
+                                               --soda_pkt_valid_S              <= '1';\r
+                                               --soda_pkt_word_S               <= soda_cmd_word_S(15 downto 8);\r
+                                       --when c_CMD6   =>\r
+                                               --soda_pkt_valid_S              <= '0';\r
+                                       --when c_CMD7   =>\r
+                                               --soda_pkt_valid_S              <= '1';\r
+                                               --soda_pkt_word_S               <= crc_out_S;
+                                               --EXPECTED_REPLY_OUT    <= crc_out_S;
+                                               --TIME_CAL_OUT                  <= '1';\r
+                                       --when c_CMD8   =>
+                                               --TIME_CAL_OUT                  <= '0';\r
+                                               --soda_pkt_valid_S              <= '0';\r
+                                       --when others   =>\r
+                                               --TIME_CAL_OUT                  <= '0';\r
+                                               --soda_pkt_valid_S              <= '0';\r
+                                               --soda_pkt_word_S               <= (others=>'0');\r
+                       --end case;             \r
+               --end if;\r
+       --end process;\r
 \r
 \r
        crc_gen_proc : process(SODACLK, packet_state_S)\r
index 3c341ae93f7ff2ad7473e1912979c153cdf6e477..5324d9046531b8b35bbabff7dbb25f940d48e026 100644 (file)
@@ -10,7 +10,7 @@ use work.soda_components.all;
 
 entity soda_reply_handler is
        port(
-               SYSCLK                                          : in    std_logic; -- fabric clock
+               SODACLK                                         : in    std_logic; -- fabric clock
                RESET                                                   : in    std_logic; -- synchronous reset
                CLEAR                                                   : in    std_logic; -- asynchronous reset
                CLK_EN                                          : in    std_logic;
@@ -30,9 +30,9 @@ architecture Behavioral of soda_reply_handler is
 
 begin
 
-       reply_fsm_proc : process(SYSCLK)
+       reply_fsm_proc : process(SODACLK)
        begin
-               if rising_edge(SYSCLK) then\r
+               if rising_edge(SODACLK) then\r
                        if (RESET='1') then
                                REPLY_VALID_OUT <= '0';
                                REPLY_OK_OUT            <= '0';
index ded23a014f9396375b57c14bdb1ad0eba213c054..0bc1705b3008d9bb1277d54b9ad121497377b3dd 100644 (file)
@@ -20,9 +20,11 @@ entity soda_source is
                SODA_BURST_PULSE_IN     : in    std_logic := '0';       -- 
 
                RX_DLM_WORD_IN                  : in    std_logic_vector(7 downto 0) := (others => '0');
-               RX_DLM_IN                               : in std_logic;
+               RX_DLM_IN                               : in    std_logic;
                TX_DLM_OUT                              : out   std_logic;
-               TX_DLM_WORD_OUT         : out   std_logic_vector(7 downto 0) := (others => '0');
+               TX_DLM_WORD_OUT         : out   std_logic_vector(7 downto 0) := (others => '0');\r
+               TX_DLM_INIT_OUT         : out   std_logic       := '0'; --PL!
+               LINK_PHASE_IN                   : in    std_logic       := '0'; --PL!
 
                SODA_DATA_IN                    : in    std_logic_vector(31 downto 0) := (others => '0');
                SODA_DATA_OUT                   : out   std_logic_vector(31 downto 0) := (others => '0');
@@ -37,7 +39,6 @@ end soda_source;
 architecture Behavioral of soda_source is
 
        --SODA
-       signal link_phase_S                                     : std_logic_vector(1 downto 0) := (others => '0');
        signal soda_cmd_word_S                          : std_logic_vector(30 downto 0) := (others => '0');
        signal soda_cmd_strobe_S                        : std_logic := '0';
        signal soda_cmd_strobe_sodaclk_S        : std_logic := '0';     
@@ -93,7 +94,7 @@ begin
                        CLEAR                                           =>      '0',
                        CLK_EN                                  => CLK_EN,
                        --Internal Connection
-                       LINK_PHASE_IN                   =>      link_phase_S,
+                       LINK_PHASE_IN                   =>      LINK_PHASE_IN,          --link_phase_S, PL!
                        SODA_CMD_STROBE_IN      => soda_cmd_strobe_sodaclk_S,
                        START_OF_SUPERBURST     => start_of_superburst_S,
                        SUPER_BURST_NR_IN               => super_burst_nr_S,
@@ -106,7 +107,7 @@ begin
 
        src_reply_handler : soda_reply_handler
                port map(
-                       SYSCLK                                          =>      SODACLK,
+                       SODACLK                                         =>      SODACLK,
                        RESET                                                   => RESET,
                        CLEAR                                                   =>      '0',
                        CLK_EN                                          =>      '1',
@@ -120,7 +121,7 @@ begin
 
        src_calibration_timer : soda_calibration_timer
                port map(
-                       SYSCLK                                          =>      SODACLK,
+                       SODACLK                                         =>      SODACLK,
                        RESET                                                   => RESET,
                        CLEAR                                                   =>      '0',
                        CLK_EN                                          =>      '1',
@@ -141,21 +142,44 @@ begin
                        end if;
                end if;
        end process;
+\r
+\r
+\r
 -----------------------------------------------------------
---     Phase fsm for 16-bit transmissions                                                      --
+--     TX_DLM_INIT for media-interface transmissions                   --
 -----------------------------------------------------------
-       phase_fsm_proc : process(SODACLK)
-       begin
-               if rising_edge(SODACLK) then
-                       if( RESET = '1' ) then
-                               link_phase_S    <= (0 => '1', others => '0');
-                       elsif (link_phase_S < 1) then
-                               link_phase_S    <= link_phase_S + 1;
-                       else
-                               link_phase_S <= (others => '0');
-                       end if;
-               end if;
+       tx_dlm_init_proc : process (SODACLK, start_of_superburst_S, soda_cmd_strobe_S)\r
+       begin\r
+               if( RESET = '1' ) then \r
+                       TX_DLM_INIT_OUT <= '0';\r
+               elsif ((start_of_superburst_S='1' or soda_cmd_strobe_S='1') and LINK_PHASE_IN=c_IN_SYNC) then\r
+                       TX_DLM_INIT_OUT <=      '1';\r
+               elsif rising_edge(SODACLK) then\r
+                       if (start_of_superburst_S='1' or soda_cmd_strobe_S='1') then
+                               TX_DLM_INIT_OUT <=      '1';\r
+                       else\r
+                               TX_DLM_INIT_OUT <=      '0';
+                       end if;\r
+               end if;\r
        end process;
+\r
+       \r
+\r
+-----------------------------------------------------------
+--     Phase fsm for 16-bit transmissions                                                      --
+-----------------------------------------------------------
+--     phase_fsm_proc : process(SODACLK)
+--     begin
+--             if rising_edge(SODACLK) then
+--                     if( RESET = '1' ) then
+--                             link_phase_S    <= '0';         --      (0 => '1', others => '0');
+--                     elsif (link_phase_S='0') then
+--                             link_phase_S    <= '1';
+--                     else
+--                             link_phase_S    <= '0'; --(others => '0');
+--                     end if;
+--             end if;
+--     end process;
 
 ---------------------------------------------------------
 -- RegIO Statemachine
index d6c282f7e3ee5bbac4530c59e550be086bb3fab7..2d3d483c8399fd8e5194242f953823c6262faafb 100644 (file)
@@ -576,14 +576,14 @@ THE_SYNC_LINK : med_ecp3_sfp_sync_up
 ---------------------------------------------------------------------------
 -- LED
 ---------------------------------------------------------------------------
---     LED_ORANGE <= not reset_i when rising_edge(clk_sys_internal);
---     LED_YELLOW <= '1';
---     LED_GREEN  <= not med_stat_op(9);
---     LED_RED    <= not (med_stat_op(10) or med_stat_op(11));
-       LED_ORANGE <= soda_leds(0);
-       LED_YELLOW <= soda_leds(1);
-       LED_GREEN  <= soda_leds(2);
-       LED_RED    <= soda_leds(3);
+       LED_ORANGE <= not reset_i when rising_edge(clk_sys_internal);
+       LED_YELLOW <= soda_leds(0);     --'1';
+       LED_GREEN  <= not med_stat_op(9);
+       LED_RED    <= not (med_stat_op(10) or med_stat_op(11));
+--     LED_ORANGE <= soda_leds(0);
+--     LED_YELLOW <= soda_leds(1);
+--     LED_GREEN  <= soda_leds(2);
+--     LED_RED    <= soda_leds(3);
 
 ---------------------------------------------------------------------------
 -- DEBUG\r
index ab2a5893237630daca6367c6b3c9a5e265237971..e5795f5008b1b0b22d4ce519af1b428190949243 100644 (file)
@@ -196,13 +196,13 @@ architecture trb3_periph_sodasource_arch of trb3_periph_sodasource is
 
        --SODA
        signal soda_ack      : std_logic;
---     signal soda_nack     : std_logic;
        signal soda_write    : std_logic;
        signal soda_read     : std_logic;
        signal soda_data_in  : std_logic_vector(31 downto 0);
        signal soda_data_out : std_logic_vector(31 downto 0);
        signal soda_addr     : std_logic_vector(3 downto 0);  
        signal soda_leds     : std_logic_vector(3 downto 0);  
+\r
 
        --TDC
   signal hit_in_i : std_logic_vector(63 downto 0);
@@ -213,6 +213,8 @@ architecture trb3_periph_sodasource_arch of trb3_periph_sodasource is
   signal rx_dlm_i          : std_logic;
   signal tx_dlm_word       : std_logic_vector(7 downto 0);
   signal rx_dlm_word       : std_logic_vector(7 downto 0);
+       signal tx_dlm_init_S                    : std_logic;    --PL!
+       signal link_phase_S                     : std_logic;    --PL!
 
        --SODA
        signal SOB_S                                                    : std_logic := '0';
@@ -537,7 +539,9 @@ THE_SYNC_LINK : med_ecp3_sfp_sync_down
     RX_DLM             => rx_dlm_i,
     RX_DLM_WORD        => rx_dlm_word,
     TX_DLM             => tx_dlm_i,
-    TX_DLM_WORD        => tx_dlm_word,
+    TX_DLM_WORD        => tx_dlm_word,\r
+        TX_DLM_INIT                    => tx_dlm_init_S,                       --PL!\r
+        LINK_PHASE_OUT         =>      link_phase_S,           --PL!
     --SFP Connection
     SD_RXD_P_IN        => SERDES_ADDON_RX(0),
     SD_RXD_N_IN        => SERDES_ADDON_RX(1),
@@ -591,7 +595,8 @@ THE_SODA_SOURCE : soda_source
                RX_DLM_IN                               => rx_dlm_i,
                TX_DLM_OUT                              => tx_dlm_i, 
                TX_DLM_WORD_OUT         => tx_dlm_word,
-
+               TX_DLM_INIT_OUT         => tx_dlm_init_S,
+               LINK_PHASE_IN                   => link_phase_S,
                SODA_DATA_IN                    => soda_data_in,
                SODA_DATA_OUT                   => soda_data_out,
                SODA_ADDR_IN                    => soda_addr,
@@ -606,14 +611,14 @@ THE_SODA_SOURCE : soda_source
 ---------------------------------------------------------------------------
 -- LED
 ---------------------------------------------------------------------------
---     LED_ORANGE <= not reset_i when rising_edge(clk_sys_internal);
---     LED_YELLOW <= '1';
---     LED_GREEN  <= not med_stat_op(9);
---     LED_RED    <= not (med_stat_op(10) or med_stat_op(11));
-       LED_ORANGE <= soda_leds(0);
-       LED_YELLOW <= soda_leds(1);
-       LED_GREEN  <= soda_leds(2);
-       LED_RED    <= soda_leds(3);
+       LED_ORANGE <= not reset_i when rising_edge(clk_sys_internal);
+       LED_YELLOW <= soda_leds(0);     --'1';
+       LED_GREEN  <= not med_stat_op(9);
+       LED_RED    <= not (med_stat_op(10) or med_stat_op(11));
+--     LED_ORANGE <= soda_leds(0);
+--     LED_YELLOW <= soda_leds(1);
+--     LED_GREEN  <= soda_leds(2);
+--     LED_RED    <= soda_leds(3);
 
 ---------------------------------------------------------------------------
 -- Test Connector