]> jspc29.x-matter.uni-frankfurt.de Git - trb3.git/commitdiff
Backup (still got 4ns issue)
authorManuel Penschuck <manuel.penschuck@stud.uni-frankfurt.de>
Tue, 8 Oct 2013 09:18:18 +0000 (11:18 +0200)
committerManuel Penschuck <manuel.penschuck@stud.uni-frankfurt.de>
Tue, 8 Oct 2013 09:18:18 +0000 (11:18 +0200)
base/trb3_periph_cbmnet.lpf
cbmnet/code/cbmnet_phy_ecp3.vhd
cbmnet/code/cbmnet_phy_pkg.vhd
cbmnet/code/cbmnet_phy_tx_gear.vhd
cbmnet/cores/cbmnet_sfp1.txt
cbmnet/trb3_periph_cbmnet.vhd

index 177c22bee0c7fba43581af8b90515c6f7b11bb4a..9fcf5d0dd7693f409266d67d20b63a98679da8e0 100644 (file)
@@ -76,7 +76,7 @@ LOCATE COMP  "TEST_LINE_13"  SITE "C10";
 LOCATE COMP  "TEST_LINE_14"  SITE "H10";
 LOCATE COMP  "TEST_LINE_15"  SITE "H11";
 DEFINE PORT GROUP "TEST_LINE_group" "TEST_LINE*" ;
-IOBUF GROUP "TEST_LINE_group" IO_TYPE=LVCMOS25 PULLMODE=DOWN DRIVE=12;
+IOBUF GROUP "TEST_LINE_group" IO_TYPE=LVCMOS25 PULLMODE=DOWN SLEWRATE=FAST DRIVE=12;
 
 #################################################################
 # Connection to AddOn
index a105c0cc5ac9528101a4838f6f661bbcec45d577..1f902cf5e844b7bc710ac5975469885469d99efb 100644 (file)
@@ -73,10 +73,15 @@ architecture cbmnet_phy_ecp3_arch of cbmnet_phy_ecp3 is
    signal rclk_250_i        : std_logic;  -- recovered word clock
    signal rclk_125_i        : std_logic;  -- rclk_250_i divided by two. aligned s.t. the rising edge corresponds to the lower received word
    signal clk_tx_full_i     : std_logic;  -- 250 MHz clock generated by the serdes's TX-PLL
-   
+
+   signal clk_tx_half_i     : std_logic;  -- 250 MHz clock generated by the serdes's TX-PLL
+  
    signal rst_i               : std_logic;  -- High-active reset driven by external logic
    signal rst_n_i             : std_logic;  -- Low-active version of rst_i
 
+   signal clk_serdes_rx_ref : std_logic;
+   signal clk_serdes_tx_ref : std_logic;
+   
 -- SERDES/PCS 
    -- status
    signal rx_los_low_i  : std_logic;
@@ -188,11 +193,15 @@ begin
    rst_n_i <= not rst_i;
 
    gen_slave_clock : if IS_SYNC_SLAVE = c_YES generate
-      clk_125_i        <= rclk_125_i;
+      clk_125_i         <= rclk_125_i;
+      clk_serdes_rx_ref <= clk_125_local;
+      clk_serdes_tx_ref <= rclk_125_i;
    end generate;
 
    gen_master_clock : if IS_SYNC_SLAVE = c_NO generate
-      clk_125_i        <= clk_125_local;
+      clk_125_i         <= clk_tx_half_i; 
+      clk_serdes_rx_ref <= clk_tx_half_i;
+      clk_serdes_tx_ref <= clk_125_local;
    end generate;
 
    -------------------------------------------------      
@@ -207,16 +216,15 @@ begin
       hdoutn_ch0           => SD_TXD_N_OUT,
       
    -- CLOCKS
-      txiclk_ch0           => clk_125_i,
-      
       rx_full_clk_ch0      => rclk_250_i,
       rx_half_clk_ch0      => open, -- recovered (and correctly aligned) 125 MHz clock is generated by gear
       
       tx_full_clk_ch0      => clk_tx_full_i,
       tx_half_clk_ch0      => open,
       
-      fpga_rxrefclk_ch0    => clk_125_local,
-      fpga_txrefclk        => clk_125_i,
+      fpga_rxrefclk_ch0    => clk_serdes_rx_ref,
+      fpga_txrefclk        => clk_serdes_tx_ref,
+      txiclk_ch0           => clk_tx_full_i,
 
    -- RESETS
       rst_qd_c             => rst_qd_i,
@@ -330,9 +338,13 @@ begin
    
    rx_data_i <= rx_data_from_gear_i when rising_edge(clk_125_local) or (IS_SYNC_SLAVE = c_YES);
    
-   THE_TX_GEAR: CBMNET_PHY_TX_GEAR port map (
+   THE_TX_GEAR: CBMNET_PHY_TX_GEAR
+   generic map (IS_SYNC_SLAVE => IS_SYNC_SLAVE)
+   port map (
       CLK_250_IN  => clk_tx_full_i, -- in std_logic;
       CLK_125_IN  => clk_125_i, -- in std_logic;
+      CLK_125_OUT => clk_tx_half_i,
+      
       RESET_IN    => tx_gear_reset_i, -- in std_logic;
       
       DATA_IN     => tx_data_i, -- in std_logic_vector(17 downto 0)
@@ -341,7 +353,8 @@ begin
    );
    tx_gear_reset_i <= not tx_rst_fsm_ready_i;
    
-   process is begin
+   process is
+   begin
       wait until rising_edge(clk_tx_full_i);
       
       tx_data_debug_state_i <= not tx_data_debug_state_i;
index 6201dc0a8015a38184cedb4a31f16456d9c0a7dc..8c1336bb96ab01cdbf78dbc88fa8296343b08bab 100644 (file)
@@ -71,9 +71,13 @@ package cbmnet_phy_pkg is
    end component;   
    
    component CBMNET_PHY_TX_GEAR is
+      generic (
+         IS_SYNC_SLAVE : integer range 0 to 1 := c_YES
+      );
       port (
          CLK_250_IN  : in std_logic;
          CLK_125_IN  : in std_logic;
+         CLK_125_OUT : out std_logic;
          RESET_IN    : in std_logic;
          
          DATA_IN     : in std_logic_vector(17 downto 0);
index def3e40b887abf02a629fb2d8ec3764ccbd65274..f6d0e46b8b48a8c65b174a2da7b34a04a234e7f6 100644 (file)
@@ -10,10 +10,15 @@ library work;
    use work.cbmnet_phy_pkg.all;
 
 entity CBMNET_PHY_TX_GEAR is
+   generic (
+      IS_SYNC_SLAVE : integer range 0 to 1 := c_YES
+   );
    port (
    -- SERDES PORT
       CLK_250_IN  : in std_logic;
       CLK_125_IN  : in std_logic;
+      CLK_125_OUT : out std_logic;
+      
       RESET_IN    : in std_logic;
       
       DATA_IN     : in std_logic_vector(17 downto 0);
@@ -40,14 +45,16 @@ begin
       
       clk_125_xfer_buf_i <= clk_125_xfer_i;
       clk_125_xfer_del_i <= clk_125_xfer_buf_i;
+      CLK_125_OUT <= '0';
       
       case fsm_i is
          when FSM_WAIT =>
-            if clk_125_xfer_buf_i /= clk_125_xfer_del_i then
+            if clk_125_xfer_buf_i /= clk_125_xfer_del_i or IS_SYNC_SLAVE = c_NO then
                fsm_i <= FSM_HIGH;
             end if;
             
          when FSM_HIGH =>
+            CLK_125_OUT <= '1';
             DATA_OUT   <= data_in_buf125_i(17) & data_in_buf125_i(15 downto 8);
             low_data_i <= data_in_buf125_i(16) & data_in_buf125_i( 7 downto 0);
             fsm_i <= FSM_LOW;
index 68a1af7aaf1b23641f58a5168f4b86a3b7bccf28..d897a9725c1a6150e916de0d2f78da88b8637132 100644 (file)
@@ -19,7 +19,7 @@ CH0_RX_DATA_RATE        "FULL"
 CH0_TX_DATA_RATE        "FULL"
 CH0_TX_DATA_WIDTH       "8"
 CH0_RX_DATA_WIDTH        "8"
-CH0_TX_FIFO       "ENABLED"
+CH0_TX_FIFO       "DISABLED"
 CH0_RX_FIFO        "DISABLED"
 CH0_TDRV      "0"
 #CH0_TX_FICLK_RATE      250.0
index 00fc2ddf9b9134fc52c11e601135e02e56274569..0e99fffb278add7cc63964e9f5eed2e085438c22 100644 (file)
@@ -376,6 +376,8 @@ begin
    );
    cbm_res_n <= not rreset_i;
 
+  -- TEST_LINE <= phy_stat_op;
+   
    TEST_LINE(7 downto 0)   <= phy_stat_debug(7 downto 0);
    TEST_LINE(8)            <= cbm_SERDES_ready;
    TEST_LINE(9)            <= cbm_link_active;