]> jspc29.x-matter.uni-frankfurt.de Git - trb3.git/commitdiff
trb3_gbe
authorhadeshyp <hadeshyp>
Mon, 17 Oct 2011 11:49:24 +0000 (11:49 +0000)
committerhadeshyp <hadeshyp>
Mon, 17 Oct 2011 11:49:24 +0000 (11:49 +0000)
trb3_gbe_test/ipcores/pll.vhd [new file with mode: 0644]
trb3_gbe_test/ipcores/serdes.vhd [new file with mode: 0644]
trb3_gbe_test/ipcores/sgmii33/rate_resolution.v [new file with mode: 0755]
trb3_gbe_test/ipcores/sgmii33/register_interface_hb.v [new file with mode: 0755]
trb3_gbe_test/ipcores/sgmii33/reset_controller_cdr.v [new file with mode: 0755]
trb3_gbe_test/ipcores/sgmii33/reset_controller_pcs.v [new file with mode: 0755]
trb3_gbe_test/ipcores/sgmii33/sgmii_channel_smi.v [new file with mode: 0644]

diff --git a/trb3_gbe_test/ipcores/pll.vhd b/trb3_gbe_test/ipcores/pll.vhd
new file mode 100644 (file)
index 0000000..ae45121
--- /dev/null
@@ -0,0 +1,99 @@
+-- VHDL netlist generated by SCUBA Diamond_1.3_Production (92)
+-- Module  Version: 5.2
+--/opt/lattice/diamond/1.3/ispfpga/bin/lin/scuba -w -n pll -lang vhdl -synth synplify -arch ep5c00 -type pll -fin 125 -phase_cntl STATIC -fclkop 125 -fclkop_tol 0.0 -fb_mode CLOCKTREE -noclkos -noclkok -norst -noclkok2 -e 
+
+-- Thu Oct  6 14:33:29 2011
+
+library IEEE;
+use IEEE.std_logic_1164.all;
+-- synopsys translate_off
+library ecp3;
+use ecp3.components.all;
+-- synopsys translate_on
+
+entity pll is
+    port (
+        CLK: in std_logic; 
+        CLKOP: out std_logic; 
+        LOCK: out std_logic);
+ attribute dont_touch : boolean;
+ attribute dont_touch of pll : entity is true;
+end pll;
+
+architecture Structure of pll is
+
+    -- internal signal declarations
+    signal CLKOP_t: std_logic;
+    signal scuba_vlo: std_logic;
+
+    -- local component declarations
+    component EHXPLLF
+        generic (FEEDBK_PATH : in String; CLKOK_INPUT : in String; 
+                DELAY_PWD : in String; DELAY_VAL : in Integer; 
+                CLKOS_TRIM_DELAY : in Integer; 
+                CLKOS_TRIM_POL : in String; 
+                CLKOP_TRIM_DELAY : in Integer; 
+                CLKOP_TRIM_POL : in String; CLKOK_BYPASS : in String; 
+                CLKOS_BYPASS : in String; CLKOP_BYPASS : in String; 
+                PHASE_DELAY_CNTL : in String; DUTY : in Integer; 
+                PHASEADJ : in String; CLKOK_DIV : in Integer; 
+                CLKOP_DIV : in Integer; CLKFB_DIV : in Integer; 
+                CLKI_DIV : in Integer; FIN : in String);
+        port (CLKI: in std_logic; CLKFB: in std_logic; RST: in std_logic; 
+            RSTK: in std_logic; WRDEL: in std_logic; DRPAI3: in std_logic; 
+            DRPAI2: in std_logic; DRPAI1: in std_logic; DRPAI0: in std_logic; 
+            DFPAI3: in std_logic; DFPAI2: in std_logic; DFPAI1: in std_logic; 
+            DFPAI0: in std_logic; FDA3: in std_logic; FDA2: in std_logic; 
+            FDA1: in std_logic; FDA0: in std_logic; CLKOP: out std_logic; 
+            CLKOS: out std_logic; CLKOK: out std_logic; CLKOK2: out std_logic; 
+            LOCK: out std_logic; CLKINTFB: out std_logic);
+    end component;
+    component VLO
+        port (Z: out std_logic);
+    end component;
+    attribute FREQUENCY_PIN_CLKOP : string; 
+    attribute FREQUENCY_PIN_CLKI : string; 
+    attribute FREQUENCY_PIN_CLKOK : string; 
+    attribute FREQUENCY_PIN_CLKOP of PLLInst_0 : label is "125.000000";
+    attribute FREQUENCY_PIN_CLKI of PLLInst_0 : label is "125.000000";
+    attribute FREQUENCY_PIN_CLKOK of PLLInst_0 : label is "50.000000";
+    attribute syn_keep : boolean;
+    attribute syn_noprune : boolean;
+    attribute syn_noprune of Structure : architecture is true;
+
+begin
+    -- component instantiation statements
+    scuba_vlo_inst: VLO
+        port map (Z=>scuba_vlo);
+
+    PLLInst_0: EHXPLLF
+        generic map (FEEDBK_PATH=> "CLKOP", CLKOK_BYPASS=> "DISABLED", 
+        CLKOS_BYPASS=> "DISABLED", CLKOP_BYPASS=> "DISABLED", 
+        CLKOK_INPUT=> "CLKOP", DELAY_PWD=> "DISABLED", DELAY_VAL=>  0, 
+        CLKOS_TRIM_DELAY=>  0, CLKOS_TRIM_POL=> "RISING", 
+        CLKOP_TRIM_DELAY=>  0, CLKOP_TRIM_POL=> "RISING", 
+        PHASE_DELAY_CNTL=> "STATIC", DUTY=>  8, PHASEADJ=> "0.0", 
+        CLKOK_DIV=>  2, CLKOP_DIV=>  8, CLKFB_DIV=>  1, CLKI_DIV=>  1, 
+        FIN=> "125.000000")
+        port map (CLKI=>CLK, CLKFB=>CLKOP_t, RST=>scuba_vlo, 
+            RSTK=>scuba_vlo, WRDEL=>scuba_vlo, DRPAI3=>scuba_vlo, 
+            DRPAI2=>scuba_vlo, DRPAI1=>scuba_vlo, DRPAI0=>scuba_vlo, 
+            DFPAI3=>scuba_vlo, DFPAI2=>scuba_vlo, DFPAI1=>scuba_vlo, 
+            DFPAI0=>scuba_vlo, FDA3=>scuba_vlo, FDA2=>scuba_vlo, 
+            FDA1=>scuba_vlo, FDA0=>scuba_vlo, CLKOP=>CLKOP_t, 
+            CLKOS=>open, CLKOK=>open, CLKOK2=>open, LOCK=>LOCK, 
+            CLKINTFB=>open);
+
+    CLKOP <= CLKOP_t;
+end Structure;
+
+-- synopsys translate_off
+library ecp3;
+configuration Structure_CON of pll is
+    for Structure
+        for all:EHXPLLF use entity ecp3.EHXPLLF(V); end for;
+        for all:VLO use entity ecp3.VLO(V); end for;
+    end for;
+end Structure_CON;
+
+-- synopsys translate_on
diff --git a/trb3_gbe_test/ipcores/serdes.vhd b/trb3_gbe_test/ipcores/serdes.vhd
new file mode 100644 (file)
index 0000000..9e6a2b4
--- /dev/null
@@ -0,0 +1,2724 @@
+
+
+
+--synopsys translate_off
+
+library pcsd_work;
+use pcsd_work.all;
+library IEEE;
+use IEEE.std_logic_1164.all;
+
+entity PCSD is
+GENERIC(
+  CONFIG_FILE : String;
+  QUAD_MODE : String;
+  CH0_CDR_SRC   : String := "REFCLK_EXT";
+  CH1_CDR_SRC   : String := "REFCLK_EXT";
+  CH2_CDR_SRC   : String := "REFCLK_EXT";
+  CH3_CDR_SRC   : String := "REFCLK_EXT";
+  PLL_SRC   : String
+--  CONFIG_FILE : String  := "serdes.txt";
+--  QUAD_MODE : String := "SINGLE";
+--  CH0_CDR_SRC   : String := "REFCLK_CORE";
+--  CH1_CDR_SRC   : String := "REFCLK_CORE";
+--  CH2_CDR_SRC   : String := "REFCLK_EXT";
+--  CH3_CDR_SRC   : String := "REFCLK_EXT";
+--  PLL_SRC   : String := "REFCLK_CORE"
+  );
+port (
+  HDINN0             : in std_logic;
+  HDINN1             : in std_logic;
+  HDINN2             : in std_logic;
+  HDINN3             : in std_logic;
+  HDINP0             : in std_logic;
+  HDINP1             : in std_logic;
+  HDINP2             : in std_logic;
+  HDINP3             : in std_logic;
+  REFCLKN             : in std_logic;
+  REFCLKP             : in std_logic;
+  CIN0             : in std_logic;
+  CIN1             : in std_logic;
+  CIN2             : in std_logic;
+  CIN3             : in std_logic;
+  CIN4             : in std_logic;
+  CIN5             : in std_logic;
+  CIN6             : in std_logic;
+  CIN7             : in std_logic;
+  CIN8             : in std_logic;
+  CIN9             : in std_logic;
+  CIN10             : in std_logic;
+  CIN11             : in std_logic;
+  CYAWSTN             : in std_logic;
+  FF_EBRD_CLK_0             : in std_logic;
+  FF_EBRD_CLK_1             : in std_logic;
+  FF_EBRD_CLK_2             : in std_logic;
+  FF_EBRD_CLK_3             : in std_logic;
+  FF_RXI_CLK_0             : in std_logic;
+  FF_RXI_CLK_1             : in std_logic;
+  FF_RXI_CLK_2             : in std_logic;
+  FF_RXI_CLK_3             : in std_logic;
+  FF_TX_D_0_0             : in std_logic;
+  FF_TX_D_0_1             : in std_logic;
+  FF_TX_D_0_2             : in std_logic;
+  FF_TX_D_0_3             : in std_logic;
+  FF_TX_D_0_4             : in std_logic;
+  FF_TX_D_0_5             : in std_logic;
+  FF_TX_D_0_6             : in std_logic;
+  FF_TX_D_0_7             : in std_logic;
+  FF_TX_D_0_8             : in std_logic;
+  FF_TX_D_0_9             : in std_logic;
+  FF_TX_D_0_10             : in std_logic;
+  FF_TX_D_0_11             : in std_logic;
+  FF_TX_D_0_12             : in std_logic;
+  FF_TX_D_0_13             : in std_logic;
+  FF_TX_D_0_14             : in std_logic;
+  FF_TX_D_0_15             : in std_logic;
+  FF_TX_D_0_16             : in std_logic;
+  FF_TX_D_0_17             : in std_logic;
+  FF_TX_D_0_18             : in std_logic;
+  FF_TX_D_0_19             : in std_logic;
+  FF_TX_D_0_20             : in std_logic;
+  FF_TX_D_0_21             : in std_logic;
+  FF_TX_D_0_22             : in std_logic;
+  FF_TX_D_0_23             : in std_logic;
+  FF_TX_D_1_0             : in std_logic;
+  FF_TX_D_1_1             : in std_logic;
+  FF_TX_D_1_2             : in std_logic;
+  FF_TX_D_1_3             : in std_logic;
+  FF_TX_D_1_4             : in std_logic;
+  FF_TX_D_1_5             : in std_logic;
+  FF_TX_D_1_6             : in std_logic;
+  FF_TX_D_1_7             : in std_logic;
+  FF_TX_D_1_8             : in std_logic;
+  FF_TX_D_1_9             : in std_logic;
+  FF_TX_D_1_10             : in std_logic;
+  FF_TX_D_1_11             : in std_logic;
+  FF_TX_D_1_12             : in std_logic;
+  FF_TX_D_1_13             : in std_logic;
+  FF_TX_D_1_14             : in std_logic;
+  FF_TX_D_1_15             : in std_logic;
+  FF_TX_D_1_16             : in std_logic;
+  FF_TX_D_1_17             : in std_logic;
+  FF_TX_D_1_18             : in std_logic;
+  FF_TX_D_1_19             : in std_logic;
+  FF_TX_D_1_20             : in std_logic;
+  FF_TX_D_1_21             : in std_logic;
+  FF_TX_D_1_22             : in std_logic;
+  FF_TX_D_1_23             : in std_logic;
+  FF_TX_D_2_0             : in std_logic;
+  FF_TX_D_2_1             : in std_logic;
+  FF_TX_D_2_2             : in std_logic;
+  FF_TX_D_2_3             : in std_logic;
+  FF_TX_D_2_4             : in std_logic;
+  FF_TX_D_2_5             : in std_logic;
+  FF_TX_D_2_6             : in std_logic;
+  FF_TX_D_2_7             : in std_logic;
+  FF_TX_D_2_8             : in std_logic;
+  FF_TX_D_2_9             : in std_logic;
+  FF_TX_D_2_10             : in std_logic;
+  FF_TX_D_2_11             : in std_logic;
+  FF_TX_D_2_12             : in std_logic;
+  FF_TX_D_2_13             : in std_logic;
+  FF_TX_D_2_14             : in std_logic;
+  FF_TX_D_2_15             : in std_logic;
+  FF_TX_D_2_16             : in std_logic;
+  FF_TX_D_2_17             : in std_logic;
+  FF_TX_D_2_18             : in std_logic;
+  FF_TX_D_2_19             : in std_logic;
+  FF_TX_D_2_20             : in std_logic;
+  FF_TX_D_2_21             : in std_logic;
+  FF_TX_D_2_22             : in std_logic;
+  FF_TX_D_2_23             : in std_logic;
+  FF_TX_D_3_0             : in std_logic;
+  FF_TX_D_3_1             : in std_logic;
+  FF_TX_D_3_2             : in std_logic;
+  FF_TX_D_3_3             : in std_logic;
+  FF_TX_D_3_4             : in std_logic;
+  FF_TX_D_3_5             : in std_logic;
+  FF_TX_D_3_6             : in std_logic;
+  FF_TX_D_3_7             : in std_logic;
+  FF_TX_D_3_8             : in std_logic;
+  FF_TX_D_3_9             : in std_logic;
+  FF_TX_D_3_10             : in std_logic;
+  FF_TX_D_3_11             : in std_logic;
+  FF_TX_D_3_12             : in std_logic;
+  FF_TX_D_3_13             : in std_logic;
+  FF_TX_D_3_14             : in std_logic;
+  FF_TX_D_3_15             : in std_logic;
+  FF_TX_D_3_16             : in std_logic;
+  FF_TX_D_3_17             : in std_logic;
+  FF_TX_D_3_18             : in std_logic;
+  FF_TX_D_3_19             : in std_logic;
+  FF_TX_D_3_20             : in std_logic;
+  FF_TX_D_3_21             : in std_logic;
+  FF_TX_D_3_22             : in std_logic;
+  FF_TX_D_3_23             : in std_logic;
+  FF_TXI_CLK_0             : in std_logic;
+  FF_TXI_CLK_1             : in std_logic;
+  FF_TXI_CLK_2             : in std_logic;
+  FF_TXI_CLK_3             : in std_logic;
+  FFC_CK_CORE_RX_0         : in std_logic;
+  FFC_CK_CORE_RX_1         : in std_logic;
+  FFC_CK_CORE_RX_2         : in std_logic;
+  FFC_CK_CORE_RX_3         : in std_logic;
+  FFC_CK_CORE_TX           : in std_logic;
+  FFC_EI_EN_0             : in std_logic;
+  FFC_EI_EN_1             : in std_logic;
+  FFC_EI_EN_2             : in std_logic;
+  FFC_EI_EN_3             : in std_logic;
+  FFC_ENABLE_CGALIGN_0             : in std_logic;
+  FFC_ENABLE_CGALIGN_1             : in std_logic;
+  FFC_ENABLE_CGALIGN_2             : in std_logic;
+  FFC_ENABLE_CGALIGN_3             : in std_logic;
+  FFC_FB_LOOPBACK_0             : in std_logic;
+  FFC_FB_LOOPBACK_1             : in std_logic;
+  FFC_FB_LOOPBACK_2             : in std_logic;
+  FFC_FB_LOOPBACK_3             : in std_logic;
+  FFC_LANE_RX_RST_0             : in std_logic;
+  FFC_LANE_RX_RST_1             : in std_logic;
+  FFC_LANE_RX_RST_2             : in std_logic;
+  FFC_LANE_RX_RST_3             : in std_logic;
+  FFC_LANE_TX_RST_0             : in std_logic;
+  FFC_LANE_TX_RST_1             : in std_logic;
+  FFC_LANE_TX_RST_2             : in std_logic;
+  FFC_LANE_TX_RST_3             : in std_logic;
+  FFC_MACRO_RST             : in std_logic;
+  FFC_PCI_DET_EN_0             : in std_logic;
+  FFC_PCI_DET_EN_1             : in std_logic;
+  FFC_PCI_DET_EN_2             : in std_logic;
+  FFC_PCI_DET_EN_3             : in std_logic;
+  FFC_PCIE_CT_0             : in std_logic;
+  FFC_PCIE_CT_1             : in std_logic;
+  FFC_PCIE_CT_2             : in std_logic;
+  FFC_PCIE_CT_3             : in std_logic;
+  FFC_PFIFO_CLR_0             : in std_logic;
+  FFC_PFIFO_CLR_1             : in std_logic;
+  FFC_PFIFO_CLR_2             : in std_logic;
+  FFC_PFIFO_CLR_3             : in std_logic;
+  FFC_QUAD_RST             : in std_logic;
+  FFC_RRST_0             : in std_logic;
+  FFC_RRST_1             : in std_logic;
+  FFC_RRST_2             : in std_logic;
+  FFC_RRST_3             : in std_logic;
+  FFC_RXPWDNB_0             : in std_logic;
+  FFC_RXPWDNB_1             : in std_logic;
+  FFC_RXPWDNB_2             : in std_logic;
+  FFC_RXPWDNB_3             : in std_logic;
+  FFC_SB_INV_RX_0             : in std_logic;
+  FFC_SB_INV_RX_1             : in std_logic;
+  FFC_SB_INV_RX_2             : in std_logic;
+  FFC_SB_INV_RX_3             : in std_logic;
+  FFC_SB_PFIFO_LP_0             : in std_logic;
+  FFC_SB_PFIFO_LP_1             : in std_logic;
+  FFC_SB_PFIFO_LP_2             : in std_logic;
+  FFC_SB_PFIFO_LP_3             : in std_logic;
+  FFC_SIGNAL_DETECT_0             : in std_logic;
+  FFC_SIGNAL_DETECT_1             : in std_logic;
+  FFC_SIGNAL_DETECT_2             : in std_logic;
+  FFC_SIGNAL_DETECT_3             : in std_logic;
+  FFC_SYNC_TOGGLE             : in std_logic;
+  FFC_TRST             : in std_logic;
+  FFC_TXPWDNB_0             : in std_logic;
+  FFC_TXPWDNB_1             : in std_logic;
+  FFC_TXPWDNB_2             : in std_logic;
+  FFC_TXPWDNB_3             : in std_logic;
+  FFC_RATE_MODE_RX_0        : in std_logic;
+  FFC_RATE_MODE_RX_1        : in std_logic;
+  FFC_RATE_MODE_RX_2        : in std_logic;
+  FFC_RATE_MODE_RX_3        : in std_logic;
+  FFC_RATE_MODE_TX_0        : in std_logic;
+  FFC_RATE_MODE_TX_1        : in std_logic;
+  FFC_RATE_MODE_TX_2        : in std_logic;
+  FFC_RATE_MODE_TX_3        : in std_logic;
+  FFC_DIV11_MODE_RX_0       : in std_logic;
+  FFC_DIV11_MODE_RX_1       : in std_logic;
+  FFC_DIV11_MODE_RX_2       : in std_logic;
+  FFC_DIV11_MODE_RX_3       : in std_logic;
+  FFC_DIV11_MODE_TX_0       : in std_logic;
+  FFC_DIV11_MODE_TX_1       : in std_logic;
+  FFC_DIV11_MODE_TX_2       : in std_logic;
+  FFC_DIV11_MODE_TX_3       : in std_logic;
+  LDR_CORE2TX_0             : in std_logic;
+  LDR_CORE2TX_1             : in std_logic;
+  LDR_CORE2TX_2             : in std_logic;
+  LDR_CORE2TX_3             : in std_logic;
+  FFC_LDR_CORE2TX_EN_0      : in std_logic;
+  FFC_LDR_CORE2TX_EN_1      : in std_logic;
+  FFC_LDR_CORE2TX_EN_2      : in std_logic;
+  FFC_LDR_CORE2TX_EN_3      : in std_logic;
+  PCIE_POWERDOWN_0_0      : in std_logic;
+  PCIE_POWERDOWN_0_1      : in std_logic;
+  PCIE_POWERDOWN_1_0      : in std_logic;
+  PCIE_POWERDOWN_1_1      : in std_logic;
+  PCIE_POWERDOWN_2_0      : in std_logic;
+  PCIE_POWERDOWN_2_1      : in std_logic;
+  PCIE_POWERDOWN_3_0      : in std_logic;
+  PCIE_POWERDOWN_3_1      : in std_logic;
+  PCIE_RXPOLARITY_0         : in std_logic;
+  PCIE_RXPOLARITY_1         : in std_logic;
+  PCIE_RXPOLARITY_2         : in std_logic;
+  PCIE_RXPOLARITY_3         : in std_logic;
+  PCIE_TXCOMPLIANCE_0       : in std_logic;
+  PCIE_TXCOMPLIANCE_1       : in std_logic;
+  PCIE_TXCOMPLIANCE_2       : in std_logic;
+  PCIE_TXCOMPLIANCE_3       : in std_logic;
+  PCIE_TXDETRX_PR2TLB_0     : in std_logic;
+  PCIE_TXDETRX_PR2TLB_1     : in std_logic;
+  PCIE_TXDETRX_PR2TLB_2     : in std_logic;
+  PCIE_TXDETRX_PR2TLB_3     : in std_logic;
+  SCIADDR0             : in std_logic;
+  SCIADDR1             : in std_logic;
+  SCIADDR2             : in std_logic;
+  SCIADDR3             : in std_logic;
+  SCIADDR4             : in std_logic;
+  SCIADDR5             : in std_logic;
+  SCIENAUX             : in std_logic;
+  SCIENCH0             : in std_logic;
+  SCIENCH1             : in std_logic;
+  SCIENCH2             : in std_logic;
+  SCIENCH3             : in std_logic;
+  SCIRD                : in std_logic;
+  SCISELAUX             : in std_logic;
+  SCISELCH0             : in std_logic;
+  SCISELCH1             : in std_logic;
+  SCISELCH2             : in std_logic;
+  SCISELCH3             : in std_logic;
+  SCIWDATA0             : in std_logic;
+  SCIWDATA1             : in std_logic;
+  SCIWDATA2             : in std_logic;
+  SCIWDATA3             : in std_logic;
+  SCIWDATA4             : in std_logic;
+  SCIWDATA5             : in std_logic;
+  SCIWDATA6             : in std_logic;
+  SCIWDATA7             : in std_logic;
+  SCIWSTN               : in std_logic;
+  REFCLK_FROM_NQ        : in std_logic;
+
+  HDOUTN0             : out std_logic;
+  HDOUTN1             : out std_logic;
+  HDOUTN2             : out std_logic;
+  HDOUTN3             : out std_logic;
+  HDOUTP0             : out std_logic;
+  HDOUTP1             : out std_logic;
+  HDOUTP2             : out std_logic;
+  HDOUTP3             : out std_logic;
+  COUT0             : out std_logic;
+  COUT1             : out std_logic;
+  COUT2             : out std_logic;
+  COUT3             : out std_logic;
+  COUT4             : out std_logic;
+  COUT5             : out std_logic;
+  COUT6             : out std_logic;
+  COUT7             : out std_logic;
+  COUT8             : out std_logic;
+  COUT9             : out std_logic;
+  COUT10             : out std_logic;
+  COUT11             : out std_logic;
+  COUT12             : out std_logic;
+  COUT13             : out std_logic;
+  COUT14             : out std_logic;
+  COUT15             : out std_logic;
+  COUT16             : out std_logic;
+  COUT17             : out std_logic;
+  COUT18             : out std_logic;
+  COUT19             : out std_logic;
+  FF_RX_D_0_0             : out std_logic;
+  FF_RX_D_0_1             : out std_logic;
+  FF_RX_D_0_2             : out std_logic;
+  FF_RX_D_0_3             : out std_logic;
+  FF_RX_D_0_4             : out std_logic;
+  FF_RX_D_0_5             : out std_logic;
+  FF_RX_D_0_6             : out std_logic;
+  FF_RX_D_0_7             : out std_logic;
+  FF_RX_D_0_8             : out std_logic;
+  FF_RX_D_0_9             : out std_logic;
+  FF_RX_D_0_10             : out std_logic;
+  FF_RX_D_0_11             : out std_logic;
+  FF_RX_D_0_12             : out std_logic;
+  FF_RX_D_0_13             : out std_logic;
+  FF_RX_D_0_14             : out std_logic;
+  FF_RX_D_0_15             : out std_logic;
+  FF_RX_D_0_16             : out std_logic;
+  FF_RX_D_0_17             : out std_logic;
+  FF_RX_D_0_18             : out std_logic;
+  FF_RX_D_0_19             : out std_logic;
+  FF_RX_D_0_20             : out std_logic;
+  FF_RX_D_0_21             : out std_logic;
+  FF_RX_D_0_22             : out std_logic;
+  FF_RX_D_0_23             : out std_logic;
+  FF_RX_D_1_0             : out std_logic;
+  FF_RX_D_1_1             : out std_logic;
+  FF_RX_D_1_2             : out std_logic;
+  FF_RX_D_1_3             : out std_logic;
+  FF_RX_D_1_4             : out std_logic;
+  FF_RX_D_1_5             : out std_logic;
+  FF_RX_D_1_6             : out std_logic;
+  FF_RX_D_1_7             : out std_logic;
+  FF_RX_D_1_8             : out std_logic;
+  FF_RX_D_1_9             : out std_logic;
+  FF_RX_D_1_10             : out std_logic;
+  FF_RX_D_1_11             : out std_logic;
+  FF_RX_D_1_12             : out std_logic;
+  FF_RX_D_1_13             : out std_logic;
+  FF_RX_D_1_14             : out std_logic;
+  FF_RX_D_1_15             : out std_logic;
+  FF_RX_D_1_16             : out std_logic;
+  FF_RX_D_1_17             : out std_logic;
+  FF_RX_D_1_18             : out std_logic;
+  FF_RX_D_1_19             : out std_logic;
+  FF_RX_D_1_20             : out std_logic;
+  FF_RX_D_1_21             : out std_logic;
+  FF_RX_D_1_22             : out std_logic;
+  FF_RX_D_1_23             : out std_logic;
+  FF_RX_D_2_0             : out std_logic;
+  FF_RX_D_2_1             : out std_logic;
+  FF_RX_D_2_2             : out std_logic;
+  FF_RX_D_2_3             : out std_logic;
+  FF_RX_D_2_4             : out std_logic;
+  FF_RX_D_2_5             : out std_logic;
+  FF_RX_D_2_6             : out std_logic;
+  FF_RX_D_2_7             : out std_logic;
+  FF_RX_D_2_8             : out std_logic;
+  FF_RX_D_2_9             : out std_logic;
+  FF_RX_D_2_10             : out std_logic;
+  FF_RX_D_2_11             : out std_logic;
+  FF_RX_D_2_12             : out std_logic;
+  FF_RX_D_2_13             : out std_logic;
+  FF_RX_D_2_14             : out std_logic;
+  FF_RX_D_2_15             : out std_logic;
+  FF_RX_D_2_16             : out std_logic;
+  FF_RX_D_2_17             : out std_logic;
+  FF_RX_D_2_18             : out std_logic;
+  FF_RX_D_2_19             : out std_logic;
+  FF_RX_D_2_20             : out std_logic;
+  FF_RX_D_2_21             : out std_logic;
+  FF_RX_D_2_22             : out std_logic;
+  FF_RX_D_2_23             : out std_logic;
+  FF_RX_D_3_0             : out std_logic;
+  FF_RX_D_3_1             : out std_logic;
+  FF_RX_D_3_2             : out std_logic;
+  FF_RX_D_3_3             : out std_logic;
+  FF_RX_D_3_4             : out std_logic;
+  FF_RX_D_3_5             : out std_logic;
+  FF_RX_D_3_6             : out std_logic;
+  FF_RX_D_3_7             : out std_logic;
+  FF_RX_D_3_8             : out std_logic;
+  FF_RX_D_3_9             : out std_logic;
+  FF_RX_D_3_10             : out std_logic;
+  FF_RX_D_3_11             : out std_logic;
+  FF_RX_D_3_12             : out std_logic;
+  FF_RX_D_3_13             : out std_logic;
+  FF_RX_D_3_14             : out std_logic;
+  FF_RX_D_3_15             : out std_logic;
+  FF_RX_D_3_16             : out std_logic;
+  FF_RX_D_3_17             : out std_logic;
+  FF_RX_D_3_18             : out std_logic;
+  FF_RX_D_3_19             : out std_logic;
+  FF_RX_D_3_20             : out std_logic;
+  FF_RX_D_3_21             : out std_logic;
+  FF_RX_D_3_22             : out std_logic;
+  FF_RX_D_3_23             : out std_logic;
+  FF_RX_F_CLK_0             : out std_logic;
+  FF_RX_F_CLK_1             : out std_logic;
+  FF_RX_F_CLK_2             : out std_logic;
+  FF_RX_F_CLK_3             : out std_logic;
+  FF_RX_H_CLK_0             : out std_logic;
+  FF_RX_H_CLK_1             : out std_logic;
+  FF_RX_H_CLK_2             : out std_logic;
+  FF_RX_H_CLK_3             : out std_logic;
+  FF_TX_F_CLK_0             : out std_logic;
+  FF_TX_F_CLK_1             : out std_logic;
+  FF_TX_F_CLK_2             : out std_logic;
+  FF_TX_F_CLK_3             : out std_logic;
+  FF_TX_H_CLK_0             : out std_logic;
+  FF_TX_H_CLK_1             : out std_logic;
+  FF_TX_H_CLK_2             : out std_logic;
+  FF_TX_H_CLK_3             : out std_logic;
+  FFS_CC_OVERRUN_0             : out std_logic;
+  FFS_CC_OVERRUN_1             : out std_logic;
+  FFS_CC_OVERRUN_2             : out std_logic;
+  FFS_CC_OVERRUN_3             : out std_logic;
+  FFS_CC_UNDERRUN_0             : out std_logic;
+  FFS_CC_UNDERRUN_1             : out std_logic;
+  FFS_CC_UNDERRUN_2             : out std_logic;
+  FFS_CC_UNDERRUN_3             : out std_logic;
+  FFS_LS_SYNC_STATUS_0             : out std_logic;
+  FFS_LS_SYNC_STATUS_1             : out std_logic;
+  FFS_LS_SYNC_STATUS_2             : out std_logic;
+  FFS_LS_SYNC_STATUS_3             : out std_logic;
+  FFS_CDR_TRAIN_DONE_0             : out std_logic;
+  FFS_CDR_TRAIN_DONE_1             : out std_logic;
+  FFS_CDR_TRAIN_DONE_2             : out std_logic;
+  FFS_CDR_TRAIN_DONE_3             : out std_logic;
+  FFS_PCIE_CON_0             : out std_logic;
+  FFS_PCIE_CON_1             : out std_logic;
+  FFS_PCIE_CON_2             : out std_logic;
+  FFS_PCIE_CON_3             : out std_logic;
+  FFS_PCIE_DONE_0             : out std_logic;
+  FFS_PCIE_DONE_1             : out std_logic;
+  FFS_PCIE_DONE_2             : out std_logic;
+  FFS_PCIE_DONE_3             : out std_logic;
+  FFS_PLOL             : out std_logic;
+  FFS_RLOL_0             : out std_logic;
+  FFS_RLOL_1             : out std_logic;
+  FFS_RLOL_2             : out std_logic;
+  FFS_RLOL_3             : out std_logic;
+  FFS_RLOS_HI_0             : out std_logic;
+  FFS_RLOS_HI_1             : out std_logic;
+  FFS_RLOS_HI_2             : out std_logic;
+  FFS_RLOS_HI_3             : out std_logic;
+  FFS_RLOS_LO_0             : out std_logic;
+  FFS_RLOS_LO_1             : out std_logic;
+  FFS_RLOS_LO_2             : out std_logic;
+  FFS_RLOS_LO_3             : out std_logic;
+  FFS_RXFBFIFO_ERROR_0             : out std_logic;
+  FFS_RXFBFIFO_ERROR_1             : out std_logic;
+  FFS_RXFBFIFO_ERROR_2             : out std_logic;
+  FFS_RXFBFIFO_ERROR_3             : out std_logic;
+  FFS_TXFBFIFO_ERROR_0             : out std_logic;
+  FFS_TXFBFIFO_ERROR_1             : out std_logic;
+  FFS_TXFBFIFO_ERROR_2             : out std_logic;
+  FFS_TXFBFIFO_ERROR_3             : out std_logic;
+  PCIE_PHYSTATUS_0             : out std_logic;
+  PCIE_PHYSTATUS_1             : out std_logic;
+  PCIE_PHYSTATUS_2             : out std_logic;
+  PCIE_PHYSTATUS_3             : out std_logic;
+  PCIE_RXVALID_0               : out std_logic;
+  PCIE_RXVALID_1               : out std_logic;
+  PCIE_RXVALID_2               : out std_logic;
+  PCIE_RXVALID_3               : out std_logic;
+  FFS_SKP_ADDED_0                  : out std_logic;
+  FFS_SKP_ADDED_1                  : out std_logic;
+  FFS_SKP_ADDED_2                  : out std_logic;
+  FFS_SKP_ADDED_3                  : out std_logic;
+  FFS_SKP_DELETED_0                : out std_logic;
+  FFS_SKP_DELETED_1                : out std_logic;
+  FFS_SKP_DELETED_2                : out std_logic;
+  FFS_SKP_DELETED_3                : out std_logic;
+  LDR_RX2CORE_0                    : out std_logic;
+  LDR_RX2CORE_1                    : out std_logic;
+  LDR_RX2CORE_2                    : out std_logic;
+  LDR_RX2CORE_3                    : out std_logic;
+  REFCK2CORE             : out std_logic;
+  SCIINT                : out std_logic;
+  SCIRDATA0             : out std_logic;
+  SCIRDATA1             : out std_logic;
+  SCIRDATA2             : out std_logic;
+  SCIRDATA3             : out std_logic;
+  SCIRDATA4             : out std_logic;
+  SCIRDATA5             : out std_logic;
+  SCIRDATA6             : out std_logic;
+  SCIRDATA7             : out std_logic;
+  REFCLK_TO_NQ          : out std_logic
+);
+
+end PCSD;
+
+architecture PCSD_arch of PCSD is
+
+
+component PCSD_sim
+GENERIC(
+  CONFIG_FILE : String;
+  QUAD_MODE : String;
+  CH0_CDR_SRC   : String;
+  CH1_CDR_SRC   : String;
+  CH2_CDR_SRC   : String;
+  CH3_CDR_SRC   : String;
+  PLL_SRC   : String
+  );
+port (
+  HDINN0             : in std_logic;
+  HDINN1             : in std_logic;
+  HDINN2             : in std_logic;
+  HDINN3             : in std_logic;
+  HDINP0             : in std_logic;
+  HDINP1             : in std_logic;
+  HDINP2             : in std_logic;
+  HDINP3             : in std_logic;
+  REFCLKN             : in std_logic;
+  REFCLKP             : in std_logic;
+  CIN0             : in std_logic;
+  CIN1             : in std_logic;
+  CIN2             : in std_logic;
+  CIN3             : in std_logic;
+  CIN4             : in std_logic;
+  CIN5             : in std_logic;
+  CIN6             : in std_logic;
+  CIN7             : in std_logic;
+  CIN8             : in std_logic;
+  CIN9             : in std_logic;
+  CIN10             : in std_logic;
+  CIN11             : in std_logic;
+  CYAWSTN             : in std_logic;
+  FF_EBRD_CLK_0             : in std_logic;
+  FF_EBRD_CLK_1             : in std_logic;
+  FF_EBRD_CLK_2             : in std_logic;
+  FF_EBRD_CLK_3             : in std_logic;
+  FF_RXI_CLK_0             : in std_logic;
+  FF_RXI_CLK_1             : in std_logic;
+  FF_RXI_CLK_2             : in std_logic;
+  FF_RXI_CLK_3             : in std_logic;
+  FF_TX_D_0_0             : in std_logic;
+  FF_TX_D_0_1             : in std_logic;
+  FF_TX_D_0_2             : in std_logic;
+  FF_TX_D_0_3             : in std_logic;
+  FF_TX_D_0_4             : in std_logic;
+  FF_TX_D_0_5             : in std_logic;
+  FF_TX_D_0_6             : in std_logic;
+  FF_TX_D_0_7             : in std_logic;
+  FF_TX_D_0_8             : in std_logic;
+  FF_TX_D_0_9             : in std_logic;
+  FF_TX_D_0_10             : in std_logic;
+  FF_TX_D_0_11             : in std_logic;
+  FF_TX_D_0_12             : in std_logic;
+  FF_TX_D_0_13             : in std_logic;
+  FF_TX_D_0_14             : in std_logic;
+  FF_TX_D_0_15             : in std_logic;
+  FF_TX_D_0_16             : in std_logic;
+  FF_TX_D_0_17             : in std_logic;
+  FF_TX_D_0_18             : in std_logic;
+  FF_TX_D_0_19             : in std_logic;
+  FF_TX_D_0_20             : in std_logic;
+  FF_TX_D_0_21             : in std_logic;
+  FF_TX_D_0_22             : in std_logic;
+  FF_TX_D_0_23             : in std_logic;
+  FF_TX_D_1_0             : in std_logic;
+  FF_TX_D_1_1             : in std_logic;
+  FF_TX_D_1_2             : in std_logic;
+  FF_TX_D_1_3             : in std_logic;
+  FF_TX_D_1_4             : in std_logic;
+  FF_TX_D_1_5             : in std_logic;
+  FF_TX_D_1_6             : in std_logic;
+  FF_TX_D_1_7             : in std_logic;
+  FF_TX_D_1_8             : in std_logic;
+  FF_TX_D_1_9             : in std_logic;
+  FF_TX_D_1_10             : in std_logic;
+  FF_TX_D_1_11             : in std_logic;
+  FF_TX_D_1_12             : in std_logic;
+  FF_TX_D_1_13             : in std_logic;
+  FF_TX_D_1_14             : in std_logic;
+  FF_TX_D_1_15             : in std_logic;
+  FF_TX_D_1_16             : in std_logic;
+  FF_TX_D_1_17             : in std_logic;
+  FF_TX_D_1_18             : in std_logic;
+  FF_TX_D_1_19             : in std_logic;
+  FF_TX_D_1_20             : in std_logic;
+  FF_TX_D_1_21             : in std_logic;
+  FF_TX_D_1_22             : in std_logic;
+  FF_TX_D_1_23             : in std_logic;
+  FF_TX_D_2_0             : in std_logic;
+  FF_TX_D_2_1             : in std_logic;
+  FF_TX_D_2_2             : in std_logic;
+  FF_TX_D_2_3             : in std_logic;
+  FF_TX_D_2_4             : in std_logic;
+  FF_TX_D_2_5             : in std_logic;
+  FF_TX_D_2_6             : in std_logic;
+  FF_TX_D_2_7             : in std_logic;
+  FF_TX_D_2_8             : in std_logic;
+  FF_TX_D_2_9             : in std_logic;
+  FF_TX_D_2_10             : in std_logic;
+  FF_TX_D_2_11             : in std_logic;
+  FF_TX_D_2_12             : in std_logic;
+  FF_TX_D_2_13             : in std_logic;
+  FF_TX_D_2_14             : in std_logic;
+  FF_TX_D_2_15             : in std_logic;
+  FF_TX_D_2_16             : in std_logic;
+  FF_TX_D_2_17             : in std_logic;
+  FF_TX_D_2_18             : in std_logic;
+  FF_TX_D_2_19             : in std_logic;
+  FF_TX_D_2_20             : in std_logic;
+  FF_TX_D_2_21             : in std_logic;
+  FF_TX_D_2_22             : in std_logic;
+  FF_TX_D_2_23             : in std_logic;
+  FF_TX_D_3_0             : in std_logic;
+  FF_TX_D_3_1             : in std_logic;
+  FF_TX_D_3_2             : in std_logic;
+  FF_TX_D_3_3             : in std_logic;
+  FF_TX_D_3_4             : in std_logic;
+  FF_TX_D_3_5             : in std_logic;
+  FF_TX_D_3_6             : in std_logic;
+  FF_TX_D_3_7             : in std_logic;
+  FF_TX_D_3_8             : in std_logic;
+  FF_TX_D_3_9             : in std_logic;
+  FF_TX_D_3_10             : in std_logic;
+  FF_TX_D_3_11             : in std_logic;
+  FF_TX_D_3_12             : in std_logic;
+  FF_TX_D_3_13             : in std_logic;
+  FF_TX_D_3_14             : in std_logic;
+  FF_TX_D_3_15             : in std_logic;
+  FF_TX_D_3_16             : in std_logic;
+  FF_TX_D_3_17             : in std_logic;
+  FF_TX_D_3_18             : in std_logic;
+  FF_TX_D_3_19             : in std_logic;
+  FF_TX_D_3_20             : in std_logic;
+  FF_TX_D_3_21             : in std_logic;
+  FF_TX_D_3_22             : in std_logic;
+  FF_TX_D_3_23             : in std_logic;
+  FF_TXI_CLK_0             : in std_logic;
+  FF_TXI_CLK_1             : in std_logic;
+  FF_TXI_CLK_2             : in std_logic;
+  FF_TXI_CLK_3             : in std_logic;
+  FFC_CK_CORE_RX_0         : in std_logic;
+  FFC_CK_CORE_RX_1         : in std_logic;
+  FFC_CK_CORE_RX_2         : in std_logic;
+  FFC_CK_CORE_RX_3         : in std_logic;
+  FFC_CK_CORE_TX           : in std_logic;
+  FFC_EI_EN_0             : in std_logic;
+  FFC_EI_EN_1             : in std_logic;
+  FFC_EI_EN_2             : in std_logic;
+  FFC_EI_EN_3             : in std_logic;
+  FFC_ENABLE_CGALIGN_0             : in std_logic;
+  FFC_ENABLE_CGALIGN_1             : in std_logic;
+  FFC_ENABLE_CGALIGN_2             : in std_logic;
+  FFC_ENABLE_CGALIGN_3             : in std_logic;
+  FFC_FB_LOOPBACK_0             : in std_logic;
+  FFC_FB_LOOPBACK_1             : in std_logic;
+  FFC_FB_LOOPBACK_2             : in std_logic;
+  FFC_FB_LOOPBACK_3             : in std_logic;
+  FFC_LANE_RX_RST_0             : in std_logic;
+  FFC_LANE_RX_RST_1             : in std_logic;
+  FFC_LANE_RX_RST_2             : in std_logic;
+  FFC_LANE_RX_RST_3             : in std_logic;
+  FFC_LANE_TX_RST_0             : in std_logic;
+  FFC_LANE_TX_RST_1             : in std_logic;
+  FFC_LANE_TX_RST_2             : in std_logic;
+  FFC_LANE_TX_RST_3             : in std_logic;
+  FFC_MACRO_RST             : in std_logic;
+  FFC_PCI_DET_EN_0             : in std_logic;
+  FFC_PCI_DET_EN_1             : in std_logic;
+  FFC_PCI_DET_EN_2             : in std_logic;
+  FFC_PCI_DET_EN_3             : in std_logic;
+  FFC_PCIE_CT_0             : in std_logic;
+  FFC_PCIE_CT_1             : in std_logic;
+  FFC_PCIE_CT_2             : in std_logic;
+  FFC_PCIE_CT_3             : in std_logic;
+  FFC_PFIFO_CLR_0             : in std_logic;
+  FFC_PFIFO_CLR_1             : in std_logic;
+  FFC_PFIFO_CLR_2             : in std_logic;
+  FFC_PFIFO_CLR_3             : in std_logic;
+  FFC_QUAD_RST             : in std_logic;
+  FFC_RRST_0             : in std_logic;
+  FFC_RRST_1             : in std_logic;
+  FFC_RRST_2             : in std_logic;
+  FFC_RRST_3             : in std_logic;
+  FFC_RXPWDNB_0             : in std_logic;
+  FFC_RXPWDNB_1             : in std_logic;
+  FFC_RXPWDNB_2             : in std_logic;
+  FFC_RXPWDNB_3             : in std_logic;
+  FFC_SB_INV_RX_0             : in std_logic;
+  FFC_SB_INV_RX_1             : in std_logic;
+  FFC_SB_INV_RX_2             : in std_logic;
+  FFC_SB_INV_RX_3             : in std_logic;
+  FFC_SB_PFIFO_LP_0             : in std_logic;
+  FFC_SB_PFIFO_LP_1             : in std_logic;
+  FFC_SB_PFIFO_LP_2             : in std_logic;
+  FFC_SB_PFIFO_LP_3             : in std_logic;
+  FFC_SIGNAL_DETECT_0             : in std_logic;
+  FFC_SIGNAL_DETECT_1             : in std_logic;
+  FFC_SIGNAL_DETECT_2             : in std_logic;
+  FFC_SIGNAL_DETECT_3             : in std_logic;
+  FFC_SYNC_TOGGLE             : in std_logic;
+  FFC_TRST             : in std_logic;
+  FFC_TXPWDNB_0             : in std_logic;
+  FFC_TXPWDNB_1             : in std_logic;
+  FFC_TXPWDNB_2             : in std_logic;
+  FFC_TXPWDNB_3             : in std_logic;
+  FFC_RATE_MODE_RX_0        : in std_logic;
+  FFC_RATE_MODE_RX_1        : in std_logic;
+  FFC_RATE_MODE_RX_2        : in std_logic;
+  FFC_RATE_MODE_RX_3        : in std_logic;
+  FFC_RATE_MODE_TX_0        : in std_logic;
+  FFC_RATE_MODE_TX_1        : in std_logic;
+  FFC_RATE_MODE_TX_2        : in std_logic;
+  FFC_RATE_MODE_TX_3        : in std_logic;
+  FFC_DIV11_MODE_RX_0       : in std_logic;
+  FFC_DIV11_MODE_RX_1       : in std_logic;
+  FFC_DIV11_MODE_RX_2       : in std_logic;
+  FFC_DIV11_MODE_RX_3       : in std_logic;
+  FFC_DIV11_MODE_TX_0       : in std_logic;
+  FFC_DIV11_MODE_TX_1       : in std_logic;
+  FFC_DIV11_MODE_TX_2       : in std_logic;
+  FFC_DIV11_MODE_TX_3       : in std_logic;
+  LDR_CORE2TX_0             : in std_logic;
+  LDR_CORE2TX_1             : in std_logic;
+  LDR_CORE2TX_2             : in std_logic;
+  LDR_CORE2TX_3             : in std_logic;
+  FFC_LDR_CORE2TX_EN_0      : in std_logic;
+  FFC_LDR_CORE2TX_EN_1      : in std_logic;
+  FFC_LDR_CORE2TX_EN_2      : in std_logic;
+  FFC_LDR_CORE2TX_EN_3      : in std_logic;
+  PCIE_POWERDOWN_0_0      : in std_logic;
+  PCIE_POWERDOWN_0_1      : in std_logic;
+  PCIE_POWERDOWN_1_0      : in std_logic;
+  PCIE_POWERDOWN_1_1      : in std_logic;
+  PCIE_POWERDOWN_2_0      : in std_logic;
+  PCIE_POWERDOWN_2_1      : in std_logic;
+  PCIE_POWERDOWN_3_0      : in std_logic;
+  PCIE_POWERDOWN_3_1      : in std_logic;
+  PCIE_RXPOLARITY_0         : in std_logic;
+  PCIE_RXPOLARITY_1         : in std_logic;
+  PCIE_RXPOLARITY_2         : in std_logic;
+  PCIE_RXPOLARITY_3         : in std_logic;
+  PCIE_TXCOMPLIANCE_0       : in std_logic;
+  PCIE_TXCOMPLIANCE_1       : in std_logic;
+  PCIE_TXCOMPLIANCE_2       : in std_logic;
+  PCIE_TXCOMPLIANCE_3       : in std_logic;
+  PCIE_TXDETRX_PR2TLB_0     : in std_logic;
+  PCIE_TXDETRX_PR2TLB_1     : in std_logic;
+  PCIE_TXDETRX_PR2TLB_2     : in std_logic;
+  PCIE_TXDETRX_PR2TLB_3     : in std_logic;
+  SCIADDR0             : in std_logic;
+  SCIADDR1             : in std_logic;
+  SCIADDR2             : in std_logic;
+  SCIADDR3             : in std_logic;
+  SCIADDR4             : in std_logic;
+  SCIADDR5             : in std_logic;
+  SCIENAUX             : in std_logic;
+  SCIENCH0             : in std_logic;
+  SCIENCH1             : in std_logic;
+  SCIENCH2             : in std_logic;
+  SCIENCH3             : in std_logic;
+  SCIRD                : in std_logic;
+  SCISELAUX             : in std_logic;
+  SCISELCH0             : in std_logic;
+  SCISELCH1             : in std_logic;
+  SCISELCH2             : in std_logic;
+  SCISELCH3             : in std_logic;
+  SCIWDATA0             : in std_logic;
+  SCIWDATA1             : in std_logic;
+  SCIWDATA2             : in std_logic;
+  SCIWDATA3             : in std_logic;
+  SCIWDATA4             : in std_logic;
+  SCIWDATA5             : in std_logic;
+  SCIWDATA6             : in std_logic;
+  SCIWDATA7             : in std_logic;
+  SCIWSTN               : in std_logic;
+  REFCLK_FROM_NQ        : in std_logic;
+
+  HDOUTN0             : out std_logic;
+  HDOUTN1             : out std_logic;
+  HDOUTN2             : out std_logic;
+  HDOUTN3             : out std_logic;
+  HDOUTP0             : out std_logic;
+  HDOUTP1             : out std_logic;
+  HDOUTP2             : out std_logic;
+  HDOUTP3             : out std_logic;
+  COUT0             : out std_logic;
+  COUT1             : out std_logic;
+  COUT2             : out std_logic;
+  COUT3             : out std_logic;
+  COUT4             : out std_logic;
+  COUT5             : out std_logic;
+  COUT6             : out std_logic;
+  COUT7             : out std_logic;
+  COUT8             : out std_logic;
+  COUT9             : out std_logic;
+  COUT10             : out std_logic;
+  COUT11             : out std_logic;
+  COUT12             : out std_logic;
+  COUT13             : out std_logic;
+  COUT14             : out std_logic;
+  COUT15             : out std_logic;
+  COUT16             : out std_logic;
+  COUT17             : out std_logic;
+  COUT18             : out std_logic;
+  COUT19             : out std_logic;
+  FF_RX_D_0_0             : out std_logic;
+  FF_RX_D_0_1             : out std_logic;
+  FF_RX_D_0_2             : out std_logic;
+  FF_RX_D_0_3             : out std_logic;
+  FF_RX_D_0_4             : out std_logic;
+  FF_RX_D_0_5             : out std_logic;
+  FF_RX_D_0_6             : out std_logic;
+  FF_RX_D_0_7             : out std_logic;
+  FF_RX_D_0_8             : out std_logic;
+  FF_RX_D_0_9             : out std_logic;
+  FF_RX_D_0_10             : out std_logic;
+  FF_RX_D_0_11             : out std_logic;
+  FF_RX_D_0_12             : out std_logic;
+  FF_RX_D_0_13             : out std_logic;
+  FF_RX_D_0_14             : out std_logic;
+  FF_RX_D_0_15             : out std_logic;
+  FF_RX_D_0_16             : out std_logic;
+  FF_RX_D_0_17             : out std_logic;
+  FF_RX_D_0_18             : out std_logic;
+  FF_RX_D_0_19             : out std_logic;
+  FF_RX_D_0_20             : out std_logic;
+  FF_RX_D_0_21             : out std_logic;
+  FF_RX_D_0_22             : out std_logic;
+  FF_RX_D_0_23             : out std_logic;
+  FF_RX_D_1_0             : out std_logic;
+  FF_RX_D_1_1             : out std_logic;
+  FF_RX_D_1_2             : out std_logic;
+  FF_RX_D_1_3             : out std_logic;
+  FF_RX_D_1_4             : out std_logic;
+  FF_RX_D_1_5             : out std_logic;
+  FF_RX_D_1_6             : out std_logic;
+  FF_RX_D_1_7             : out std_logic;
+  FF_RX_D_1_8             : out std_logic;
+  FF_RX_D_1_9             : out std_logic;
+  FF_RX_D_1_10             : out std_logic;
+  FF_RX_D_1_11             : out std_logic;
+  FF_RX_D_1_12             : out std_logic;
+  FF_RX_D_1_13             : out std_logic;
+  FF_RX_D_1_14             : out std_logic;
+  FF_RX_D_1_15             : out std_logic;
+  FF_RX_D_1_16             : out std_logic;
+  FF_RX_D_1_17             : out std_logic;
+  FF_RX_D_1_18             : out std_logic;
+  FF_RX_D_1_19             : out std_logic;
+  FF_RX_D_1_20             : out std_logic;
+  FF_RX_D_1_21             : out std_logic;
+  FF_RX_D_1_22             : out std_logic;
+  FF_RX_D_1_23             : out std_logic;
+  FF_RX_D_2_0             : out std_logic;
+  FF_RX_D_2_1             : out std_logic;
+  FF_RX_D_2_2             : out std_logic;
+  FF_RX_D_2_3             : out std_logic;
+  FF_RX_D_2_4             : out std_logic;
+  FF_RX_D_2_5             : out std_logic;
+  FF_RX_D_2_6             : out std_logic;
+  FF_RX_D_2_7             : out std_logic;
+  FF_RX_D_2_8             : out std_logic;
+  FF_RX_D_2_9             : out std_logic;
+  FF_RX_D_2_10             : out std_logic;
+  FF_RX_D_2_11             : out std_logic;
+  FF_RX_D_2_12             : out std_logic;
+  FF_RX_D_2_13             : out std_logic;
+  FF_RX_D_2_14             : out std_logic;
+  FF_RX_D_2_15             : out std_logic;
+  FF_RX_D_2_16             : out std_logic;
+  FF_RX_D_2_17             : out std_logic;
+  FF_RX_D_2_18             : out std_logic;
+  FF_RX_D_2_19             : out std_logic;
+  FF_RX_D_2_20             : out std_logic;
+  FF_RX_D_2_21             : out std_logic;
+  FF_RX_D_2_22             : out std_logic;
+  FF_RX_D_2_23             : out std_logic;
+  FF_RX_D_3_0             : out std_logic;
+  FF_RX_D_3_1             : out std_logic;
+  FF_RX_D_3_2             : out std_logic;
+  FF_RX_D_3_3             : out std_logic;
+  FF_RX_D_3_4             : out std_logic;
+  FF_RX_D_3_5             : out std_logic;
+  FF_RX_D_3_6             : out std_logic;
+  FF_RX_D_3_7             : out std_logic;
+  FF_RX_D_3_8             : out std_logic;
+  FF_RX_D_3_9             : out std_logic;
+  FF_RX_D_3_10             : out std_logic;
+  FF_RX_D_3_11             : out std_logic;
+  FF_RX_D_3_12             : out std_logic;
+  FF_RX_D_3_13             : out std_logic;
+  FF_RX_D_3_14             : out std_logic;
+  FF_RX_D_3_15             : out std_logic;
+  FF_RX_D_3_16             : out std_logic;
+  FF_RX_D_3_17             : out std_logic;
+  FF_RX_D_3_18             : out std_logic;
+  FF_RX_D_3_19             : out std_logic;
+  FF_RX_D_3_20             : out std_logic;
+  FF_RX_D_3_21             : out std_logic;
+  FF_RX_D_3_22             : out std_logic;
+  FF_RX_D_3_23             : out std_logic;
+  FF_RX_F_CLK_0             : out std_logic;
+  FF_RX_F_CLK_1             : out std_logic;
+  FF_RX_F_CLK_2             : out std_logic;
+  FF_RX_F_CLK_3             : out std_logic;
+  FF_RX_H_CLK_0             : out std_logic;
+  FF_RX_H_CLK_1             : out std_logic;
+  FF_RX_H_CLK_2             : out std_logic;
+  FF_RX_H_CLK_3             : out std_logic;
+  FF_TX_F_CLK_0             : out std_logic;
+  FF_TX_F_CLK_1             : out std_logic;
+  FF_TX_F_CLK_2             : out std_logic;
+  FF_TX_F_CLK_3             : out std_logic;
+  FF_TX_H_CLK_0             : out std_logic;
+  FF_TX_H_CLK_1             : out std_logic;
+  FF_TX_H_CLK_2             : out std_logic;
+  FF_TX_H_CLK_3             : out std_logic;
+  FFS_CC_OVERRUN_0             : out std_logic;
+  FFS_CC_OVERRUN_1             : out std_logic;
+  FFS_CC_OVERRUN_2             : out std_logic;
+  FFS_CC_OVERRUN_3             : out std_logic;
+  FFS_CC_UNDERRUN_0             : out std_logic;
+  FFS_CC_UNDERRUN_1             : out std_logic;
+  FFS_CC_UNDERRUN_2             : out std_logic;
+  FFS_CC_UNDERRUN_3             : out std_logic;
+  FFS_LS_SYNC_STATUS_0             : out std_logic;
+  FFS_LS_SYNC_STATUS_1             : out std_logic;
+  FFS_LS_SYNC_STATUS_2             : out std_logic;
+  FFS_LS_SYNC_STATUS_3             : out std_logic;
+  FFS_CDR_TRAIN_DONE_0             : out std_logic;
+  FFS_CDR_TRAIN_DONE_1             : out std_logic;
+  FFS_CDR_TRAIN_DONE_2             : out std_logic;
+  FFS_CDR_TRAIN_DONE_3             : out std_logic;
+  FFS_PCIE_CON_0             : out std_logic;
+  FFS_PCIE_CON_1             : out std_logic;
+  FFS_PCIE_CON_2             : out std_logic;
+  FFS_PCIE_CON_3             : out std_logic;
+  FFS_PCIE_DONE_0             : out std_logic;
+  FFS_PCIE_DONE_1             : out std_logic;
+  FFS_PCIE_DONE_2             : out std_logic;
+  FFS_PCIE_DONE_3             : out std_logic;
+  FFS_PLOL             : out std_logic;
+  FFS_RLOL_0             : out std_logic;
+  FFS_RLOL_1             : out std_logic;
+  FFS_RLOL_2             : out std_logic;
+  FFS_RLOL_3             : out std_logic;
+  FFS_RLOS_HI_0             : out std_logic;
+  FFS_RLOS_HI_1             : out std_logic;
+  FFS_RLOS_HI_2             : out std_logic;
+  FFS_RLOS_HI_3             : out std_logic;
+  FFS_RLOS_LO_0             : out std_logic;
+  FFS_RLOS_LO_1             : out std_logic;
+  FFS_RLOS_LO_2             : out std_logic;
+  FFS_RLOS_LO_3             : out std_logic;
+  FFS_RXFBFIFO_ERROR_0             : out std_logic;
+  FFS_RXFBFIFO_ERROR_1             : out std_logic;
+  FFS_RXFBFIFO_ERROR_2             : out std_logic;
+  FFS_RXFBFIFO_ERROR_3             : out std_logic;
+  FFS_TXFBFIFO_ERROR_0             : out std_logic;
+  FFS_TXFBFIFO_ERROR_1             : out std_logic;
+  FFS_TXFBFIFO_ERROR_2             : out std_logic;
+  FFS_TXFBFIFO_ERROR_3             : out std_logic;
+  PCIE_PHYSTATUS_0             : out std_logic;
+  PCIE_PHYSTATUS_1             : out std_logic;
+  PCIE_PHYSTATUS_2             : out std_logic;
+  PCIE_PHYSTATUS_3             : out std_logic;
+  PCIE_RXVALID_0               : out std_logic;
+  PCIE_RXVALID_1               : out std_logic;
+  PCIE_RXVALID_2               : out std_logic;
+  PCIE_RXVALID_3               : out std_logic;
+  FFS_SKP_ADDED_0                  : out std_logic;
+  FFS_SKP_ADDED_1                  : out std_logic;
+  FFS_SKP_ADDED_2                  : out std_logic;
+  FFS_SKP_ADDED_3                  : out std_logic;
+  FFS_SKP_DELETED_0                : out std_logic;
+  FFS_SKP_DELETED_1                : out std_logic;
+  FFS_SKP_DELETED_2                : out std_logic;
+  FFS_SKP_DELETED_3                : out std_logic;
+  LDR_RX2CORE_0                    : out std_logic;
+  LDR_RX2CORE_1                    : out std_logic;
+  LDR_RX2CORE_2                    : out std_logic;
+  LDR_RX2CORE_3                    : out std_logic;
+  REFCK2CORE             : out std_logic;
+  SCIINT                : out std_logic;
+  SCIRDATA0             : out std_logic;
+  SCIRDATA1             : out std_logic;
+  SCIRDATA2             : out std_logic;
+  SCIRDATA3             : out std_logic;
+  SCIRDATA4             : out std_logic;
+  SCIRDATA5             : out std_logic;
+  SCIRDATA6             : out std_logic;
+  SCIRDATA7             : out std_logic;
+  REFCLK_TO_NQ          : out std_logic
+);
+end component;
+
+begin
+
+PCSD_sim_inst : PCSD_sim
+generic map (
+  CONFIG_FILE => CONFIG_FILE,
+  QUAD_MODE => QUAD_MODE,
+  CH0_CDR_SRC => CH0_CDR_SRC,
+  CH1_CDR_SRC => CH1_CDR_SRC,
+  CH2_CDR_SRC => CH2_CDR_SRC,
+  CH3_CDR_SRC => CH3_CDR_SRC,
+  PLL_SRC => PLL_SRC
+  )
+port map (
+   HDINN0 => HDINN0,
+   HDINN1 => HDINN1,
+   HDINN2 => HDINN2,
+   HDINN3 => HDINN3,
+   HDINP0 => HDINP0,
+   HDINP1 => HDINP1,
+   HDINP2 => HDINP2,
+   HDINP3 => HDINP3,
+   REFCLKN => REFCLKN,
+   REFCLKP => REFCLKP,
+   CIN11 => CIN11,
+   CIN10 => CIN10,
+   CIN9 => CIN9,
+   CIN8 => CIN8,
+   CIN7 => CIN7,
+   CIN6 => CIN6,
+   CIN5 => CIN5,
+   CIN4 => CIN4,
+   CIN3 => CIN3,
+   CIN2 => CIN2,
+   CIN1 => CIN1,
+   CIN0 => CIN0,
+   CYAWSTN => CYAWSTN,
+   FF_EBRD_CLK_3 => FF_EBRD_CLK_3,
+   FF_EBRD_CLK_2 => FF_EBRD_CLK_2,
+   FF_EBRD_CLK_1 => FF_EBRD_CLK_1,
+   FF_EBRD_CLK_0 => FF_EBRD_CLK_0,
+   FF_RXI_CLK_3 => FF_RXI_CLK_3,
+   FF_RXI_CLK_2 => FF_RXI_CLK_2,
+   FF_RXI_CLK_1 => FF_RXI_CLK_1,
+   FF_RXI_CLK_0 => FF_RXI_CLK_0,
+   FF_TX_D_0_0 => FF_TX_D_0_0,
+   FF_TX_D_0_1 => FF_TX_D_0_1,
+   FF_TX_D_0_2 => FF_TX_D_0_2,
+   FF_TX_D_0_3 => FF_TX_D_0_3,
+   FF_TX_D_0_4 => FF_TX_D_0_4,
+   FF_TX_D_0_5 => FF_TX_D_0_5,
+   FF_TX_D_0_6 => FF_TX_D_0_6,
+   FF_TX_D_0_7 => FF_TX_D_0_7,
+   FF_TX_D_0_8 => FF_TX_D_0_8,
+   FF_TX_D_0_9 => FF_TX_D_0_9,
+   FF_TX_D_0_10 => FF_TX_D_0_10,
+   FF_TX_D_0_11 => FF_TX_D_0_11,
+   FF_TX_D_0_12 => FF_TX_D_0_12,
+   FF_TX_D_0_13 => FF_TX_D_0_13,
+   FF_TX_D_0_14 => FF_TX_D_0_14,
+   FF_TX_D_0_15 => FF_TX_D_0_15,
+   FF_TX_D_0_16 => FF_TX_D_0_16,
+   FF_TX_D_0_17 => FF_TX_D_0_17,
+   FF_TX_D_0_18 => FF_TX_D_0_18,
+   FF_TX_D_0_19 => FF_TX_D_0_19,
+   FF_TX_D_0_20 => FF_TX_D_0_20,
+   FF_TX_D_0_21 => FF_TX_D_0_21,
+   FF_TX_D_0_22 => FF_TX_D_0_22,
+   FF_TX_D_0_23 => FF_TX_D_0_23,
+   FF_TX_D_1_0 => FF_TX_D_1_0,
+   FF_TX_D_1_1 => FF_TX_D_1_1,
+   FF_TX_D_1_2 => FF_TX_D_1_2,
+   FF_TX_D_1_3 => FF_TX_D_1_3,
+   FF_TX_D_1_4 => FF_TX_D_1_4,
+   FF_TX_D_1_5 => FF_TX_D_1_5,
+   FF_TX_D_1_6 => FF_TX_D_1_6,
+   FF_TX_D_1_7 => FF_TX_D_1_7,
+   FF_TX_D_1_8 => FF_TX_D_1_8,
+   FF_TX_D_1_9 => FF_TX_D_1_9,
+   FF_TX_D_1_10 => FF_TX_D_1_10,
+   FF_TX_D_1_11 => FF_TX_D_1_11,
+   FF_TX_D_1_12 => FF_TX_D_1_12,
+   FF_TX_D_1_13 => FF_TX_D_1_13,
+   FF_TX_D_1_14 => FF_TX_D_1_14,
+   FF_TX_D_1_15 => FF_TX_D_1_15,
+   FF_TX_D_1_16 => FF_TX_D_1_16,
+   FF_TX_D_1_17 => FF_TX_D_1_17,
+   FF_TX_D_1_18 => FF_TX_D_1_18,
+   FF_TX_D_1_19 => FF_TX_D_1_19,
+   FF_TX_D_1_20 => FF_TX_D_1_20,
+   FF_TX_D_1_21 => FF_TX_D_1_21,
+   FF_TX_D_1_22 => FF_TX_D_1_22,
+   FF_TX_D_1_23 => FF_TX_D_1_23,
+   FF_TX_D_2_0 => FF_TX_D_2_0,
+   FF_TX_D_2_1 => FF_TX_D_2_1,
+   FF_TX_D_2_2 => FF_TX_D_2_2,
+   FF_TX_D_2_3 => FF_TX_D_2_3,
+   FF_TX_D_2_4 => FF_TX_D_2_4,
+   FF_TX_D_2_5 => FF_TX_D_2_5,
+   FF_TX_D_2_6 => FF_TX_D_2_6,
+   FF_TX_D_2_7 => FF_TX_D_2_7,
+   FF_TX_D_2_8 => FF_TX_D_2_8,
+   FF_TX_D_2_9 => FF_TX_D_2_9,
+   FF_TX_D_2_10 => FF_TX_D_2_10,
+   FF_TX_D_2_11 => FF_TX_D_2_11,
+   FF_TX_D_2_12 => FF_TX_D_2_12,
+   FF_TX_D_2_13 => FF_TX_D_2_13,
+   FF_TX_D_2_14 => FF_TX_D_2_14,
+   FF_TX_D_2_15 => FF_TX_D_2_15,
+   FF_TX_D_2_16 => FF_TX_D_2_16,
+   FF_TX_D_2_17 => FF_TX_D_2_17,
+   FF_TX_D_2_18 => FF_TX_D_2_18,
+   FF_TX_D_2_19 => FF_TX_D_2_19,
+   FF_TX_D_2_20 => FF_TX_D_2_20,
+   FF_TX_D_2_21 => FF_TX_D_2_21,
+   FF_TX_D_2_22 => FF_TX_D_2_22,
+   FF_TX_D_2_23 => FF_TX_D_2_23,
+   FF_TX_D_3_0 => FF_TX_D_3_0,
+   FF_TX_D_3_1 => FF_TX_D_3_1,
+   FF_TX_D_3_2 => FF_TX_D_3_2,
+   FF_TX_D_3_3 => FF_TX_D_3_3,
+   FF_TX_D_3_4 => FF_TX_D_3_4,
+   FF_TX_D_3_5 => FF_TX_D_3_5,
+   FF_TX_D_3_6 => FF_TX_D_3_6,
+   FF_TX_D_3_7 => FF_TX_D_3_7,
+   FF_TX_D_3_8 => FF_TX_D_3_8,
+   FF_TX_D_3_9 => FF_TX_D_3_9,
+   FF_TX_D_3_10 => FF_TX_D_3_10,
+   FF_TX_D_3_11 => FF_TX_D_3_11,
+   FF_TX_D_3_12 => FF_TX_D_3_12,
+   FF_TX_D_3_13 => FF_TX_D_3_13,
+   FF_TX_D_3_14 => FF_TX_D_3_14,
+   FF_TX_D_3_15 => FF_TX_D_3_15,
+   FF_TX_D_3_16 => FF_TX_D_3_16,
+   FF_TX_D_3_17 => FF_TX_D_3_17,
+   FF_TX_D_3_18 => FF_TX_D_3_18,
+   FF_TX_D_3_19 => FF_TX_D_3_19,
+   FF_TX_D_3_20 => FF_TX_D_3_20,
+   FF_TX_D_3_21 => FF_TX_D_3_21,
+   FF_TX_D_3_22 => FF_TX_D_3_22,
+   FF_TX_D_3_23 => FF_TX_D_3_23,
+   FF_TXI_CLK_0 => FF_TXI_CLK_0,
+   FF_TXI_CLK_1 => FF_TXI_CLK_1,
+   FF_TXI_CLK_2 => FF_TXI_CLK_2,
+   FF_TXI_CLK_3 => FF_TXI_CLK_3,
+   FFC_CK_CORE_RX_0 => FFC_CK_CORE_RX_0,
+   FFC_CK_CORE_RX_1 => FFC_CK_CORE_RX_1,
+   FFC_CK_CORE_RX_2 => FFC_CK_CORE_RX_2,
+   FFC_CK_CORE_RX_3 => FFC_CK_CORE_RX_3,
+   FFC_CK_CORE_TX => FFC_CK_CORE_TX,
+   FFC_EI_EN_0 => FFC_EI_EN_0,
+   FFC_EI_EN_1 => FFC_EI_EN_1,
+   FFC_EI_EN_2 => FFC_EI_EN_2,
+   FFC_EI_EN_3 => FFC_EI_EN_3,
+   FFC_ENABLE_CGALIGN_0 => FFC_ENABLE_CGALIGN_0,
+   FFC_ENABLE_CGALIGN_1 => FFC_ENABLE_CGALIGN_1,
+   FFC_ENABLE_CGALIGN_2 => FFC_ENABLE_CGALIGN_2,
+   FFC_ENABLE_CGALIGN_3 => FFC_ENABLE_CGALIGN_3,
+   FFC_FB_LOOPBACK_0 => FFC_FB_LOOPBACK_0,
+   FFC_FB_LOOPBACK_1 => FFC_FB_LOOPBACK_1,
+   FFC_FB_LOOPBACK_2 => FFC_FB_LOOPBACK_2,
+   FFC_FB_LOOPBACK_3 => FFC_FB_LOOPBACK_3,
+   FFC_LANE_RX_RST_0 => FFC_LANE_RX_RST_0,
+   FFC_LANE_RX_RST_1 => FFC_LANE_RX_RST_1,
+   FFC_LANE_RX_RST_2 => FFC_LANE_RX_RST_2,
+   FFC_LANE_RX_RST_3 => FFC_LANE_RX_RST_3,
+   FFC_LANE_TX_RST_0 => FFC_LANE_TX_RST_0,
+   FFC_LANE_TX_RST_1 => FFC_LANE_TX_RST_1,
+   FFC_LANE_TX_RST_2 => FFC_LANE_TX_RST_2,
+   FFC_LANE_TX_RST_3 => FFC_LANE_TX_RST_3,
+   FFC_MACRO_RST => FFC_MACRO_RST,
+   FFC_PCI_DET_EN_0 => FFC_PCI_DET_EN_0,
+   FFC_PCI_DET_EN_1 => FFC_PCI_DET_EN_1,
+   FFC_PCI_DET_EN_2 => FFC_PCI_DET_EN_2,
+   FFC_PCI_DET_EN_3 => FFC_PCI_DET_EN_3,
+   FFC_PCIE_CT_0 => FFC_PCIE_CT_0,
+   FFC_PCIE_CT_1 => FFC_PCIE_CT_1,
+   FFC_PCIE_CT_2 => FFC_PCIE_CT_2,
+   FFC_PCIE_CT_3 => FFC_PCIE_CT_3,
+   FFC_PFIFO_CLR_0 => FFC_PFIFO_CLR_0,
+   FFC_PFIFO_CLR_1 => FFC_PFIFO_CLR_1,
+   FFC_PFIFO_CLR_2 => FFC_PFIFO_CLR_2,
+   FFC_PFIFO_CLR_3 => FFC_PFIFO_CLR_3,
+   FFC_QUAD_RST => FFC_QUAD_RST,
+   FFC_RRST_0 => FFC_RRST_0,
+   FFC_RRST_1 => FFC_RRST_1,
+   FFC_RRST_2 => FFC_RRST_2,
+   FFC_RRST_3 => FFC_RRST_3,
+   FFC_RXPWDNB_0 => FFC_RXPWDNB_0,
+   FFC_RXPWDNB_1 => FFC_RXPWDNB_1,
+   FFC_RXPWDNB_2 => FFC_RXPWDNB_2,
+   FFC_RXPWDNB_3 => FFC_RXPWDNB_3,
+   FFC_SB_INV_RX_0 => FFC_SB_INV_RX_0,
+   FFC_SB_INV_RX_1 => FFC_SB_INV_RX_1,
+   FFC_SB_INV_RX_2 => FFC_SB_INV_RX_2,
+   FFC_SB_INV_RX_3 => FFC_SB_INV_RX_3,
+   FFC_SB_PFIFO_LP_0 => FFC_SB_PFIFO_LP_0,
+   FFC_SB_PFIFO_LP_1 => FFC_SB_PFIFO_LP_1,
+   FFC_SB_PFIFO_LP_2 => FFC_SB_PFIFO_LP_2,
+   FFC_SB_PFIFO_LP_3 => FFC_SB_PFIFO_LP_3,
+   FFC_SIGNAL_DETECT_0 => FFC_SIGNAL_DETECT_0,
+   FFC_SIGNAL_DETECT_1 => FFC_SIGNAL_DETECT_1,
+   FFC_SIGNAL_DETECT_2 => FFC_SIGNAL_DETECT_2,
+   FFC_SIGNAL_DETECT_3 => FFC_SIGNAL_DETECT_3,
+   FFC_SYNC_TOGGLE => FFC_SYNC_TOGGLE,
+   FFC_TRST => FFC_TRST,
+   FFC_TXPWDNB_0 => FFC_TXPWDNB_0,
+   FFC_TXPWDNB_1 => FFC_TXPWDNB_1,
+   FFC_TXPWDNB_2 => FFC_TXPWDNB_2,
+   FFC_TXPWDNB_3 => FFC_TXPWDNB_3,
+   FFC_RATE_MODE_RX_0 => FFC_RATE_MODE_RX_0,
+   FFC_RATE_MODE_RX_1 => FFC_RATE_MODE_RX_1,
+   FFC_RATE_MODE_RX_2 => FFC_RATE_MODE_RX_2,
+   FFC_RATE_MODE_RX_3 => FFC_RATE_MODE_RX_3,
+   FFC_RATE_MODE_TX_0 => FFC_RATE_MODE_TX_0,
+   FFC_RATE_MODE_TX_1 => FFC_RATE_MODE_TX_1,
+   FFC_RATE_MODE_TX_2 => FFC_RATE_MODE_TX_2,
+   FFC_RATE_MODE_TX_3 => FFC_RATE_MODE_TX_3,
+   FFC_DIV11_MODE_RX_0 => FFC_DIV11_MODE_RX_0,
+   FFC_DIV11_MODE_RX_1 => FFC_DIV11_MODE_RX_1,
+   FFC_DIV11_MODE_RX_2 => FFC_DIV11_MODE_RX_2,
+   FFC_DIV11_MODE_RX_3 => FFC_DIV11_MODE_RX_3,
+   FFC_DIV11_MODE_TX_0 => FFC_DIV11_MODE_TX_0,
+   FFC_DIV11_MODE_TX_1 => FFC_DIV11_MODE_TX_1,
+   FFC_DIV11_MODE_TX_2 => FFC_DIV11_MODE_TX_2,
+   FFC_DIV11_MODE_TX_3 => FFC_DIV11_MODE_TX_3,
+   LDR_CORE2TX_0 => LDR_CORE2TX_0,
+   LDR_CORE2TX_1 => LDR_CORE2TX_1,
+   LDR_CORE2TX_2 => LDR_CORE2TX_2,
+   LDR_CORE2TX_3 => LDR_CORE2TX_3,
+   FFC_LDR_CORE2TX_EN_0 => FFC_LDR_CORE2TX_EN_0,
+   FFC_LDR_CORE2TX_EN_1 => FFC_LDR_CORE2TX_EN_1,
+   FFC_LDR_CORE2TX_EN_2 => FFC_LDR_CORE2TX_EN_2,
+   FFC_LDR_CORE2TX_EN_3 => FFC_LDR_CORE2TX_EN_3,
+   PCIE_POWERDOWN_0_0 => PCIE_POWERDOWN_0_0,
+   PCIE_POWERDOWN_0_1 => PCIE_POWERDOWN_0_1,
+   PCIE_POWERDOWN_1_0 => PCIE_POWERDOWN_1_0,
+   PCIE_POWERDOWN_1_1 => PCIE_POWERDOWN_1_1,
+   PCIE_POWERDOWN_2_0 => PCIE_POWERDOWN_2_0,
+   PCIE_POWERDOWN_2_1 => PCIE_POWERDOWN_2_1,
+   PCIE_POWERDOWN_3_0 => PCIE_POWERDOWN_3_0,
+   PCIE_POWERDOWN_3_1 => PCIE_POWERDOWN_3_1,
+   PCIE_RXPOLARITY_0 => PCIE_RXPOLARITY_0,
+   PCIE_RXPOLARITY_1 => PCIE_RXPOLARITY_1,
+   PCIE_RXPOLARITY_2 => PCIE_RXPOLARITY_2,
+   PCIE_RXPOLARITY_3 => PCIE_RXPOLARITY_3,
+   PCIE_TXCOMPLIANCE_0 => PCIE_TXCOMPLIANCE_0,
+   PCIE_TXCOMPLIANCE_1 => PCIE_TXCOMPLIANCE_1,
+   PCIE_TXCOMPLIANCE_2 => PCIE_TXCOMPLIANCE_2,
+   PCIE_TXCOMPLIANCE_3 => PCIE_TXCOMPLIANCE_3,
+   PCIE_TXDETRX_PR2TLB_0 => PCIE_TXDETRX_PR2TLB_0,
+   PCIE_TXDETRX_PR2TLB_1 => PCIE_TXDETRX_PR2TLB_1,
+   PCIE_TXDETRX_PR2TLB_2 => PCIE_TXDETRX_PR2TLB_2,
+   PCIE_TXDETRX_PR2TLB_3 => PCIE_TXDETRX_PR2TLB_3,
+   SCIADDR0 => SCIADDR0,
+   SCIADDR1 => SCIADDR1,
+   SCIADDR2 => SCIADDR2,
+   SCIADDR3 => SCIADDR3,
+   SCIADDR4 => SCIADDR4,
+   SCIADDR5 => SCIADDR5,
+   SCIENAUX => SCIENAUX,
+   SCIENCH0 => SCIENCH0,
+   SCIENCH1 => SCIENCH1,
+   SCIENCH2 => SCIENCH2,
+   SCIENCH3 => SCIENCH3,
+   SCIRD => SCIRD,
+   SCISELAUX => SCISELAUX,
+   SCISELCH0 => SCISELCH0,
+   SCISELCH1 => SCISELCH1,
+   SCISELCH2 => SCISELCH2,
+   SCISELCH3 => SCISELCH3,
+   SCIWDATA0 => SCIWDATA0,
+   SCIWDATA1 => SCIWDATA1,
+   SCIWDATA2 => SCIWDATA2,
+   SCIWDATA3 => SCIWDATA3,
+   SCIWDATA4 => SCIWDATA4,
+   SCIWDATA5 => SCIWDATA5,
+   SCIWDATA6 => SCIWDATA6,
+   SCIWDATA7 => SCIWDATA7,
+   SCIWSTN => SCIWSTN,
+   HDOUTN0 => HDOUTN0,
+   HDOUTN1 => HDOUTN1,
+   HDOUTN2 => HDOUTN2,
+   HDOUTN3 => HDOUTN3,
+   HDOUTP0 => HDOUTP0,
+   HDOUTP1 => HDOUTP1,
+   HDOUTP2 => HDOUTP2,
+   HDOUTP3 => HDOUTP3,
+   COUT19 => COUT19,
+   COUT18 => COUT18,
+   COUT17 => COUT17,
+   COUT16 => COUT16,
+   COUT15 => COUT15,
+   COUT14 => COUT14,
+   COUT13 => COUT13,
+   COUT12 => COUT12,
+   COUT11 => COUT11,
+   COUT10 => COUT10,
+   COUT9 => COUT9,
+   COUT8 => COUT8,
+   COUT7 => COUT7,
+   COUT6 => COUT6,
+   COUT5 => COUT5,
+   COUT4 => COUT4,
+   COUT3 => COUT3,
+   COUT2 => COUT2,
+   COUT1 => COUT1,
+   COUT0 => COUT0,
+   FF_RX_D_0_0 => FF_RX_D_0_0,
+   FF_RX_D_0_1 => FF_RX_D_0_1,
+   FF_RX_D_0_2 => FF_RX_D_0_2,
+   FF_RX_D_0_3 => FF_RX_D_0_3,
+   FF_RX_D_0_4 => FF_RX_D_0_4,
+   FF_RX_D_0_5 => FF_RX_D_0_5,
+   FF_RX_D_0_6 => FF_RX_D_0_6,
+   FF_RX_D_0_7 => FF_RX_D_0_7,
+   FF_RX_D_0_8 => FF_RX_D_0_8,
+   FF_RX_D_0_9 => FF_RX_D_0_9,
+   FF_RX_D_0_10 => FF_RX_D_0_10,
+   FF_RX_D_0_11 => FF_RX_D_0_11,
+   FF_RX_D_0_12 => FF_RX_D_0_12,
+   FF_RX_D_0_13 => FF_RX_D_0_13,
+   FF_RX_D_0_14 => FF_RX_D_0_14,
+   FF_RX_D_0_15 => FF_RX_D_0_15,
+   FF_RX_D_0_16 => FF_RX_D_0_16,
+   FF_RX_D_0_17 => FF_RX_D_0_17,
+   FF_RX_D_0_18 => FF_RX_D_0_18,
+   FF_RX_D_0_19 => FF_RX_D_0_19,
+   FF_RX_D_0_20 => FF_RX_D_0_20,
+   FF_RX_D_0_21 => FF_RX_D_0_21,
+   FF_RX_D_0_22 => FF_RX_D_0_22,
+   FF_RX_D_0_23 => FF_RX_D_0_23,
+   FF_RX_D_1_0 => FF_RX_D_1_0,
+   FF_RX_D_1_1 => FF_RX_D_1_1,
+   FF_RX_D_1_2 => FF_RX_D_1_2,
+   FF_RX_D_1_3 => FF_RX_D_1_3,
+   FF_RX_D_1_4 => FF_RX_D_1_4,
+   FF_RX_D_1_5 => FF_RX_D_1_5,
+   FF_RX_D_1_6 => FF_RX_D_1_6,
+   FF_RX_D_1_7 => FF_RX_D_1_7,
+   FF_RX_D_1_8 => FF_RX_D_1_8,
+   FF_RX_D_1_9 => FF_RX_D_1_9,
+   FF_RX_D_1_10 => FF_RX_D_1_10,
+   FF_RX_D_1_11 => FF_RX_D_1_11,
+   FF_RX_D_1_12 => FF_RX_D_1_12,
+   FF_RX_D_1_13 => FF_RX_D_1_13,
+   FF_RX_D_1_14 => FF_RX_D_1_14,
+   FF_RX_D_1_15 => FF_RX_D_1_15,
+   FF_RX_D_1_16 => FF_RX_D_1_16,
+   FF_RX_D_1_17 => FF_RX_D_1_17,
+   FF_RX_D_1_18 => FF_RX_D_1_18,
+   FF_RX_D_1_19 => FF_RX_D_1_19,
+   FF_RX_D_1_20 => FF_RX_D_1_20,
+   FF_RX_D_1_21 => FF_RX_D_1_21,
+   FF_RX_D_1_22 => FF_RX_D_1_22,
+   FF_RX_D_1_23 => FF_RX_D_1_23,
+   FF_RX_D_2_0 => FF_RX_D_2_0,
+   FF_RX_D_2_1 => FF_RX_D_2_1,
+   FF_RX_D_2_2 => FF_RX_D_2_2,
+   FF_RX_D_2_3 => FF_RX_D_2_3,
+   FF_RX_D_2_4 => FF_RX_D_2_4,
+   FF_RX_D_2_5 => FF_RX_D_2_5,
+   FF_RX_D_2_6 => FF_RX_D_2_6,
+   FF_RX_D_2_7 => FF_RX_D_2_7,
+   FF_RX_D_2_8 => FF_RX_D_2_8,
+   FF_RX_D_2_9 => FF_RX_D_2_9,
+   FF_RX_D_2_10 => FF_RX_D_2_10,
+   FF_RX_D_2_11 => FF_RX_D_2_11,
+   FF_RX_D_2_12 => FF_RX_D_2_12,
+   FF_RX_D_2_13 => FF_RX_D_2_13,
+   FF_RX_D_2_14 => FF_RX_D_2_14,
+   FF_RX_D_2_15 => FF_RX_D_2_15,
+   FF_RX_D_2_16 => FF_RX_D_2_16,
+   FF_RX_D_2_17 => FF_RX_D_2_17,
+   FF_RX_D_2_18 => FF_RX_D_2_18,
+   FF_RX_D_2_19 => FF_RX_D_2_19,
+   FF_RX_D_2_20 => FF_RX_D_2_20,
+   FF_RX_D_2_21 => FF_RX_D_2_21,
+   FF_RX_D_2_22 => FF_RX_D_2_22,
+   FF_RX_D_2_23 => FF_RX_D_2_23,
+   FF_RX_D_3_0 => FF_RX_D_3_0,
+   FF_RX_D_3_1 => FF_RX_D_3_1,
+   FF_RX_D_3_2 => FF_RX_D_3_2,
+   FF_RX_D_3_3 => FF_RX_D_3_3,
+   FF_RX_D_3_4 => FF_RX_D_3_4,
+   FF_RX_D_3_5 => FF_RX_D_3_5,
+   FF_RX_D_3_6 => FF_RX_D_3_6,
+   FF_RX_D_3_7 => FF_RX_D_3_7,
+   FF_RX_D_3_8 => FF_RX_D_3_8,
+   FF_RX_D_3_9 => FF_RX_D_3_9,
+   FF_RX_D_3_10 => FF_RX_D_3_10,
+   FF_RX_D_3_11 => FF_RX_D_3_11,
+   FF_RX_D_3_12 => FF_RX_D_3_12,
+   FF_RX_D_3_13 => FF_RX_D_3_13,
+   FF_RX_D_3_14 => FF_RX_D_3_14,
+   FF_RX_D_3_15 => FF_RX_D_3_15,
+   FF_RX_D_3_16 => FF_RX_D_3_16,
+   FF_RX_D_3_17 => FF_RX_D_3_17,
+   FF_RX_D_3_18 => FF_RX_D_3_18,
+   FF_RX_D_3_19 => FF_RX_D_3_19,
+   FF_RX_D_3_20 => FF_RX_D_3_20,
+   FF_RX_D_3_21 => FF_RX_D_3_21,
+   FF_RX_D_3_22 => FF_RX_D_3_22,
+   FF_RX_D_3_23 => FF_RX_D_3_23,
+   FF_RX_F_CLK_0 => FF_RX_F_CLK_0,
+   FF_RX_F_CLK_1 => FF_RX_F_CLK_1,
+   FF_RX_F_CLK_2 => FF_RX_F_CLK_2,
+   FF_RX_F_CLK_3 => FF_RX_F_CLK_3,
+   FF_RX_H_CLK_0 => FF_RX_H_CLK_0,
+   FF_RX_H_CLK_1 => FF_RX_H_CLK_1,
+   FF_RX_H_CLK_2 => FF_RX_H_CLK_2,
+   FF_RX_H_CLK_3 => FF_RX_H_CLK_3,
+   FF_TX_F_CLK_0 => FF_TX_F_CLK_0,
+   FF_TX_F_CLK_1 => FF_TX_F_CLK_1,
+   FF_TX_F_CLK_2 => FF_TX_F_CLK_2,
+   FF_TX_F_CLK_3 => FF_TX_F_CLK_3,
+   FF_TX_H_CLK_0 => FF_TX_H_CLK_0,
+   FF_TX_H_CLK_1 => FF_TX_H_CLK_1,
+   FF_TX_H_CLK_2 => FF_TX_H_CLK_2,
+   FF_TX_H_CLK_3 => FF_TX_H_CLK_3,
+   FFS_CC_OVERRUN_0 => FFS_CC_OVERRUN_0,
+   FFS_CC_OVERRUN_1 => FFS_CC_OVERRUN_1,
+   FFS_CC_OVERRUN_2 => FFS_CC_OVERRUN_2,
+   FFS_CC_OVERRUN_3 => FFS_CC_OVERRUN_3,
+   FFS_CC_UNDERRUN_0 => FFS_CC_UNDERRUN_0,
+   FFS_CC_UNDERRUN_1 => FFS_CC_UNDERRUN_1,
+   FFS_CC_UNDERRUN_2 => FFS_CC_UNDERRUN_2,
+   FFS_CC_UNDERRUN_3 => FFS_CC_UNDERRUN_3,
+   FFS_LS_SYNC_STATUS_0 => FFS_LS_SYNC_STATUS_0,
+   FFS_LS_SYNC_STATUS_1 => FFS_LS_SYNC_STATUS_1,
+   FFS_LS_SYNC_STATUS_2 => FFS_LS_SYNC_STATUS_2,
+   FFS_LS_SYNC_STATUS_3 => FFS_LS_SYNC_STATUS_3,
+   FFS_CDR_TRAIN_DONE_0 => FFS_CDR_TRAIN_DONE_0,
+   FFS_CDR_TRAIN_DONE_1 => FFS_CDR_TRAIN_DONE_1,
+   FFS_CDR_TRAIN_DONE_2 => FFS_CDR_TRAIN_DONE_2,
+   FFS_CDR_TRAIN_DONE_3 => FFS_CDR_TRAIN_DONE_3,
+   FFS_PCIE_CON_0 => FFS_PCIE_CON_0,
+   FFS_PCIE_CON_1 => FFS_PCIE_CON_1,
+   FFS_PCIE_CON_2 => FFS_PCIE_CON_2,
+   FFS_PCIE_CON_3 => FFS_PCIE_CON_3,
+   FFS_PCIE_DONE_0 => FFS_PCIE_DONE_0,
+   FFS_PCIE_DONE_1 => FFS_PCIE_DONE_1,
+   FFS_PCIE_DONE_2 => FFS_PCIE_DONE_2,
+   FFS_PCIE_DONE_3 => FFS_PCIE_DONE_3,
+   FFS_PLOL => FFS_PLOL,
+   FFS_RLOL_0 => FFS_RLOL_0,
+   FFS_RLOL_1 => FFS_RLOL_1,
+   FFS_RLOL_2 => FFS_RLOL_2,
+   FFS_RLOL_3 => FFS_RLOL_3,
+   FFS_RLOS_HI_0 => FFS_RLOS_HI_0,
+   FFS_RLOS_HI_1 => FFS_RLOS_HI_1,
+   FFS_RLOS_HI_2 => FFS_RLOS_HI_2,
+   FFS_RLOS_HI_3 => FFS_RLOS_HI_3,
+   FFS_RLOS_LO_0 => FFS_RLOS_LO_0,
+   FFS_RLOS_LO_1 => FFS_RLOS_LO_1,
+   FFS_RLOS_LO_2 => FFS_RLOS_LO_2,
+   FFS_RLOS_LO_3 => FFS_RLOS_LO_3,
+   FFS_RXFBFIFO_ERROR_0 => FFS_RXFBFIFO_ERROR_0,
+   FFS_RXFBFIFO_ERROR_1 => FFS_RXFBFIFO_ERROR_1,
+   FFS_RXFBFIFO_ERROR_2 => FFS_RXFBFIFO_ERROR_2,
+   FFS_RXFBFIFO_ERROR_3 => FFS_RXFBFIFO_ERROR_3,
+   FFS_TXFBFIFO_ERROR_0 => FFS_TXFBFIFO_ERROR_0,
+   FFS_TXFBFIFO_ERROR_1 => FFS_TXFBFIFO_ERROR_1,
+   FFS_TXFBFIFO_ERROR_2 => FFS_TXFBFIFO_ERROR_2,
+   FFS_TXFBFIFO_ERROR_3 => FFS_TXFBFIFO_ERROR_3,
+   PCIE_PHYSTATUS_0 => PCIE_PHYSTATUS_0,
+   PCIE_PHYSTATUS_1 => PCIE_PHYSTATUS_1,
+   PCIE_PHYSTATUS_2 => PCIE_PHYSTATUS_2,
+   PCIE_PHYSTATUS_3 => PCIE_PHYSTATUS_3,
+   PCIE_RXVALID_0 => PCIE_RXVALID_0,
+   PCIE_RXVALID_1 => PCIE_RXVALID_1,
+   PCIE_RXVALID_2 => PCIE_RXVALID_2,
+   PCIE_RXVALID_3 => PCIE_RXVALID_3,
+   FFS_SKP_ADDED_0 => FFS_SKP_ADDED_0,
+   FFS_SKP_ADDED_1 => FFS_SKP_ADDED_1,
+   FFS_SKP_ADDED_2 => FFS_SKP_ADDED_2,
+   FFS_SKP_ADDED_3 => FFS_SKP_ADDED_3,
+   FFS_SKP_DELETED_0 => FFS_SKP_DELETED_0,
+   FFS_SKP_DELETED_1 => FFS_SKP_DELETED_1,
+   FFS_SKP_DELETED_2 => FFS_SKP_DELETED_2,
+   FFS_SKP_DELETED_3 => FFS_SKP_DELETED_3,
+   LDR_RX2CORE_0 => LDR_RX2CORE_0,
+   LDR_RX2CORE_1 => LDR_RX2CORE_1,
+   LDR_RX2CORE_2 => LDR_RX2CORE_2,
+   LDR_RX2CORE_3 => LDR_RX2CORE_3,
+   REFCK2CORE => REFCK2CORE,
+   SCIINT => SCIINT,
+   SCIRDATA0 => SCIRDATA0,
+   SCIRDATA1 => SCIRDATA1,
+   SCIRDATA2 => SCIRDATA2,
+   SCIRDATA3 => SCIRDATA3,
+   SCIRDATA4 => SCIRDATA4,
+   SCIRDATA5 => SCIRDATA5,
+   SCIRDATA6 => SCIRDATA6,
+   SCIRDATA7 => SCIRDATA7,
+   REFCLK_FROM_NQ => REFCLK_FROM_NQ,
+   REFCLK_TO_NQ => REFCLK_TO_NQ
+   );
+
+end PCSD_arch;
+
+--synopsys translate_on
+
+
+
+
+--synopsys translate_off
+library ECP3;
+use ECP3.components.all;
+--synopsys translate_on
+
+
+library IEEE, STD;
+use IEEE.std_logic_1164.all;
+use STD.TEXTIO.all;
+
+entity serdes is
+   GENERIC (USER_CONFIG_FILE    :  String := "serdes.txt");
+ port (
+------------------
+-- CH0 --
+    hdinp_ch0, hdinn_ch0    :   in std_logic;
+    hdoutp_ch0, hdoutn_ch0   :   out 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;
+    tx_full_clk_ch0   :   out std_logic;
+    tx_half_clk_ch0   :   out std_logic;
+    fpga_rxrefclk_ch0    :   in std_logic;
+    txdata_ch0    :   in std_logic_vector (7 downto 0);
+    tx_k_ch0    :   in std_logic;
+    xmit_ch0    :   in std_logic;
+    tx_disp_correct_ch0    :   in std_logic;
+    rxdata_ch0   :   out std_logic_vector (7 downto 0);
+    rx_k_ch0   :   out std_logic;
+    rx_disp_err_ch0   :   out std_logic;
+    rx_cv_err_ch0   :   out std_logic;
+    rx_serdes_rst_ch0_c    :   in std_logic;
+    sb_felb_ch0_c    :   in std_logic;
+    sb_felb_rst_ch0_c    :   in std_logic;
+    tx_pcs_rst_ch0_c    :   in std_logic;
+    tx_pwrup_ch0_c    :   in std_logic;
+    rx_pcs_rst_ch0_c    :   in std_logic;
+    rx_pwrup_ch0_c    :   in std_logic;
+    rx_los_low_ch0_s   :   out std_logic;
+    lsm_status_ch0_s   :   out std_logic;
+    rx_cdr_lol_ch0_s   :   out std_logic;
+-- CH1 --
+    hdinp_ch1, hdinn_ch1    :   in std_logic;
+    hdoutp_ch1, hdoutn_ch1   :   out std_logic;
+    rxiclk_ch1    :   in std_logic;
+    txiclk_ch1    :   in std_logic;
+    rx_full_clk_ch1   :   out std_logic;
+    rx_half_clk_ch1   :   out std_logic;
+    tx_full_clk_ch1   :   out std_logic;
+    tx_half_clk_ch1   :   out std_logic;
+    fpga_rxrefclk_ch1    :   in std_logic;
+    txdata_ch1    :   in std_logic_vector (7 downto 0);
+    tx_k_ch1    :   in std_logic;
+    xmit_ch1    :   in std_logic;
+    tx_disp_correct_ch1    :   in std_logic;
+    rxdata_ch1   :   out std_logic_vector (7 downto 0);
+    rx_k_ch1   :   out std_logic;
+    rx_disp_err_ch1   :   out std_logic;
+    rx_cv_err_ch1   :   out std_logic;
+    rx_serdes_rst_ch1_c    :   in std_logic;
+    sb_felb_ch1_c    :   in std_logic;
+    sb_felb_rst_ch1_c    :   in std_logic;
+    tx_pcs_rst_ch1_c    :   in std_logic;
+    tx_pwrup_ch1_c    :   in std_logic;
+    rx_pcs_rst_ch1_c    :   in std_logic;
+    rx_pwrup_ch1_c    :   in std_logic;
+    rx_los_low_ch1_s   :   out std_logic;
+    lsm_status_ch1_s   :   out std_logic;
+    rx_cdr_lol_ch1_s   :   out std_logic;
+-- CH2 --
+-- CH3 --
+---- Miscillaneous ports
+    fpga_txrefclk  :   in std_logic;
+    tx_serdes_rst_c    :   in std_logic;
+    tx_pll_lol_qd_s   :   out std_logic;
+    tx_sync_qd_c    :   in std_logic;
+    rst_qd_c    :   in std_logic;
+    serdes_rst_qd_c    :   in std_logic);
+
+end serdes;
+
+
+architecture serdes_arch of serdes is
+
+component VLO
+port (
+   Z : out std_logic);
+end component;
+
+component VHI
+port (
+   Z : out std_logic);
+end component;
+
+
+
+component PCSD
+--synopsys translate_off
+GENERIC(
+  CONFIG_FILE : String;
+  QUAD_MODE : String;
+  CH0_CDR_SRC   : String := "REFCLK_EXT";
+  CH1_CDR_SRC   : String := "REFCLK_EXT";
+  CH2_CDR_SRC   : String := "REFCLK_EXT";
+  CH3_CDR_SRC   : String := "REFCLK_EXT";
+  PLL_SRC   : String
+  );
+--synopsys translate_on
+port (
+  HDINN0             : in std_logic;
+  HDINN1             : in std_logic;
+  HDINN2             : in std_logic;
+  HDINN3             : in std_logic;
+  HDINP0             : in std_logic;
+  HDINP1             : in std_logic;
+  HDINP2             : in std_logic;
+  HDINP3             : in std_logic;
+  REFCLKN             : in std_logic;
+  REFCLKP             : in std_logic;
+  CIN0             : in std_logic;
+  CIN1             : in std_logic;
+  CIN2             : in std_logic;
+  CIN3             : in std_logic;
+  CIN4             : in std_logic;
+  CIN5             : in std_logic;
+  CIN6             : in std_logic;
+  CIN7             : in std_logic;
+  CIN8             : in std_logic;
+  CIN9             : in std_logic;
+  CIN10             : in std_logic;
+  CIN11             : in std_logic;
+  CYAWSTN             : in std_logic;
+  FF_EBRD_CLK_0             : in std_logic;
+  FF_EBRD_CLK_1             : in std_logic;
+  FF_EBRD_CLK_2             : in std_logic;
+  FF_EBRD_CLK_3             : in std_logic;
+  FF_RXI_CLK_0             : in std_logic;
+  FF_RXI_CLK_1             : in std_logic;
+  FF_RXI_CLK_2             : in std_logic;
+  FF_RXI_CLK_3             : in std_logic;
+  FF_TX_D_0_0             : in std_logic;
+  FF_TX_D_0_1             : in std_logic;
+  FF_TX_D_0_2             : in std_logic;
+  FF_TX_D_0_3             : in std_logic;
+  FF_TX_D_0_4             : in std_logic;
+  FF_TX_D_0_5             : in std_logic;
+  FF_TX_D_0_6             : in std_logic;
+  FF_TX_D_0_7             : in std_logic;
+  FF_TX_D_0_8             : in std_logic;
+  FF_TX_D_0_9             : in std_logic;
+  FF_TX_D_0_10             : in std_logic;
+  FF_TX_D_0_11             : in std_logic;
+  FF_TX_D_0_12             : in std_logic;
+  FF_TX_D_0_13             : in std_logic;
+  FF_TX_D_0_14             : in std_logic;
+  FF_TX_D_0_15             : in std_logic;
+  FF_TX_D_0_16             : in std_logic;
+  FF_TX_D_0_17             : in std_logic;
+  FF_TX_D_0_18             : in std_logic;
+  FF_TX_D_0_19             : in std_logic;
+  FF_TX_D_0_20             : in std_logic;
+  FF_TX_D_0_21             : in std_logic;
+  FF_TX_D_0_22             : in std_logic;
+  FF_TX_D_0_23             : in std_logic;
+  FF_TX_D_1_0             : in std_logic;
+  FF_TX_D_1_1             : in std_logic;
+  FF_TX_D_1_2             : in std_logic;
+  FF_TX_D_1_3             : in std_logic;
+  FF_TX_D_1_4             : in std_logic;
+  FF_TX_D_1_5             : in std_logic;
+  FF_TX_D_1_6             : in std_logic;
+  FF_TX_D_1_7             : in std_logic;
+  FF_TX_D_1_8             : in std_logic;
+  FF_TX_D_1_9             : in std_logic;
+  FF_TX_D_1_10             : in std_logic;
+  FF_TX_D_1_11             : in std_logic;
+  FF_TX_D_1_12             : in std_logic;
+  FF_TX_D_1_13             : in std_logic;
+  FF_TX_D_1_14             : in std_logic;
+  FF_TX_D_1_15             : in std_logic;
+  FF_TX_D_1_16             : in std_logic;
+  FF_TX_D_1_17             : in std_logic;
+  FF_TX_D_1_18             : in std_logic;
+  FF_TX_D_1_19             : in std_logic;
+  FF_TX_D_1_20             : in std_logic;
+  FF_TX_D_1_21             : in std_logic;
+  FF_TX_D_1_22             : in std_logic;
+  FF_TX_D_1_23             : in std_logic;
+  FF_TX_D_2_0             : in std_logic;
+  FF_TX_D_2_1             : in std_logic;
+  FF_TX_D_2_2             : in std_logic;
+  FF_TX_D_2_3             : in std_logic;
+  FF_TX_D_2_4             : in std_logic;
+  FF_TX_D_2_5             : in std_logic;
+  FF_TX_D_2_6             : in std_logic;
+  FF_TX_D_2_7             : in std_logic;
+  FF_TX_D_2_8             : in std_logic;
+  FF_TX_D_2_9             : in std_logic;
+  FF_TX_D_2_10             : in std_logic;
+  FF_TX_D_2_11             : in std_logic;
+  FF_TX_D_2_12             : in std_logic;
+  FF_TX_D_2_13             : in std_logic;
+  FF_TX_D_2_14             : in std_logic;
+  FF_TX_D_2_15             : in std_logic;
+  FF_TX_D_2_16             : in std_logic;
+  FF_TX_D_2_17             : in std_logic;
+  FF_TX_D_2_18             : in std_logic;
+  FF_TX_D_2_19             : in std_logic;
+  FF_TX_D_2_20             : in std_logic;
+  FF_TX_D_2_21             : in std_logic;
+  FF_TX_D_2_22             : in std_logic;
+  FF_TX_D_2_23             : in std_logic;
+  FF_TX_D_3_0             : in std_logic;
+  FF_TX_D_3_1             : in std_logic;
+  FF_TX_D_3_2             : in std_logic;
+  FF_TX_D_3_3             : in std_logic;
+  FF_TX_D_3_4             : in std_logic;
+  FF_TX_D_3_5             : in std_logic;
+  FF_TX_D_3_6             : in std_logic;
+  FF_TX_D_3_7             : in std_logic;
+  FF_TX_D_3_8             : in std_logic;
+  FF_TX_D_3_9             : in std_logic;
+  FF_TX_D_3_10             : in std_logic;
+  FF_TX_D_3_11             : in std_logic;
+  FF_TX_D_3_12             : in std_logic;
+  FF_TX_D_3_13             : in std_logic;
+  FF_TX_D_3_14             : in std_logic;
+  FF_TX_D_3_15             : in std_logic;
+  FF_TX_D_3_16             : in std_logic;
+  FF_TX_D_3_17             : in std_logic;
+  FF_TX_D_3_18             : in std_logic;
+  FF_TX_D_3_19             : in std_logic;
+  FF_TX_D_3_20             : in std_logic;
+  FF_TX_D_3_21             : in std_logic;
+  FF_TX_D_3_22             : in std_logic;
+  FF_TX_D_3_23             : in std_logic;
+  FF_TXI_CLK_0             : in std_logic;
+  FF_TXI_CLK_1             : in std_logic;
+  FF_TXI_CLK_2             : in std_logic;
+  FF_TXI_CLK_3             : in std_logic;
+  FFC_CK_CORE_RX_0         : in std_logic;
+  FFC_CK_CORE_RX_1         : in std_logic;
+  FFC_CK_CORE_RX_2         : in std_logic;
+  FFC_CK_CORE_RX_3         : in std_logic;
+  FFC_CK_CORE_TX           : in std_logic;
+  FFC_EI_EN_0             : in std_logic;
+  FFC_EI_EN_1             : in std_logic;
+  FFC_EI_EN_2             : in std_logic;
+  FFC_EI_EN_3             : in std_logic;
+  FFC_ENABLE_CGALIGN_0             : in std_logic;
+  FFC_ENABLE_CGALIGN_1             : in std_logic;
+  FFC_ENABLE_CGALIGN_2             : in std_logic;
+  FFC_ENABLE_CGALIGN_3             : in std_logic;
+  FFC_FB_LOOPBACK_0             : in std_logic;
+  FFC_FB_LOOPBACK_1             : in std_logic;
+  FFC_FB_LOOPBACK_2             : in std_logic;
+  FFC_FB_LOOPBACK_3             : in std_logic;
+  FFC_LANE_RX_RST_0             : in std_logic;
+  FFC_LANE_RX_RST_1             : in std_logic;
+  FFC_LANE_RX_RST_2             : in std_logic;
+  FFC_LANE_RX_RST_3             : in std_logic;
+  FFC_LANE_TX_RST_0             : in std_logic;
+  FFC_LANE_TX_RST_1             : in std_logic;
+  FFC_LANE_TX_RST_2             : in std_logic;
+  FFC_LANE_TX_RST_3             : in std_logic;
+  FFC_MACRO_RST             : in std_logic;
+  FFC_PCI_DET_EN_0             : in std_logic;
+  FFC_PCI_DET_EN_1             : in std_logic;
+  FFC_PCI_DET_EN_2             : in std_logic;
+  FFC_PCI_DET_EN_3             : in std_logic;
+  FFC_PCIE_CT_0             : in std_logic;
+  FFC_PCIE_CT_1             : in std_logic;
+  FFC_PCIE_CT_2             : in std_logic;
+  FFC_PCIE_CT_3             : in std_logic;
+  FFC_PFIFO_CLR_0             : in std_logic;
+  FFC_PFIFO_CLR_1             : in std_logic;
+  FFC_PFIFO_CLR_2             : in std_logic;
+  FFC_PFIFO_CLR_3             : in std_logic;
+  FFC_QUAD_RST             : in std_logic;
+  FFC_RRST_0             : in std_logic;
+  FFC_RRST_1             : in std_logic;
+  FFC_RRST_2             : in std_logic;
+  FFC_RRST_3             : in std_logic;
+  FFC_RXPWDNB_0             : in std_logic;
+  FFC_RXPWDNB_1             : in std_logic;
+  FFC_RXPWDNB_2             : in std_logic;
+  FFC_RXPWDNB_3             : in std_logic;
+  FFC_SB_INV_RX_0             : in std_logic;
+  FFC_SB_INV_RX_1             : in std_logic;
+  FFC_SB_INV_RX_2             : in std_logic;
+  FFC_SB_INV_RX_3             : in std_logic;
+  FFC_SB_PFIFO_LP_0             : in std_logic;
+  FFC_SB_PFIFO_LP_1             : in std_logic;
+  FFC_SB_PFIFO_LP_2             : in std_logic;
+  FFC_SB_PFIFO_LP_3             : in std_logic;
+  FFC_SIGNAL_DETECT_0             : in std_logic;
+  FFC_SIGNAL_DETECT_1             : in std_logic;
+  FFC_SIGNAL_DETECT_2             : in std_logic;
+  FFC_SIGNAL_DETECT_3             : in std_logic;
+  FFC_SYNC_TOGGLE             : in std_logic;
+  FFC_TRST             : in std_logic;
+  FFC_TXPWDNB_0             : in std_logic;
+  FFC_TXPWDNB_1             : in std_logic;
+  FFC_TXPWDNB_2             : in std_logic;
+  FFC_TXPWDNB_3             : in std_logic;
+  FFC_RATE_MODE_RX_0        : in std_logic;
+  FFC_RATE_MODE_RX_1        : in std_logic;
+  FFC_RATE_MODE_RX_2        : in std_logic;
+  FFC_RATE_MODE_RX_3        : in std_logic;
+  FFC_RATE_MODE_TX_0        : in std_logic;
+  FFC_RATE_MODE_TX_1        : in std_logic;
+  FFC_RATE_MODE_TX_2        : in std_logic;
+  FFC_RATE_MODE_TX_3        : in std_logic;
+  FFC_DIV11_MODE_RX_0       : in std_logic;
+  FFC_DIV11_MODE_RX_1       : in std_logic;
+  FFC_DIV11_MODE_RX_2       : in std_logic;
+  FFC_DIV11_MODE_RX_3       : in std_logic;
+  FFC_DIV11_MODE_TX_0       : in std_logic;
+  FFC_DIV11_MODE_TX_1       : in std_logic;
+  FFC_DIV11_MODE_TX_2       : in std_logic;
+  FFC_DIV11_MODE_TX_3       : in std_logic;
+  LDR_CORE2TX_0             : in std_logic;
+  LDR_CORE2TX_1             : in std_logic;
+  LDR_CORE2TX_2             : in std_logic;
+  LDR_CORE2TX_3             : in std_logic;
+  FFC_LDR_CORE2TX_EN_0      : in std_logic;
+  FFC_LDR_CORE2TX_EN_1      : in std_logic;
+  FFC_LDR_CORE2TX_EN_2      : in std_logic;
+  FFC_LDR_CORE2TX_EN_3      : in std_logic;
+  PCIE_POWERDOWN_0_0      : in std_logic;
+  PCIE_POWERDOWN_0_1      : in std_logic;
+  PCIE_POWERDOWN_1_0      : in std_logic;
+  PCIE_POWERDOWN_1_1      : in std_logic;
+  PCIE_POWERDOWN_2_0      : in std_logic;
+  PCIE_POWERDOWN_2_1      : in std_logic;
+  PCIE_POWERDOWN_3_0      : in std_logic;
+  PCIE_POWERDOWN_3_1      : in std_logic;
+  PCIE_RXPOLARITY_0         : in std_logic;
+  PCIE_RXPOLARITY_1         : in std_logic;
+  PCIE_RXPOLARITY_2         : in std_logic;
+  PCIE_RXPOLARITY_3         : in std_logic;
+  PCIE_TXCOMPLIANCE_0       : in std_logic;
+  PCIE_TXCOMPLIANCE_1       : in std_logic;
+  PCIE_TXCOMPLIANCE_2       : in std_logic;
+  PCIE_TXCOMPLIANCE_3       : in std_logic;
+  PCIE_TXDETRX_PR2TLB_0     : in std_logic;
+  PCIE_TXDETRX_PR2TLB_1     : in std_logic;
+  PCIE_TXDETRX_PR2TLB_2     : in std_logic;
+  PCIE_TXDETRX_PR2TLB_3     : in std_logic;
+  SCIADDR0             : in std_logic;
+  SCIADDR1             : in std_logic;
+  SCIADDR2             : in std_logic;
+  SCIADDR3             : in std_logic;
+  SCIADDR4             : in std_logic;
+  SCIADDR5             : in std_logic;
+  SCIENAUX             : in std_logic;
+  SCIENCH0             : in std_logic;
+  SCIENCH1             : in std_logic;
+  SCIENCH2             : in std_logic;
+  SCIENCH3             : in std_logic;
+  SCIRD                : in std_logic;
+  SCISELAUX             : in std_logic;
+  SCISELCH0             : in std_logic;
+  SCISELCH1             : in std_logic;
+  SCISELCH2             : in std_logic;
+  SCISELCH3             : in std_logic;
+  SCIWDATA0             : in std_logic;
+  SCIWDATA1             : in std_logic;
+  SCIWDATA2             : in std_logic;
+  SCIWDATA3             : in std_logic;
+  SCIWDATA4             : in std_logic;
+  SCIWDATA5             : in std_logic;
+  SCIWDATA6             : in std_logic;
+  SCIWDATA7             : in std_logic;
+  SCIWSTN               : in std_logic;
+  REFCLK_FROM_NQ        : in std_logic;
+  HDOUTN0             : out std_logic;
+  HDOUTN1             : out std_logic;
+  HDOUTN2             : out std_logic;
+  HDOUTN3             : out std_logic;
+  HDOUTP0             : out std_logic;
+  HDOUTP1             : out std_logic;
+  HDOUTP2             : out std_logic;
+  HDOUTP3             : out std_logic;
+  COUT0             : out std_logic;
+  COUT1             : out std_logic;
+  COUT2             : out std_logic;
+  COUT3             : out std_logic;
+  COUT4             : out std_logic;
+  COUT5             : out std_logic;
+  COUT6             : out std_logic;
+  COUT7             : out std_logic;
+  COUT8             : out std_logic;
+  COUT9             : out std_logic;
+  COUT10             : out std_logic;
+  COUT11             : out std_logic;
+  COUT12             : out std_logic;
+  COUT13             : out std_logic;
+  COUT14             : out std_logic;
+  COUT15             : out std_logic;
+  COUT16             : out std_logic;
+  COUT17             : out std_logic;
+  COUT18             : out std_logic;
+  COUT19             : out std_logic;
+  FF_RX_D_0_0             : out std_logic;
+  FF_RX_D_0_1             : out std_logic;
+  FF_RX_D_0_2             : out std_logic;
+  FF_RX_D_0_3             : out std_logic;
+  FF_RX_D_0_4             : out std_logic;
+  FF_RX_D_0_5             : out std_logic;
+  FF_RX_D_0_6             : out std_logic;
+  FF_RX_D_0_7             : out std_logic;
+  FF_RX_D_0_8             : out std_logic;
+  FF_RX_D_0_9             : out std_logic;
+  FF_RX_D_0_10             : out std_logic;
+  FF_RX_D_0_11             : out std_logic;
+  FF_RX_D_0_12             : out std_logic;
+  FF_RX_D_0_13             : out std_logic;
+  FF_RX_D_0_14             : out std_logic;
+  FF_RX_D_0_15             : out std_logic;
+  FF_RX_D_0_16             : out std_logic;
+  FF_RX_D_0_17             : out std_logic;
+  FF_RX_D_0_18             : out std_logic;
+  FF_RX_D_0_19             : out std_logic;
+  FF_RX_D_0_20             : out std_logic;
+  FF_RX_D_0_21             : out std_logic;
+  FF_RX_D_0_22             : out std_logic;
+  FF_RX_D_0_23             : out std_logic;
+  FF_RX_D_1_0             : out std_logic;
+  FF_RX_D_1_1             : out std_logic;
+  FF_RX_D_1_2             : out std_logic;
+  FF_RX_D_1_3             : out std_logic;
+  FF_RX_D_1_4             : out std_logic;
+  FF_RX_D_1_5             : out std_logic;
+  FF_RX_D_1_6             : out std_logic;
+  FF_RX_D_1_7             : out std_logic;
+  FF_RX_D_1_8             : out std_logic;
+  FF_RX_D_1_9             : out std_logic;
+  FF_RX_D_1_10             : out std_logic;
+  FF_RX_D_1_11             : out std_logic;
+  FF_RX_D_1_12             : out std_logic;
+  FF_RX_D_1_13             : out std_logic;
+  FF_RX_D_1_14             : out std_logic;
+  FF_RX_D_1_15             : out std_logic;
+  FF_RX_D_1_16             : out std_logic;
+  FF_RX_D_1_17             : out std_logic;
+  FF_RX_D_1_18             : out std_logic;
+  FF_RX_D_1_19             : out std_logic;
+  FF_RX_D_1_20             : out std_logic;
+  FF_RX_D_1_21             : out std_logic;
+  FF_RX_D_1_22             : out std_logic;
+  FF_RX_D_1_23             : out std_logic;
+  FF_RX_D_2_0             : out std_logic;
+  FF_RX_D_2_1             : out std_logic;
+  FF_RX_D_2_2             : out std_logic;
+  FF_RX_D_2_3             : out std_logic;
+  FF_RX_D_2_4             : out std_logic;
+  FF_RX_D_2_5             : out std_logic;
+  FF_RX_D_2_6             : out std_logic;
+  FF_RX_D_2_7             : out std_logic;
+  FF_RX_D_2_8             : out std_logic;
+  FF_RX_D_2_9             : out std_logic;
+  FF_RX_D_2_10             : out std_logic;
+  FF_RX_D_2_11             : out std_logic;
+  FF_RX_D_2_12             : out std_logic;
+  FF_RX_D_2_13             : out std_logic;
+  FF_RX_D_2_14             : out std_logic;
+  FF_RX_D_2_15             : out std_logic;
+  FF_RX_D_2_16             : out std_logic;
+  FF_RX_D_2_17             : out std_logic;
+  FF_RX_D_2_18             : out std_logic;
+  FF_RX_D_2_19             : out std_logic;
+  FF_RX_D_2_20             : out std_logic;
+  FF_RX_D_2_21             : out std_logic;
+  FF_RX_D_2_22             : out std_logic;
+  FF_RX_D_2_23             : out std_logic;
+  FF_RX_D_3_0             : out std_logic;
+  FF_RX_D_3_1             : out std_logic;
+  FF_RX_D_3_2             : out std_logic;
+  FF_RX_D_3_3             : out std_logic;
+  FF_RX_D_3_4             : out std_logic;
+  FF_RX_D_3_5             : out std_logic;
+  FF_RX_D_3_6             : out std_logic;
+  FF_RX_D_3_7             : out std_logic;
+  FF_RX_D_3_8             : out std_logic;
+  FF_RX_D_3_9             : out std_logic;
+  FF_RX_D_3_10             : out std_logic;
+  FF_RX_D_3_11             : out std_logic;
+  FF_RX_D_3_12             : out std_logic;
+  FF_RX_D_3_13             : out std_logic;
+  FF_RX_D_3_14             : out std_logic;
+  FF_RX_D_3_15             : out std_logic;
+  FF_RX_D_3_16             : out std_logic;
+  FF_RX_D_3_17             : out std_logic;
+  FF_RX_D_3_18             : out std_logic;
+  FF_RX_D_3_19             : out std_logic;
+  FF_RX_D_3_20             : out std_logic;
+  FF_RX_D_3_21             : out std_logic;
+  FF_RX_D_3_22             : out std_logic;
+  FF_RX_D_3_23             : out std_logic;
+  FF_RX_F_CLK_0             : out std_logic;
+  FF_RX_F_CLK_1             : out std_logic;
+  FF_RX_F_CLK_2             : out std_logic;
+  FF_RX_F_CLK_3             : out std_logic;
+  FF_RX_H_CLK_0             : out std_logic;
+  FF_RX_H_CLK_1             : out std_logic;
+  FF_RX_H_CLK_2             : out std_logic;
+  FF_RX_H_CLK_3             : out std_logic;
+  FF_TX_F_CLK_0             : out std_logic;
+  FF_TX_F_CLK_1             : out std_logic;
+  FF_TX_F_CLK_2             : out std_logic;
+  FF_TX_F_CLK_3             : out std_logic;
+  FF_TX_H_CLK_0             : out std_logic;
+  FF_TX_H_CLK_1             : out std_logic;
+  FF_TX_H_CLK_2             : out std_logic;
+  FF_TX_H_CLK_3             : out std_logic;
+  FFS_CC_OVERRUN_0             : out std_logic;
+  FFS_CC_OVERRUN_1             : out std_logic;
+  FFS_CC_OVERRUN_2             : out std_logic;
+  FFS_CC_OVERRUN_3             : out std_logic;
+  FFS_CC_UNDERRUN_0             : out std_logic;
+  FFS_CC_UNDERRUN_1             : out std_logic;
+  FFS_CC_UNDERRUN_2             : out std_logic;
+  FFS_CC_UNDERRUN_3             : out std_logic;
+  FFS_LS_SYNC_STATUS_0             : out std_logic;
+  FFS_LS_SYNC_STATUS_1             : out std_logic;
+  FFS_LS_SYNC_STATUS_2             : out std_logic;
+  FFS_LS_SYNC_STATUS_3             : out std_logic;
+  FFS_CDR_TRAIN_DONE_0             : out std_logic;
+  FFS_CDR_TRAIN_DONE_1             : out std_logic;
+  FFS_CDR_TRAIN_DONE_2             : out std_logic;
+  FFS_CDR_TRAIN_DONE_3             : out std_logic;
+  FFS_PCIE_CON_0             : out std_logic;
+  FFS_PCIE_CON_1             : out std_logic;
+  FFS_PCIE_CON_2             : out std_logic;
+  FFS_PCIE_CON_3             : out std_logic;
+  FFS_PCIE_DONE_0             : out std_logic;
+  FFS_PCIE_DONE_1             : out std_logic;
+  FFS_PCIE_DONE_2             : out std_logic;
+  FFS_PCIE_DONE_3             : out std_logic;
+  FFS_PLOL             : out std_logic;
+  FFS_RLOL_0             : out std_logic;
+  FFS_RLOL_1             : out std_logic;
+  FFS_RLOL_2             : out std_logic;
+  FFS_RLOL_3             : out std_logic;
+  FFS_RLOS_HI_0             : out std_logic;
+  FFS_RLOS_HI_1             : out std_logic;
+  FFS_RLOS_HI_2             : out std_logic;
+  FFS_RLOS_HI_3             : out std_logic;
+  FFS_RLOS_LO_0             : out std_logic;
+  FFS_RLOS_LO_1             : out std_logic;
+  FFS_RLOS_LO_2             : out std_logic;
+  FFS_RLOS_LO_3             : out std_logic;
+  FFS_RXFBFIFO_ERROR_0             : out std_logic;
+  FFS_RXFBFIFO_ERROR_1             : out std_logic;
+  FFS_RXFBFIFO_ERROR_2             : out std_logic;
+  FFS_RXFBFIFO_ERROR_3             : out std_logic;
+  FFS_TXFBFIFO_ERROR_0             : out std_logic;
+  FFS_TXFBFIFO_ERROR_1             : out std_logic;
+  FFS_TXFBFIFO_ERROR_2             : out std_logic;
+  FFS_TXFBFIFO_ERROR_3             : out std_logic;
+  PCIE_PHYSTATUS_0             : out std_logic;
+  PCIE_PHYSTATUS_1             : out std_logic;
+  PCIE_PHYSTATUS_2             : out std_logic;
+  PCIE_PHYSTATUS_3             : out std_logic;
+  PCIE_RXVALID_0               : out std_logic;
+  PCIE_RXVALID_1               : out std_logic;
+  PCIE_RXVALID_2               : out std_logic;
+  PCIE_RXVALID_3               : out std_logic;
+  FFS_SKP_ADDED_0                  : out std_logic;
+  FFS_SKP_ADDED_1                  : out std_logic;
+  FFS_SKP_ADDED_2                  : out std_logic;
+  FFS_SKP_ADDED_3                  : out std_logic;
+  FFS_SKP_DELETED_0                : out std_logic;
+  FFS_SKP_DELETED_1                : out std_logic;
+  FFS_SKP_DELETED_2                : out std_logic;
+  FFS_SKP_DELETED_3                : out std_logic;
+  LDR_RX2CORE_0                    : out std_logic;
+  LDR_RX2CORE_1                    : out std_logic;
+  LDR_RX2CORE_2                    : out std_logic;
+  LDR_RX2CORE_3                    : out std_logic;
+  REFCK2CORE             : out std_logic;
+  SCIINT                : out std_logic;
+  SCIRDATA0             : out std_logic;
+  SCIRDATA1             : out std_logic;
+  SCIRDATA2             : out std_logic;
+  SCIRDATA3             : out std_logic;
+  SCIRDATA4             : out std_logic;
+  SCIRDATA5             : out std_logic;
+  SCIRDATA6             : out std_logic;
+  SCIRDATA7             : out std_logic;
+  REFCLK_TO_NQ          : out std_logic
+);
+end component;
+   attribute CONFIG_FILE: string;
+   attribute CONFIG_FILE of PCSD_INST : label is USER_CONFIG_FILE;
+   attribute QUAD_MODE: string;
+   attribute QUAD_MODE of PCSD_INST : label is "SINGLE";
+   attribute PLL_SRC: string;
+   attribute PLL_SRC of PCSD_INST : label is "REFCLK_CORE";
+   attribute CH0_CDR_SRC: string;
+   attribute CH0_CDR_SRC of PCSD_INST : label is "REFCLK_CORE";
+   attribute CH1_CDR_SRC: string;
+   attribute CH1_CDR_SRC of PCSD_INST : label is "REFCLK_CORE";
+   attribute FREQUENCY_PIN_FF_RX_F_CLK_0: string;
+   attribute FREQUENCY_PIN_FF_RX_F_CLK_0 of PCSD_INST : label is "125.000";
+   attribute FREQUENCY_PIN_FF_RX_F_CLK_1: string;
+   attribute FREQUENCY_PIN_FF_RX_F_CLK_1 of PCSD_INST : label is "125.000";
+   attribute FREQUENCY_PIN_FF_RX_F_CLK_2: string;
+   attribute FREQUENCY_PIN_FF_RX_F_CLK_2 of PCSD_INST : label is "250.000";
+   attribute FREQUENCY_PIN_FF_RX_F_CLK_3: string;
+   attribute FREQUENCY_PIN_FF_RX_F_CLK_3 of PCSD_INST : label is "250.000";
+   attribute FREQUENCY_PIN_FF_RX_H_CLK_0: string;
+   attribute FREQUENCY_PIN_FF_RX_H_CLK_0 of PCSD_INST : label is "62.5000";
+   attribute FREQUENCY_PIN_FF_RX_H_CLK_1: string;
+   attribute FREQUENCY_PIN_FF_RX_H_CLK_1 of PCSD_INST : label is "62.5000";
+   attribute FREQUENCY_PIN_FF_RX_H_CLK_2: string;
+   attribute FREQUENCY_PIN_FF_RX_H_CLK_2 of PCSD_INST : label is "125.000";
+   attribute FREQUENCY_PIN_FF_RX_H_CLK_3: string;
+   attribute FREQUENCY_PIN_FF_RX_H_CLK_3 of PCSD_INST : label is "125.000";
+   attribute FREQUENCY_PIN_FF_TX_F_CLK_0: string;
+   attribute FREQUENCY_PIN_FF_TX_F_CLK_0 of PCSD_INST : label is "125.000";
+   attribute FREQUENCY_PIN_FF_TX_F_CLK_1: string;
+   attribute FREQUENCY_PIN_FF_TX_F_CLK_1 of PCSD_INST : label is "125.000";
+   attribute FREQUENCY_PIN_FF_TX_F_CLK_2: string;
+   attribute FREQUENCY_PIN_FF_TX_F_CLK_2 of PCSD_INST : label is "125.000";
+   attribute FREQUENCY_PIN_FF_TX_F_CLK_3: string;
+   attribute FREQUENCY_PIN_FF_TX_F_CLK_3 of PCSD_INST : label is "125.000";
+   attribute FREQUENCY_PIN_FF_TX_H_CLK_0: string;
+   attribute FREQUENCY_PIN_FF_TX_H_CLK_0 of PCSD_INST : label is "62.5000";
+   attribute FREQUENCY_PIN_FF_TX_H_CLK_1: string;
+   attribute FREQUENCY_PIN_FF_TX_H_CLK_1 of PCSD_INST : label is "62.5000";
+   attribute FREQUENCY_PIN_FF_TX_H_CLK_2: string;
+   attribute FREQUENCY_PIN_FF_TX_H_CLK_2 of PCSD_INST : label is "62.5000";
+   attribute FREQUENCY_PIN_FF_TX_H_CLK_3: string;
+   attribute FREQUENCY_PIN_FF_TX_H_CLK_3 of PCSD_INST : label is "62.5000";
+   attribute black_box_pad_pin: string;
+   attribute black_box_pad_pin of PCSD : component is "HDINP0, HDINN0, HDINP1, HDINN1, HDINP2, HDINN2, HDINP3, HDINN3, HDOUTP0, HDOUTN0, HDOUTP1, HDOUTN1, HDOUTP2, HDOUTN2, HDOUTP3, HDOUTN3, REFCLKP, REFCLKN";
+
+signal refclk_from_nq : std_logic := '0';
+signal fpsc_vlo : std_logic := '0';
+signal fpsc_vhi : std_logic := '1';
+signal cin : std_logic_vector (11 downto 0) := "000000000000";
+signal cout : std_logic_vector (19 downto 0);
+signal    tx_full_clk_ch0_sig   :   std_logic;
+signal    tx_full_clk_ch1_sig   :   std_logic;
+
+signal    refclk2fpga_sig  :   std_logic;
+signal    tx_pll_lol_qd_sig  :   std_logic;
+signal    rx_los_low_ch0_sig  :   std_logic;
+signal    rx_los_low_ch1_sig  :   std_logic;
+signal    rx_los_low_ch2_sig  :   std_logic;
+signal    rx_los_low_ch3_sig  :   std_logic;
+signal    rx_cdr_lol_ch0_sig  :   std_logic;
+signal    rx_cdr_lol_ch1_sig  :   std_logic;
+signal    rx_cdr_lol_ch2_sig  :   std_logic;
+signal    rx_cdr_lol_ch3_sig  :   std_logic;
+
+
+
+
+
+begin
+
+vlo_inst : VLO port map(Z => fpsc_vlo);
+vhi_inst : VHI port map(Z => fpsc_vhi);
+
+    rx_los_low_ch0_s <= rx_los_low_ch0_sig;
+    rx_los_low_ch1_s <= rx_los_low_ch1_sig;
+    rx_cdr_lol_ch0_s <= rx_cdr_lol_ch0_sig;
+    rx_cdr_lol_ch1_s <= rx_cdr_lol_ch1_sig;
+  tx_pll_lol_qd_s <= tx_pll_lol_qd_sig;
+  tx_full_clk_ch0 <= tx_full_clk_ch0_sig;
+  tx_full_clk_ch1 <= tx_full_clk_ch1_sig;
+
+-- pcs_quad instance
+PCSD_INST : PCSD
+--synopsys translate_off
+  generic map (CONFIG_FILE => USER_CONFIG_FILE,
+               QUAD_MODE => "SINGLE",
+               CH0_CDR_SRC => "REFCLK_CORE",
+               CH1_CDR_SRC => "REFCLK_CORE",
+               PLL_SRC  => "REFCLK_CORE"
+  )
+--synopsys translate_on
+port map  (
+  REFCLKP => fpsc_vlo,
+  REFCLKN => fpsc_vlo,
+
+----- CH0 -----
+  HDOUTP0 => hdoutp_ch0,
+  HDOUTN0 => hdoutn_ch0,
+  HDINP0 => hdinp_ch0,
+  HDINN0 => hdinn_ch0,
+  PCIE_TXDETRX_PR2TLB_0 => fpsc_vlo,
+  PCIE_TXCOMPLIANCE_0 => fpsc_vlo,
+  PCIE_RXPOLARITY_0 => fpsc_vlo,
+  PCIE_POWERDOWN_0_0 => fpsc_vlo,
+  PCIE_POWERDOWN_0_1 => fpsc_vlo,
+  PCIE_RXVALID_0 => open,
+  PCIE_PHYSTATUS_0 => open,
+  SCISELCH0 => fpsc_vlo,
+  SCIENCH0 => fpsc_vlo,
+  FF_RXI_CLK_0 => rxiclk_ch0,
+  FF_TXI_CLK_0 => txiclk_ch0,
+  FF_EBRD_CLK_0 => fpsc_vlo,
+  FF_RX_F_CLK_0 => rx_full_clk_ch0,
+  FF_RX_H_CLK_0 => rx_half_clk_ch0,
+  FF_TX_F_CLK_0 => tx_full_clk_ch0_sig,
+  FF_TX_H_CLK_0 => tx_half_clk_ch0,
+  FFC_CK_CORE_RX_0 => fpga_rxrefclk_ch0,
+  FF_TX_D_0_0 => txdata_ch0(0),
+  FF_TX_D_0_1 => txdata_ch0(1),
+  FF_TX_D_0_2 => txdata_ch0(2),
+  FF_TX_D_0_3 => txdata_ch0(3),
+  FF_TX_D_0_4 => txdata_ch0(4),
+  FF_TX_D_0_5 => txdata_ch0(5),
+  FF_TX_D_0_6 => txdata_ch0(6),
+  FF_TX_D_0_7 => txdata_ch0(7),
+  FF_TX_D_0_8 => tx_k_ch0,
+  FF_TX_D_0_9 => fpsc_vlo,
+  FF_TX_D_0_10 => xmit_ch0,
+  FF_TX_D_0_11 => tx_disp_correct_ch0,
+  FF_TX_D_0_12 => fpsc_vlo,
+  FF_TX_D_0_13 => fpsc_vlo,
+  FF_TX_D_0_14 => fpsc_vlo,
+  FF_TX_D_0_15 => fpsc_vlo,
+  FF_TX_D_0_16 => fpsc_vlo,
+  FF_TX_D_0_17 => fpsc_vlo,
+  FF_TX_D_0_18 => fpsc_vlo,
+  FF_TX_D_0_19 => fpsc_vlo,
+  FF_TX_D_0_20 => fpsc_vlo,
+  FF_TX_D_0_21 => fpsc_vlo,
+  FF_TX_D_0_22 => fpsc_vlo,
+  FF_TX_D_0_23 => fpsc_vlo,
+  FF_RX_D_0_0 => rxdata_ch0(0),
+  FF_RX_D_0_1 => rxdata_ch0(1),
+  FF_RX_D_0_2 => rxdata_ch0(2),
+  FF_RX_D_0_3 => rxdata_ch0(3),
+  FF_RX_D_0_4 => rxdata_ch0(4),
+  FF_RX_D_0_5 => rxdata_ch0(5),
+  FF_RX_D_0_6 => rxdata_ch0(6),
+  FF_RX_D_0_7 => rxdata_ch0(7),
+  FF_RX_D_0_8 => rx_k_ch0,
+  FF_RX_D_0_9 => rx_disp_err_ch0,
+  FF_RX_D_0_10 => rx_cv_err_ch0,
+  FF_RX_D_0_11 => open,
+  FF_RX_D_0_12 => open,
+  FF_RX_D_0_13 => open,
+  FF_RX_D_0_14 => open,
+  FF_RX_D_0_15 => open,
+  FF_RX_D_0_16 => open,
+  FF_RX_D_0_17 => open,
+  FF_RX_D_0_18 => open,
+  FF_RX_D_0_19 => open,
+  FF_RX_D_0_20 => open,
+  FF_RX_D_0_21 => open,
+  FF_RX_D_0_22 => open,
+  FF_RX_D_0_23 => open,
+
+  FFC_RRST_0 => rx_serdes_rst_ch0_c,
+  FFC_SIGNAL_DETECT_0 => fpsc_vlo,
+  FFC_SB_PFIFO_LP_0 => sb_felb_ch0_c,
+  FFC_PFIFO_CLR_0 => sb_felb_rst_ch0_c,
+  FFC_SB_INV_RX_0 => fpsc_vlo,
+  FFC_PCIE_CT_0 => fpsc_vlo,
+  FFC_PCI_DET_EN_0 => fpsc_vlo,
+  FFC_FB_LOOPBACK_0 => fpsc_vlo,
+  FFC_ENABLE_CGALIGN_0 => fpsc_vlo,
+  FFC_EI_EN_0 => fpsc_vlo,
+  FFC_LANE_TX_RST_0 => tx_pcs_rst_ch0_c,
+  FFC_TXPWDNB_0 => tx_pwrup_ch0_c,
+  FFC_LANE_RX_RST_0 => rx_pcs_rst_ch0_c,
+  FFC_RXPWDNB_0 => rx_pwrup_ch0_c,
+  FFS_RLOS_LO_0 => rx_los_low_ch0_sig,
+  FFS_RLOS_HI_0 => open,
+  FFS_PCIE_CON_0 => open,
+  FFS_PCIE_DONE_0 => open,
+  FFS_LS_SYNC_STATUS_0 => lsm_status_ch0_s,
+  FFS_CC_OVERRUN_0 => open,
+  FFS_CC_UNDERRUN_0 => open,
+  FFS_SKP_ADDED_0 => open,
+  FFS_SKP_DELETED_0 => open,
+  FFS_RLOL_0 => rx_cdr_lol_ch0_sig,
+  FFS_RXFBFIFO_ERROR_0 => open,
+  FFS_TXFBFIFO_ERROR_0 => open,
+  LDR_CORE2TX_0 => fpsc_vlo,
+  FFC_LDR_CORE2TX_EN_0 => fpsc_vlo,
+  LDR_RX2CORE_0 => open,
+  FFS_CDR_TRAIN_DONE_0 => open,
+  FFC_DIV11_MODE_TX_0 => fpsc_vlo,
+  FFC_RATE_MODE_TX_0 => fpsc_vlo,
+  FFC_DIV11_MODE_RX_0 => fpsc_vlo,
+  FFC_RATE_MODE_RX_0 => fpsc_vlo,
+
+----- CH1 -----
+  HDOUTP1 => hdoutp_ch1,
+  HDOUTN1 => hdoutn_ch1,
+  HDINP1 => hdinp_ch1,
+  HDINN1 => hdinn_ch1,
+  PCIE_TXDETRX_PR2TLB_1 => fpsc_vlo,
+  PCIE_TXCOMPLIANCE_1 => fpsc_vlo,
+  PCIE_RXPOLARITY_1 => fpsc_vlo,
+  PCIE_POWERDOWN_1_0 => fpsc_vlo,
+  PCIE_POWERDOWN_1_1 => fpsc_vlo,
+  PCIE_RXVALID_1 => open,
+  PCIE_PHYSTATUS_1 => open,
+  SCISELCH1 => fpsc_vlo,
+  SCIENCH1 => fpsc_vlo,
+  FF_RXI_CLK_1 => rxiclk_ch1,
+  FF_TXI_CLK_1 => txiclk_ch1,
+  FF_EBRD_CLK_1 => fpsc_vlo,
+  FF_RX_F_CLK_1 => rx_full_clk_ch1,
+  FF_RX_H_CLK_1 => rx_half_clk_ch1,
+  FF_TX_F_CLK_1 => tx_full_clk_ch1_sig,
+  FF_TX_H_CLK_1 => tx_half_clk_ch1,
+  FFC_CK_CORE_RX_1 => fpga_rxrefclk_ch1,
+  FF_TX_D_1_0 => txdata_ch1(0),
+  FF_TX_D_1_1 => txdata_ch1(1),
+  FF_TX_D_1_2 => txdata_ch1(2),
+  FF_TX_D_1_3 => txdata_ch1(3),
+  FF_TX_D_1_4 => txdata_ch1(4),
+  FF_TX_D_1_5 => txdata_ch1(5),
+  FF_TX_D_1_6 => txdata_ch1(6),
+  FF_TX_D_1_7 => txdata_ch1(7),
+  FF_TX_D_1_8 => tx_k_ch1,
+  FF_TX_D_1_9 => fpsc_vlo,
+  FF_TX_D_1_10 => xmit_ch1,
+  FF_TX_D_1_11 => tx_disp_correct_ch1,
+  FF_TX_D_1_12 => fpsc_vlo,
+  FF_TX_D_1_13 => fpsc_vlo,
+  FF_TX_D_1_14 => fpsc_vlo,
+  FF_TX_D_1_15 => fpsc_vlo,
+  FF_TX_D_1_16 => fpsc_vlo,
+  FF_TX_D_1_17 => fpsc_vlo,
+  FF_TX_D_1_18 => fpsc_vlo,
+  FF_TX_D_1_19 => fpsc_vlo,
+  FF_TX_D_1_20 => fpsc_vlo,
+  FF_TX_D_1_21 => fpsc_vlo,
+  FF_TX_D_1_22 => fpsc_vlo,
+  FF_TX_D_1_23 => fpsc_vlo,
+  FF_RX_D_1_0 => rxdata_ch1(0),
+  FF_RX_D_1_1 => rxdata_ch1(1),
+  FF_RX_D_1_2 => rxdata_ch1(2),
+  FF_RX_D_1_3 => rxdata_ch1(3),
+  FF_RX_D_1_4 => rxdata_ch1(4),
+  FF_RX_D_1_5 => rxdata_ch1(5),
+  FF_RX_D_1_6 => rxdata_ch1(6),
+  FF_RX_D_1_7 => rxdata_ch1(7),
+  FF_RX_D_1_8 => rx_k_ch1,
+  FF_RX_D_1_9 => rx_disp_err_ch1,
+  FF_RX_D_1_10 => rx_cv_err_ch1,
+  FF_RX_D_1_11 => open,
+  FF_RX_D_1_12 => open,
+  FF_RX_D_1_13 => open,
+  FF_RX_D_1_14 => open,
+  FF_RX_D_1_15 => open,
+  FF_RX_D_1_16 => open,
+  FF_RX_D_1_17 => open,
+  FF_RX_D_1_18 => open,
+  FF_RX_D_1_19 => open,
+  FF_RX_D_1_20 => open,
+  FF_RX_D_1_21 => open,
+  FF_RX_D_1_22 => open,
+  FF_RX_D_1_23 => open,
+
+  FFC_RRST_1 => rx_serdes_rst_ch1_c,
+  FFC_SIGNAL_DETECT_1 => fpsc_vlo,
+  FFC_SB_PFIFO_LP_1 => sb_felb_ch1_c,
+  FFC_PFIFO_CLR_1 => sb_felb_rst_ch1_c,
+  FFC_SB_INV_RX_1 => fpsc_vlo,
+  FFC_PCIE_CT_1 => fpsc_vlo,
+  FFC_PCI_DET_EN_1 => fpsc_vlo,
+  FFC_FB_LOOPBACK_1 => fpsc_vlo,
+  FFC_ENABLE_CGALIGN_1 => fpsc_vlo,
+  FFC_EI_EN_1 => fpsc_vlo,
+  FFC_LANE_TX_RST_1 => tx_pcs_rst_ch1_c,
+  FFC_TXPWDNB_1 => tx_pwrup_ch1_c,
+  FFC_LANE_RX_RST_1 => rx_pcs_rst_ch1_c,
+  FFC_RXPWDNB_1 => rx_pwrup_ch1_c,
+  FFS_RLOS_LO_1 => rx_los_low_ch1_sig,
+  FFS_RLOS_HI_1 => open,
+  FFS_PCIE_CON_1 => open,
+  FFS_PCIE_DONE_1 => open,
+  FFS_LS_SYNC_STATUS_1 => lsm_status_ch1_s,
+  FFS_CC_OVERRUN_1 => open,
+  FFS_CC_UNDERRUN_1 => open,
+  FFS_SKP_ADDED_1 => open,
+  FFS_SKP_DELETED_1 => open,
+  FFS_RLOL_1 => rx_cdr_lol_ch1_sig,
+  FFS_RXFBFIFO_ERROR_1 => open,
+  FFS_TXFBFIFO_ERROR_1 => open,
+  LDR_CORE2TX_1 => fpsc_vlo,
+  FFC_LDR_CORE2TX_EN_1 => fpsc_vlo,
+  LDR_RX2CORE_1 => open,
+  FFS_CDR_TRAIN_DONE_1 => open,
+  FFC_DIV11_MODE_TX_1 => fpsc_vlo,
+  FFC_RATE_MODE_TX_1 => fpsc_vlo,
+  FFC_DIV11_MODE_RX_1 => fpsc_vlo,
+  FFC_RATE_MODE_RX_1 => fpsc_vlo,
+
+----- CH2 -----
+  HDOUTP2 => open,
+  HDOUTN2 => open,
+  HDINP2 => fpsc_vlo,
+  HDINN2 => fpsc_vlo,
+  PCIE_TXDETRX_PR2TLB_2 => fpsc_vlo,
+  PCIE_TXCOMPLIANCE_2 => fpsc_vlo,
+  PCIE_RXPOLARITY_2 => fpsc_vlo,
+  PCIE_POWERDOWN_2_0 => fpsc_vlo,
+  PCIE_POWERDOWN_2_1 => fpsc_vlo,
+  PCIE_RXVALID_2 => open,
+  PCIE_PHYSTATUS_2 => open,
+  SCISELCH2 => fpsc_vlo,
+  SCIENCH2 => fpsc_vlo,
+  FF_RXI_CLK_2 => fpsc_vlo,
+  FF_TXI_CLK_2 => fpsc_vlo,
+  FF_EBRD_CLK_2 => fpsc_vlo,
+  FF_RX_F_CLK_2 => open,
+  FF_RX_H_CLK_2 => open,
+  FF_TX_F_CLK_2 => open,
+  FF_TX_H_CLK_2 => open,
+  FFC_CK_CORE_RX_2 => fpsc_vlo,
+  FF_TX_D_2_0 => fpsc_vlo,
+  FF_TX_D_2_1 => fpsc_vlo,
+  FF_TX_D_2_2 => fpsc_vlo,
+  FF_TX_D_2_3 => fpsc_vlo,
+  FF_TX_D_2_4 => fpsc_vlo,
+  FF_TX_D_2_5 => fpsc_vlo,
+  FF_TX_D_2_6 => fpsc_vlo,
+  FF_TX_D_2_7 => fpsc_vlo,
+  FF_TX_D_2_8 => fpsc_vlo,
+  FF_TX_D_2_9 => fpsc_vlo,
+  FF_TX_D_2_10 => fpsc_vlo,
+  FF_TX_D_2_11 => fpsc_vlo,
+  FF_TX_D_2_12 => fpsc_vlo,
+  FF_TX_D_2_13 => fpsc_vlo,
+  FF_TX_D_2_14 => fpsc_vlo,
+  FF_TX_D_2_15 => fpsc_vlo,
+  FF_TX_D_2_16 => fpsc_vlo,
+  FF_TX_D_2_17 => fpsc_vlo,
+  FF_TX_D_2_18 => fpsc_vlo,
+  FF_TX_D_2_19 => fpsc_vlo,
+  FF_TX_D_2_20 => fpsc_vlo,
+  FF_TX_D_2_21 => fpsc_vlo,
+  FF_TX_D_2_22 => fpsc_vlo,
+  FF_TX_D_2_23 => fpsc_vlo,
+  FF_RX_D_2_0 => open,
+  FF_RX_D_2_1 => open,
+  FF_RX_D_2_2 => open,
+  FF_RX_D_2_3 => open,
+  FF_RX_D_2_4 => open,
+  FF_RX_D_2_5 => open,
+  FF_RX_D_2_6 => open,
+  FF_RX_D_2_7 => open,
+  FF_RX_D_2_8 => open,
+  FF_RX_D_2_9 => open,
+  FF_RX_D_2_10 => open,
+  FF_RX_D_2_11 => open,
+  FF_RX_D_2_12 => open,
+  FF_RX_D_2_13 => open,
+  FF_RX_D_2_14 => open,
+  FF_RX_D_2_15 => open,
+  FF_RX_D_2_16 => open,
+  FF_RX_D_2_17 => open,
+  FF_RX_D_2_18 => open,
+  FF_RX_D_2_19 => open,
+  FF_RX_D_2_20 => open,
+  FF_RX_D_2_21 => open,
+  FF_RX_D_2_22 => open,
+  FF_RX_D_2_23 => open,
+
+  FFC_RRST_2 => fpsc_vlo,
+  FFC_SIGNAL_DETECT_2 => fpsc_vlo,
+  FFC_SB_PFIFO_LP_2 => fpsc_vlo,
+  FFC_PFIFO_CLR_2 => fpsc_vlo,
+  FFC_SB_INV_RX_2 => fpsc_vlo,
+  FFC_PCIE_CT_2 => fpsc_vlo,
+  FFC_PCI_DET_EN_2 => fpsc_vlo,
+  FFC_FB_LOOPBACK_2 => fpsc_vlo,
+  FFC_ENABLE_CGALIGN_2 => fpsc_vlo,
+  FFC_EI_EN_2 => fpsc_vlo,
+  FFC_LANE_TX_RST_2 => fpsc_vlo,
+  FFC_TXPWDNB_2 => fpsc_vlo,
+  FFC_LANE_RX_RST_2 => fpsc_vlo,
+  FFC_RXPWDNB_2 => fpsc_vlo,
+  FFS_RLOS_LO_2 => open,
+  FFS_RLOS_HI_2 => open,
+  FFS_PCIE_CON_2 => open,
+  FFS_PCIE_DONE_2 => open,
+  FFS_LS_SYNC_STATUS_2 => open,
+  FFS_CC_OVERRUN_2 => open,
+  FFS_CC_UNDERRUN_2 => open,
+  FFS_SKP_ADDED_2 => open,
+  FFS_SKP_DELETED_2 => open,
+  FFS_RLOL_2 => open,
+  FFS_RXFBFIFO_ERROR_2 => open,
+  FFS_TXFBFIFO_ERROR_2 => open,
+  LDR_CORE2TX_2 => fpsc_vlo,
+  FFC_LDR_CORE2TX_EN_2 => fpsc_vlo,
+  LDR_RX2CORE_2 => open,
+  FFS_CDR_TRAIN_DONE_2 => open,
+  FFC_DIV11_MODE_TX_2 => fpsc_vlo,
+  FFC_RATE_MODE_TX_2 => fpsc_vlo,
+  FFC_DIV11_MODE_RX_2 => fpsc_vlo,
+  FFC_RATE_MODE_RX_2 => fpsc_vlo,
+
+----- CH3 -----
+  HDOUTP3 => open,
+  HDOUTN3 => open,
+  HDINP3 => fpsc_vlo,
+  HDINN3 => fpsc_vlo,
+  PCIE_TXDETRX_PR2TLB_3 => fpsc_vlo,
+  PCIE_TXCOMPLIANCE_3 => fpsc_vlo,
+  PCIE_RXPOLARITY_3 => fpsc_vlo,
+  PCIE_POWERDOWN_3_0 => fpsc_vlo,
+  PCIE_POWERDOWN_3_1 => fpsc_vlo,
+  PCIE_RXVALID_3 => open,
+  PCIE_PHYSTATUS_3 => open,
+  SCISELCH3 => fpsc_vlo,
+  SCIENCH3 => fpsc_vlo,
+  FF_RXI_CLK_3 => fpsc_vlo,
+  FF_TXI_CLK_3 => fpsc_vlo,
+  FF_EBRD_CLK_3 => fpsc_vlo,
+  FF_RX_F_CLK_3 => open,
+  FF_RX_H_CLK_3 => open,
+  FF_TX_F_CLK_3 => open,
+  FF_TX_H_CLK_3 => open,
+  FFC_CK_CORE_RX_3 => fpsc_vlo,
+  FF_TX_D_3_0 => fpsc_vlo,
+  FF_TX_D_3_1 => fpsc_vlo,
+  FF_TX_D_3_2 => fpsc_vlo,
+  FF_TX_D_3_3 => fpsc_vlo,
+  FF_TX_D_3_4 => fpsc_vlo,
+  FF_TX_D_3_5 => fpsc_vlo,
+  FF_TX_D_3_6 => fpsc_vlo,
+  FF_TX_D_3_7 => fpsc_vlo,
+  FF_TX_D_3_8 => fpsc_vlo,
+  FF_TX_D_3_9 => fpsc_vlo,
+  FF_TX_D_3_10 => fpsc_vlo,
+  FF_TX_D_3_11 => fpsc_vlo,
+  FF_TX_D_3_12 => fpsc_vlo,
+  FF_TX_D_3_13 => fpsc_vlo,
+  FF_TX_D_3_14 => fpsc_vlo,
+  FF_TX_D_3_15 => fpsc_vlo,
+  FF_TX_D_3_16 => fpsc_vlo,
+  FF_TX_D_3_17 => fpsc_vlo,
+  FF_TX_D_3_18 => fpsc_vlo,
+  FF_TX_D_3_19 => fpsc_vlo,
+  FF_TX_D_3_20 => fpsc_vlo,
+  FF_TX_D_3_21 => fpsc_vlo,
+  FF_TX_D_3_22 => fpsc_vlo,
+  FF_TX_D_3_23 => fpsc_vlo,
+  FF_RX_D_3_0 => open,
+  FF_RX_D_3_1 => open,
+  FF_RX_D_3_2 => open,
+  FF_RX_D_3_3 => open,
+  FF_RX_D_3_4 => open,
+  FF_RX_D_3_5 => open,
+  FF_RX_D_3_6 => open,
+  FF_RX_D_3_7 => open,
+  FF_RX_D_3_8 => open,
+  FF_RX_D_3_9 => open,
+  FF_RX_D_3_10 => open,
+  FF_RX_D_3_11 => open,
+  FF_RX_D_3_12 => open,
+  FF_RX_D_3_13 => open,
+  FF_RX_D_3_14 => open,
+  FF_RX_D_3_15 => open,
+  FF_RX_D_3_16 => open,
+  FF_RX_D_3_17 => open,
+  FF_RX_D_3_18 => open,
+  FF_RX_D_3_19 => open,
+  FF_RX_D_3_20 => open,
+  FF_RX_D_3_21 => open,
+  FF_RX_D_3_22 => open,
+  FF_RX_D_3_23 => open,
+
+  FFC_RRST_3 => fpsc_vlo,
+  FFC_SIGNAL_DETECT_3 => fpsc_vlo,
+  FFC_SB_PFIFO_LP_3 => fpsc_vlo,
+  FFC_PFIFO_CLR_3 => fpsc_vlo,
+  FFC_SB_INV_RX_3 => fpsc_vlo,
+  FFC_PCIE_CT_3 => fpsc_vlo,
+  FFC_PCI_DET_EN_3 => fpsc_vlo,
+  FFC_FB_LOOPBACK_3 => fpsc_vlo,
+  FFC_ENABLE_CGALIGN_3 => fpsc_vlo,
+  FFC_EI_EN_3 => fpsc_vlo,
+  FFC_LANE_TX_RST_3 => fpsc_vlo,
+  FFC_TXPWDNB_3 => fpsc_vlo,
+  FFC_LANE_RX_RST_3 => fpsc_vlo,
+  FFC_RXPWDNB_3 => fpsc_vlo,
+  FFS_RLOS_LO_3 => open,
+  FFS_RLOS_HI_3 => open,
+  FFS_PCIE_CON_3 => open,
+  FFS_PCIE_DONE_3 => open,
+  FFS_LS_SYNC_STATUS_3 => open,
+  FFS_CC_OVERRUN_3 => open,
+  FFS_CC_UNDERRUN_3 => open,
+  FFS_SKP_ADDED_3 => open,
+  FFS_SKP_DELETED_3 => open,
+  FFS_RLOL_3 => open,
+  FFS_RXFBFIFO_ERROR_3 => open,
+  FFS_TXFBFIFO_ERROR_3 => open,
+  LDR_CORE2TX_3 => fpsc_vlo,
+  FFC_LDR_CORE2TX_EN_3 => fpsc_vlo,
+  LDR_RX2CORE_3 => open,
+  FFS_CDR_TRAIN_DONE_3 => open,
+  FFC_DIV11_MODE_TX_3 => fpsc_vlo,
+  FFC_RATE_MODE_TX_3 => fpsc_vlo,
+  FFC_DIV11_MODE_RX_3 => fpsc_vlo,
+  FFC_RATE_MODE_RX_3 => fpsc_vlo,
+
+----- Auxilliary ----
+  SCIWDATA7 => fpsc_vlo,
+  SCIWDATA6 => fpsc_vlo,
+  SCIWDATA5 => fpsc_vlo,
+  SCIWDATA4 => fpsc_vlo,
+  SCIWDATA3 => fpsc_vlo,
+  SCIWDATA2 => fpsc_vlo,
+  SCIWDATA1 => fpsc_vlo,
+  SCIWDATA0 => fpsc_vlo,
+  SCIADDR5 => fpsc_vlo,
+  SCIADDR4 => fpsc_vlo,
+  SCIADDR3 => fpsc_vlo,
+  SCIADDR2 => fpsc_vlo,
+  SCIADDR1 => fpsc_vlo,
+  SCIADDR0 => fpsc_vlo,
+  SCIRDATA7 => open,
+  SCIRDATA6 => open,
+  SCIRDATA5 => open,
+  SCIRDATA4 => open,
+  SCIRDATA3 => open,
+  SCIRDATA2 => open,
+  SCIRDATA1 => open,
+  SCIRDATA0 => open,
+  SCIENAUX => fpsc_vlo,
+  SCISELAUX => fpsc_vlo,
+  SCIRD => fpsc_vlo,
+  SCIWSTN => fpsc_vlo,
+  CYAWSTN => fpsc_vlo,
+  SCIINT => open,
+  FFC_CK_CORE_TX => fpga_txrefclk,
+  FFC_MACRO_RST => serdes_rst_qd_c,
+  FFC_QUAD_RST => rst_qd_c,
+  FFC_TRST => tx_serdes_rst_c,
+  FFS_PLOL => tx_pll_lol_qd_sig,
+  FFC_SYNC_TOGGLE => tx_sync_qd_c,
+  REFCK2CORE => refclk2fpga_sig,
+  CIN0 => fpsc_vlo,
+  CIN1 => fpsc_vlo,
+  CIN2 => fpsc_vlo,
+  CIN3 => fpsc_vlo,
+  CIN4 => fpsc_vlo,
+  CIN5 => fpsc_vlo,
+  CIN6 => fpsc_vlo,
+  CIN7 => fpsc_vlo,
+  CIN8 => fpsc_vlo,
+  CIN9 => fpsc_vlo,
+  CIN10 => fpsc_vlo,
+  CIN11 => fpsc_vlo,
+  COUT0 => open,
+  COUT1 => open,
+  COUT2 => open,
+  COUT3 => open,
+  COUT4 => open,
+  COUT5 => open,
+  COUT6 => open,
+  COUT7 => open,
+  COUT8 => open,
+  COUT9 => open,
+  COUT10 => open,
+  COUT11 => open,
+  COUT12 => open,
+  COUT13 => open,
+  COUT14 => open,
+  COUT15 => open,
+  COUT16 => open,
+  COUT17 => open,
+  COUT18 => open,
+  COUT19 => open,
+  REFCLK_FROM_NQ => refclk_from_nq,
+  REFCLK_TO_NQ => open);
+
+                                                                                              
+                                                                                              
+                                                                                              
+--synopsys translate_off
+file_read : PROCESS
+VARIABLE open_status : file_open_status;
+FILE config : text;
+BEGIN
+   file_open (open_status, config, USER_CONFIG_FILE, read_mode);
+   IF (open_status = name_error) THEN
+      report "Auto configuration file for PCS module not found.  PCS internal configuration registers will not be initialized correctly during simulation!"
+      severity ERROR;
+   END IF;
+   wait;
+END PROCESS;
+--synopsys translate_on
+end serdes_arch ;
diff --git a/trb3_gbe_test/ipcores/sgmii33/rate_resolution.v b/trb3_gbe_test/ipcores/sgmii33/rate_resolution.v
new file mode 100755 (executable)
index 0000000..b9edbef
--- /dev/null
@@ -0,0 +1,66 @@
+//**************************************************************************\r
+// *************************************************************************\r
+// *                LATTICE SEMICONDUCTOR CONFIDENTIAL                     *\r
+// *                         PROPRIETARY NOTE                              *\r
+// *                                                                       *\r
+// *  This software contains information confidential and proprietary      *\r
+// *  to Lattice Semiconductor Corporation.  It shall not be reproduced    *\r
+// *  in whole or in part, or transferred to other documents, or disclosed *\r
+// *  to third parties, or used for any purpose other than that for which  *\r
+// *  it was obtained, without the prior written consent of Lattice        *\r
+// *  Semiconductor Corporation.  All rights reserved.                     *\r
+// *                                                                       *\r
+// *************************************************************************\r
+//**************************************************************************\r
+\r
+`timescale 1ns/100ps\r
+\r
+module rate_resolution (\r
+       gbe_mode,\r
+       sgmii_mode,\r
+       an_enable,\r
+       advertised_rate,\r
+       link_partner_rate,\r
+       non_an_rate,\r
+\r
+       operational_rate\r
+);\r
+\r
+input gbe_mode;\r
+input sgmii_mode;\r
+input an_enable;\r
+input [1:0] advertised_rate; // 00=10Mbps    01=100Mbps    10=1Gbps\r
+input [1:0] link_partner_rate;\r
+input [1:0] non_an_rate;\r
+\r
+output [1:0] operational_rate;\r
+reg [1:0] operational_rate;\r
+\r
+\r
+\r
+always @(gbe_mode or sgmii_mode or an_enable or advertised_rate or link_partner_rate or non_an_rate) begin\r
+       if (gbe_mode) begin\r
+               operational_rate <= 2'b10; // 1Gbps\r
+       end\r
+       else begin\r
+               if (an_enable) begin\r
+                       if (sgmii_mode) begin\r
+                               // PHY Mode\r
+                               operational_rate <= advertised_rate;\r
+                       end\r
+                       else begin\r
+                               // MAC Mode\r
+                               operational_rate <= link_partner_rate;\r
+                       end\r
+               end\r
+               else begin\r
+                       // If auto-negotiation disabled, then this becomes active rate\r
+                       operational_rate <= non_an_rate;\r
+               end\r
+       end\r
+end\r
+\r
+\r
+\r
+endmodule\r
+\r
diff --git a/trb3_gbe_test/ipcores/sgmii33/register_interface_hb.v b/trb3_gbe_test/ipcores/sgmii33/register_interface_hb.v
new file mode 100755 (executable)
index 0000000..73e0b86
--- /dev/null
@@ -0,0 +1,918 @@
+//**************************************************************************\r
+// *************************************************************************\r
+// *                LATTICE SEMICONDUCTOR CONFIDENTIAL                     *\r
+// *                         PROPRIETARY NOTE                              *\r
+// *                                                                       *\r
+// *  This software contains information confidential and proprietary      *\r
+// *  to Lattice Semiconductor Corporation.  It shall not be reproduced    *\r
+// *  in whole or in part, or transferred to other documents, or disclosed *\r
+// *  to third parties, or used for any purpose other than that for which  *\r
+// *  it was obtained, without the prior written consent of Lattice        *\r
+// *  Semiconductor Corporation.  All rights reserved.                     *\r
+// *                                                                       *\r
+// *************************************************************************\r
+//**************************************************************************\r
+\r
+`timescale 1ns/100ps\r
+\r
+module register_interface_hb (\r
+\r
+       // Control Signals\r
+       rst_n,\r
+       hclk,\r
+       gbe_mode,\r
+       sgmii_mode,\r
+\r
+       // Host Bus\r
+       hcs_n,\r
+       hwrite_n,\r
+       haddr,\r
+       hdatain,\r
+\r
+       hdataout,\r
+       hready_n,\r
+\r
+       // Register Inputs\r
+       mr_an_enable,\r
+       mr_restart_an,\r
+       mr_adv_ability,\r
+\r
+       // Register Outputs\r
+       mr_main_reset,\r
+       mr_an_complete,\r
+       mr_page_rx,\r
+       mr_lp_adv_ability\r
+       );\r
+\r
+\r
+input          rst_n ;\r
+input          hclk ;\r
+input          gbe_mode ;\r
+input          sgmii_mode ;\r
+\r
+input           hcs_n;\r
+input           hwrite_n;\r
+input    [3:0]  haddr;\r
+input    [7:0]  hdatain;\r
+\r
+output   [7:0]  hdataout;\r
+output          hready_n;\r
+\r
+input          mr_an_complete;\r
+input          mr_page_rx;\r
+input [15:0]   mr_lp_adv_ability;\r
+\r
+output         mr_an_enable;\r
+output         mr_restart_an;\r
+output [15:0]  mr_adv_ability;\r
+output         mr_main_reset;\r
+\r
+regs_hb   regs (\r
+       .rst_n (rst_n),\r
+       .hclk (hclk),\r
+\r
+       .gbe_mode (gbe_mode),\r
+       .sgmii_mode (sgmii_mode),\r
+\r
+       .hcs_n (hcs_n),\r
+       .hwrite_n (hwrite_n),\r
+       .haddr (haddr),\r
+       .hdatain (hdatain),\r
+\r
+       .hdataout (hdataout),\r
+       .hready_n (hready_n),\r
+\r
+       .mr_an_complete (mr_an_complete),\r
+       .mr_page_rx (mr_page_rx),\r
+       .mr_lp_adv_ability (mr_lp_adv_ability),\r
+\r
+       .mr_main_reset (mr_main_reset),\r
+       .mr_an_enable (mr_an_enable),\r
+       .mr_restart_an (mr_restart_an),\r
+       .mr_adv_ability (mr_adv_ability)\r
+);\r
+endmodule\r
+\r
+\r
+\r
+\r
+\r
+\r
+module register_0_hb (\r
+       rst_n,\r
+       clk, \r
+       cs_0,\r
+       cs_1,\r
+       write,\r
+       ready,\r
+       data_in,\r
+\r
+       data_out,\r
+       mr_main_reset,\r
+       mr_an_enable,\r
+       mr_restart_an\r
+);\r
+\r
+input           rst_n;\r
+input           clk;\r
+input           cs_0;\r
+input           cs_1;\r
+input           write;\r
+input           ready;\r
+input  [15:0]   data_in;\r
+\r
+output [15:0]   data_out;\r
+output          mr_main_reset; // bit D15 // R/W // Self Clearing\r
+output          mr_an_enable;  // bit D12 // R/W\r
+output          mr_restart_an; // bit D09 // R/W // Self Clearing\r
+\r
+reg [15:0]      data_out;\r
+reg             mr_main_reset;\r
+reg             mr_an_enable;\r
+reg             mr_restart_an;\r
+reg            m_m_r;\r
+reg            m_r_a;\r
+\r
+\r
+// Write Operations\r
+\r
+       // Low Portion of Register[D7:D0] has no\r
+       // implemented bits.  Therefore, no write\r
+       // operations here.\r
+\r
+       // High Portion of Register[D15:D8]\r
+       always @(posedge clk or negedge rst_n) begin\r
+               if (rst_n == 1'b0) begin\r
+                       mr_main_reset <= 0; // default value\r
+                       mr_an_enable <= 1;  // default value\r
+                       mr_restart_an <= 0; // default value\r
+                       m_m_r <= 0;\r
+                       m_r_a <= 0;\r
+               end\r
+               else begin\r
+\r
+                       // Do the Writes\r
+                       if (cs_1 && ready && write) begin\r
+                               mr_main_reset <= data_in[15];\r
+                               mr_an_enable <= data_in[12];\r
+                               mr_restart_an <= data_in[9];\r
+                       end\r
+\r
+                       // Delay the Self Clearing Register Bits\r
+                       m_m_r <= mr_main_reset;\r
+                       m_r_a <= mr_restart_an;\r
+\r
+                       // Do the Self Clearing\r
+                       if (m_m_r)\r
+                               mr_main_reset <= 0;\r
+\r
+                       if (m_r_a)\r
+                               mr_restart_an <= 0;\r
+               end\r
+       end\r
+\r
+\r
+\r
+\r
+\r
+// Read Operations\r
+       always @(*) begin\r
+                       data_out[7:0] = 8'b00000000;\r
+                       data_out[15] = mr_main_reset;\r
+                       data_out[14] = 0;\r
+                       data_out[13] = 0;\r
+                       data_out[12] = mr_an_enable;\r
+                       data_out[11] = 0;\r
+                       data_out[10] = 0;\r
+                       data_out[9]  = mr_restart_an;\r
+                       data_out[8]  = 0;\r
+       end\r
+endmodule\r
+\r
+module register_1_hb (\r
+       rst_n,\r
+       cs_0,\r
+       cs_1,\r
+       mr_an_complete,\r
+\r
+       data_out\r
+);\r
+\r
+input           rst_n;\r
+input           cs_0;\r
+input           cs_1;\r
+input           mr_an_complete; // bit D5 // Read-Only\r
+\r
+output [15:0]   data_out;\r
+\r
+reg [15:0]      data_out;\r
+\r
+\r
+// Read Operations\r
+\r
+       always @(*) begin\r
+                       data_out[7] <= 0;\r
+                       data_out[6] <= 0;\r
+                       data_out[5] <= mr_an_complete;\r
+                       data_out[4] <= 0;\r
+                       data_out[3] <= 0;\r
+                       data_out[2] <= 0;\r
+                       data_out[1] <= 0;\r
+                       data_out[0] <= 0;\r
+                       data_out[15:8] <= 8'b00000000;\r
+       end\r
+endmodule\r
+\r
+module register_4_hb (\r
+       rst_n,\r
+       clk, \r
+       gbe_mode,\r
+       sgmii_mode,\r
+       cs_0,\r
+       cs_1,\r
+       write,\r
+       ready,\r
+       data_in,\r
+\r
+       data_out,\r
+       mr_adv_ability\r
+);\r
+\r
+parameter [15:0] initval_gbe = 16'h0020;\r
+parameter [15:0] initval_phy = 16'hd801;\r
+parameter [15:0] initval_mac = 16'h4001;\r
+\r
+input           rst_n;\r
+input           clk;\r
+input           gbe_mode;\r
+input           sgmii_mode;\r
+input           cs_0;\r
+input           cs_1;\r
+input           write;\r
+input           ready;\r
+input  [15:0]   data_in;\r
+\r
+output [15:0]   data_out;\r
+output [15:0]   mr_adv_ability; // When sgmii_mode == 1 == PHY\r
+                               // all bits D15-D0 are R/W,\r
+                               ///////////////////////////////////\r
+                               // D15 = Link Status (1=up, 0=down)\r
+                               // D14 = Can be written but has no effect\r
+                               //           on autonegotiation.  Instead\r
+                               //           the autonegotiation state machine\r
+                               //           controls the utilization of this bit.\r
+                               // D12 = Duplex Mode (1=full, 0=half)\r
+                               // D11:10 = Speed (11=reserved)\r
+                               //                (10=1000Mbps)\r
+                               //                (01=100 Mbps)\r
+                               //                (00=10  Mbps)\r
+                               // D0 = 1\r
+                               // all other bits = 0\r
+                               ///////////////////////////////////\r
+                               //When sgmii_mode == 0 = MAC\r
+                               // all bits D15-D0 are R/W,\r
+                               // D14 = Can be written but has no effect\r
+                               //           on autonegotiation.  Instead\r
+                               //           the autonegotiation state machine\r
+                               //           controls the utilization of this bit.\r
+                               // D0 = 1\r
+                               // all other bits = 0\r
+                               ///////////////////////////////////\r
+\r
+\r
+reg [15:0]      data_out;\r
+reg [15:0]      mr_adv_ability;\r
+reg             rst_d1;\r
+reg             rst_d2;\r
+reg             rst_d3;\r
+reg             rst_d4;\r
+reg             rst_d5;\r
+reg             rst_d6;\r
+reg             rst_d7;\r
+reg             rst_d8;\r
+reg             sync_reset;\r
+reg             sgmii_mode_d1;\r
+reg             sgmii_mode_d2;\r
+reg             sgmii_mode_d3;\r
+reg             sgmii_mode_d4;\r
+reg             sgmii_mode_change;\r
+reg            gbe_mode_d1;\r
+reg            gbe_mode_d2;\r
+reg            gbe_mode_d3;\r
+reg            gbe_mode_d4;\r
+reg            gbe_mode_change;\r
+\r
+// generate a synchronous reset signal\r
+//    note: this method is used so that\r
+//          an initval can be applied during\r
+//         device run-time, instead of at compile time\r
+always @(posedge clk or negedge rst_n) begin\r
+       if (rst_n == 1'b0) begin\r
+               rst_d1 <= 0;\r
+               rst_d2 <= 0;\r
+               rst_d3 <= 0;\r
+               rst_d4 <= 0;\r
+               rst_d5 <= 0;\r
+               rst_d6 <= 0;\r
+               rst_d7 <= 0;\r
+               rst_d8 <= 0;\r
+               sync_reset <= 0;\r
+       end\r
+       else begin\r
+               rst_d1 <= 1;\r
+               rst_d2 <= rst_d1;\r
+               rst_d3 <= rst_d2;\r
+               rst_d4 <= rst_d3;\r
+               rst_d5 <= rst_d4;\r
+               rst_d6 <= rst_d5;\r
+               rst_d7 <= rst_d6;\r
+               rst_d8 <= rst_d7;\r
+\r
+               // asserts on rising edge of rst_d8\r
+               sync_reset <= !rst_d8 & rst_d7; \r
+       end\r
+end\r
+\r
+\r
+// Detect change in sgmii_mode\r
+always @(posedge clk or negedge rst_n) begin\r
+       if (rst_n == 1'b0) begin\r
+               sgmii_mode_d1 <= 0;\r
+               sgmii_mode_d2 <= 0;\r
+               sgmii_mode_d3 <= 0;\r
+               sgmii_mode_d4 <= 0;\r
+               sgmii_mode_change <= 0;\r
+       end\r
+       else begin\r
+\r
+               // deboggle\r
+               sgmii_mode_d1 <= sgmii_mode;\r
+               sgmii_mode_d2 <= sgmii_mode_d1;\r
+\r
+               // delay \r
+               sgmii_mode_d3 <= sgmii_mode_d2;\r
+               sgmii_mode_d4 <= sgmii_mode_d3;\r
+\r
+               // detect change\r
+               if (sgmii_mode_d3 != sgmii_mode_d4)\r
+                       sgmii_mode_change <= 1;\r
+               else\r
+                       sgmii_mode_change <= 0;\r
+       end\r
+end\r
+\r
+\r
+// Detect change in gbe_mode\r
+always @(posedge clk or negedge rst_n) begin\r
+       if (rst_n == 1'b0) begin\r
+               gbe_mode_d1 <= 0;\r
+               gbe_mode_d2 <= 0;\r
+               gbe_mode_d3 <= 0;\r
+               gbe_mode_d4 <= 0;\r
+               gbe_mode_change <= 0;\r
+       end\r
+       else begin\r
+\r
+               // deboggle\r
+               gbe_mode_d1 <= gbe_mode;\r
+               gbe_mode_d2 <= gbe_mode_d1;\r
+\r
+               // delay \r
+               gbe_mode_d3 <= gbe_mode_d2;\r
+               gbe_mode_d4 <= gbe_mode_d3;\r
+\r
+               // detect change\r
+               if (gbe_mode_d3 != gbe_mode_d4)\r
+                       gbe_mode_change <= 1;\r
+               else\r
+                       gbe_mode_change <= 0;\r
+       end\r
+end\r
+\r
+\r
+// Write Operations\r
+       // Low Portion of Register[D7:D0]\r
+       always @(posedge clk or negedge rst_n) begin\r
+               if (rst_n == 1'b0) begin\r
+                       mr_adv_ability[7:0] <= 8'h01;\r
+               end\r
+               else if (sync_reset || sgmii_mode_change || gbe_mode_change) begin\r
+                       if (gbe_mode_d4)\r
+                               mr_adv_ability[7:0] <= initval_gbe[7:0];\r
+                       else if (sgmii_mode)\r
+                               mr_adv_ability[7:0] <= initval_phy[7:0];\r
+                       else\r
+                               mr_adv_ability[7:0] <= initval_mac[7:0];\r
+               end\r
+               else begin\r
+                       if (cs_0 && ready && write && (sgmii_mode || gbe_mode)) begin\r
+                               mr_adv_ability[7:0] <= data_in[7:0];\r
+                       end\r
+               end\r
+       end\r
+\r
+\r
+       // High Portion of Register[D15:D8]\r
+       always @(posedge clk or negedge rst_n) begin\r
+               if (rst_n == 1'b0) begin\r
+                       mr_adv_ability[15:8] <= 8'h40; // default\r
+               end\r
+               else if (sync_reset || sgmii_mode_change || gbe_mode_change) begin\r
+                       if (gbe_mode_d4)\r
+                               mr_adv_ability[15:8] <= initval_gbe[15:8];\r
+                       else if (sgmii_mode)\r
+                               mr_adv_ability[15:8] <= initval_phy[15:8];\r
+                       else\r
+                               mr_adv_ability[15:8] <= initval_mac[15:8];\r
+               end\r
+               else begin\r
+                       if (cs_1 && ready && write && (sgmii_mode || gbe_mode)) begin\r
+                               mr_adv_ability[15:8] <= data_in[15:8];\r
+                       end\r
+               end\r
+       end\r
+\r
+\r
+\r
+\r
+\r
+\r
+\r
+\r
+\r
+// Read Operations\r
+\r
+       always @(*) begin\r
+                       data_out[7:0] <= mr_adv_ability[7:0];\r
+                       data_out[15:8] <= mr_adv_ability[15:8];\r
+       end\r
+\r
+endmodule\r
+\r
+\r
+\r
+\r
+\r
+\r
+module register_5_hb (\r
+       rst_n,\r
+       mr_lp_adv_ability,\r
+       cs_0,\r
+       cs_1,\r
+       ready,\r
+\r
+       data_out\r
+);\r
+\r
+input           rst_n;\r
+input           cs_0;\r
+input           cs_1;\r
+input           ready;\r
+input  [15:0]   mr_lp_adv_ability;\r
+                               // This entire register is read-only\r
+                               ///////////////////////////////////\r
+                               // When sgmii_mode == 0 == MAC\r
+                               ///////////////////////////////////\r
+                               // D15 = PHY Link Status (1=up, 0=down)\r
+                               // D14 = PHY Autonegotiation Handshake\r
+                               // D12 = PHY Duplex Mode (1=full, 0=half)\r
+                               // D11:10 = PHY Speed (11=reserved)\r
+                               //                    (10=1000Mbps)\r
+                               //                    (01=100 Mbps)\r
+                               //                    (00=10  Mbps)\r
+                               // D0 = 1\r
+                               // all other bits = 0\r
+                               ///////////////////////////////////\r
+                               //When sgmii_mode == 1 = PHY\r
+                               // D14 = MAC Autonegotiation Handshake\r
+                               // D0 = 1\r
+                               // all other bits = 0\r
+                               ///////////////////////////////////\r
+output [15:0]   data_out;\r
+\r
+reg [15:0]      data_out;\r
+\r
+// Read Operations\r
+\r
+       always @(*) begin\r
+                       data_out[7:0] <= mr_lp_adv_ability[7:0];\r
+                       data_out[15:8] <= mr_lp_adv_ability[15:8];\r
+       end\r
+endmodule\r
+\r
+module register_6_hb (\r
+       rst_n,\r
+       clk,\r
+       mr_page_rx,\r
+       cs_0,\r
+       cs_1,\r
+       write,\r
+       ready,\r
+\r
+       data_out\r
+);\r
+\r
+input           rst_n;\r
+input           clk;\r
+input           cs_0;\r
+input           cs_1;\r
+input           write;\r
+input           ready;\r
+input           mr_page_rx;\r
+output [15:0]   data_out;\r
+\r
+reg [15:0]      data_out;\r
+reg             mr_page_rx_latched;\r
+reg             clear_on_read;\r
+reg             read_detect;\r
+reg             rd_d1;\r
+reg             rd_d2;\r
+\r
+// generate clear-on-read signal\r
+       always @(posedge clk or negedge rst_n) begin\r
+               if (rst_n == 1'b0) begin\r
+                       clear_on_read <= 0;\r
+                       read_detect <= 0;\r
+                       rd_d1 <= 0;\r
+                       rd_d2 <= 0;\r
+               end\r
+               else begin\r
+                       if (!write && ready && cs_0)\r
+                               read_detect <= 1;\r
+                       else \r
+                               read_detect <= 0;\r
+\r
+                       rd_d1 <= read_detect;\r
+                       rd_d2 <= rd_d1;\r
+\r
+                       // assert on falling edge of rd_d2\r
+                       clear_on_read <= !rd_d1 & rd_d2;\r
+               end\r
+       end\r
+\r
+\r
+// Latch and Clear\r
+       always @(posedge clk or negedge rst_n) begin\r
+               if (rst_n == 1'b0) begin\r
+                       mr_page_rx_latched <= 0;\r
+               end\r
+               else begin\r
+                       if (clear_on_read)\r
+                               mr_page_rx_latched <= 0;\r
+                       else if (mr_page_rx)\r
+                               mr_page_rx_latched <= 1;\r
+               end\r
+       end\r
+\r
+\r
+// Read Operations\r
+\r
+       always @(*) begin\r
+                       data_out[15:2] <= 14'd0;\r
+                       data_out[1] <= mr_page_rx_latched;\r
+                       data_out[0] <= 0;\r
+       end\r
+endmodule\r
+\r
+\r
+module regs_hb (\r
+       rst_n,\r
+       hclk,\r
+       gbe_mode,\r
+       sgmii_mode,\r
+       hcs_n,\r
+       hwrite_n,\r
+       haddr,\r
+       hdatain,\r
+\r
+       hdataout,\r
+       hready_n,\r
+\r
+       mr_an_complete,\r
+       mr_page_rx,\r
+       mr_lp_adv_ability,\r
+\r
+       mr_main_reset,\r
+       mr_an_enable,\r
+       mr_restart_an,\r
+       mr_adv_ability\r
+);\r
+\r
+input           rst_n;\r
+input           hclk;\r
+input           gbe_mode;\r
+input           sgmii_mode;\r
+input           hcs_n;\r
+input           hwrite_n;\r
+input    [3:0]  haddr;\r
+input    [7:0]  hdatain;\r
+\r
+output   [7:0]  hdataout;\r
+output          hready_n;\r
+\r
+input           mr_an_complete;\r
+input           mr_page_rx;\r
+input    [15:0] mr_lp_adv_ability;\r
+\r
+output          mr_main_reset;\r
+output          mr_an_enable;\r
+output          mr_restart_an;\r
+output   [15:0] mr_adv_ability;\r
+\r
+///////////////////////////////////\r
+\r
+\r
+\r
+reg   [7:0]  hdataout;\r
+reg hr;\r
+reg hready_n;\r
+\r
+reg hcs_n_delayed;\r
+\r
+wire reg0_cs_0;\r
+wire reg0_cs_1;\r
+\r
+wire reg1_cs_0;\r
+wire reg1_cs_1;\r
+\r
+wire reg4_cs_0;\r
+wire reg4_cs_1;\r
+\r
+wire reg5_cs_0;\r
+wire reg5_cs_1;\r
+\r
+wire reg6_cs_0;\r
+wire reg6_cs_1;\r
+\r
+wire [15:0] data_out_reg_0;\r
+wire [15:0] data_out_reg_1;\r
+wire [15:0] data_out_reg_4;\r
+wire [15:0] data_out_reg_5;\r
+wire [15:0] data_out_reg_6;\r
+\r
+\r
+\r
+register_addr_decoder ad_dec (\r
+       .rst_n(rst_n),\r
+       .addr(haddr),\r
+       .cs_in(~hcs_n),\r
+\r
+       .reg0_cs_0 (reg0_cs_0),\r
+       .reg0_cs_1 (reg0_cs_1),\r
+       .reg1_cs_0 (reg1_cs_0),\r
+       .reg1_cs_1 (reg1_cs_1),\r
+       .reg4_cs_0 (reg4_cs_0),\r
+       .reg4_cs_1 (reg4_cs_1),\r
+       .reg5_cs_0 (reg5_cs_0),\r
+       .reg5_cs_1 (reg5_cs_1),\r
+       .reg6_cs_0 (reg6_cs_0),\r
+       .reg6_cs_1 (reg6_cs_1)\r
+);\r
+\r
+\r
+register_0_hb   register_0 (\r
+       .rst_n (rst_n),\r
+       .clk (hclk), \r
+       .cs_0 (reg0_cs_0),\r
+       .cs_1 (reg0_cs_1),\r
+       .write (~hwrite_n),\r
+       .ready (1'b1),\r
+       .data_in ({hdatain, hdatain}),\r
+\r
+       .data_out (data_out_reg_0),\r
+       .mr_main_reset (mr_main_reset),\r
+       .mr_an_enable (mr_an_enable),\r
+       .mr_restart_an (mr_restart_an)\r
+);\r
+\r
+\r
+register_1_hb   register_1 (\r
+       .rst_n (rst_n),\r
+       .cs_0 (reg1_cs_0),\r
+       .cs_1 (reg1_cs_1),\r
+       .mr_an_complete (mr_an_complete),\r
+\r
+       .data_out (data_out_reg_1)\r
+);\r
+\r
+\r
+register_4_hb   register_4 (\r
+       .rst_n (rst_n),\r
+       .clk (hclk), \r
+       .gbe_mode (gbe_mode),\r
+       .sgmii_mode (sgmii_mode),\r
+       .cs_0 (reg4_cs_0),\r
+       .cs_1 (reg4_cs_1),\r
+       .write (~hwrite_n),\r
+       .ready (1'b1),\r
+       .data_in ({hdatain, hdatain}),\r
+\r
+       .data_out (data_out_reg_4),\r
+       .mr_adv_ability (mr_adv_ability)\r
+);\r
+\r
+\r
+register_5_hb   register_5 (\r
+       .rst_n (rst_n),\r
+       .mr_lp_adv_ability (mr_lp_adv_ability),\r
+       .cs_0 (reg5_cs_0),\r
+       .cs_1 (reg5_cs_1),\r
+       .ready (1'b1),\r
+\r
+       .data_out (data_out_reg_5)\r
+);\r
+\r
+\r
+register_6_hb   register_6 (\r
+       .rst_n (rst_n),\r
+       .clk (hclk), \r
+       .mr_page_rx (mr_page_rx),\r
+       .cs_0 (reg6_cs_0),\r
+       .cs_1 (reg6_cs_1),\r
+       .write (~hwrite_n),\r
+       .ready (1'b1),\r
+\r
+       .data_out (data_out_reg_6)\r
+);\r
+\r
+\r
+\r
+// generate an ack\r
+always @(posedge hclk or negedge rst_n) begin\r
+       if (rst_n == 1'b0) begin\r
+               hcs_n_delayed <= 1'b1;\r
+               hr <= 1'b1;\r
+               hready_n <= 1'b1;\r
+       end\r
+       else begin\r
+               hcs_n_delayed <= hcs_n;\r
+\r
+               //assert on falling edge of delayed chip select\r
+               hr <= ~hcs_n & hcs_n_delayed;\r
+               hready_n <= ~hr;\r
+       end\r
+end\r
+\r
+\r
+\r
+// Mux Register Read-Data Outputs\r
+always @(posedge hclk or negedge rst_n)\r
+begin\r
+       if (rst_n == 1'b0) begin\r
+               hdataout <= 8'd0;\r
+       end\r
+       else begin\r
+               case (haddr[3:0])\r
+\r
+                       4'd0:\r
+                         begin\r
+                               hdataout <= data_out_reg_0[7:0];\r
+                         end\r
+\r
+\r
+                       4'd1:\r
+                         begin\r
+                               hdataout <= data_out_reg_0[15:8];\r
+                         end\r
+\r
+                       /////////////////////////////////////////////\r
+\r
+                       4'd2:\r
+                         begin\r
+                               hdataout <= data_out_reg_1[7:0];\r
+                         end\r
+\r
+\r
+                       4'd3:\r
+                         begin\r
+                               hdataout <= data_out_reg_1[15:8];\r
+                         end\r
+\r
+                       /////////////////////////////////////////////\r
+\r
+                       4'd8:\r
+                         begin\r
+                               hdataout <= data_out_reg_4[7:0];\r
+                         end\r
+\r
+\r
+                       4'd9:\r
+                         begin\r
+                               hdataout <= data_out_reg_4[15:8];\r
+                         end\r
+\r
+                       /////////////////////////////////////////////\r
+\r
+                       4'd10:\r
+                         begin\r
+                               hdataout <= data_out_reg_5[7:0];\r
+                         end\r
+\r
+\r
+                       4'd11:\r
+                         begin\r
+                               hdataout <= data_out_reg_5[15:8];\r
+                         end\r
+\r
+                       /////////////////////////////////////////////\r
+\r
+                       4'd12:\r
+                         begin\r
+                               hdataout <= data_out_reg_6[7:0];\r
+                         end\r
+\r
+\r
+                       4'd13:\r
+                         begin\r
+                               hdataout <= data_out_reg_6[15:8];\r
+                         end\r
+\r
+                       /////////////////////////////////////////////\r
+\r
+                       default:\r
+                         begin\r
+                               hdataout <= 8'd0;\r
+                         end\r
+               endcase\r
+       end\r
+end\r
+\r
+endmodule\r
+\r
+module register_addr_decoder (\r
+       rst_n,\r
+       addr,\r
+       cs_in,\r
+\r
+       reg0_cs_0,\r
+       reg0_cs_1,\r
+\r
+       reg1_cs_0,\r
+       reg1_cs_1,\r
+\r
+       reg4_cs_0,\r
+       reg4_cs_1,\r
+\r
+       reg5_cs_0,\r
+       reg5_cs_1,\r
+\r
+       reg6_cs_0,\r
+       reg6_cs_1\r
+);\r
+\r
+input           rst_n;\r
+input           cs_in;\r
+input [3:0]     addr;\r
+\r
+output          reg0_cs_0;\r
+output          reg0_cs_1;\r
+\r
+output          reg1_cs_0;\r
+output          reg1_cs_1;\r
+\r
+output          reg4_cs_0;\r
+output          reg4_cs_1;\r
+\r
+output          reg5_cs_0;\r
+output          reg5_cs_1;\r
+\r
+output          reg6_cs_0;\r
+output          reg6_cs_1;\r
+\r
+//////////////////////////\r
+\r
+wire             reg0_cs_0;\r
+wire             reg0_cs_1;\r
+\r
+wire             reg1_cs_0;\r
+wire             reg1_cs_1;\r
+\r
+wire             reg4_cs_0;\r
+wire             reg4_cs_1;\r
+\r
+wire             reg5_cs_0;\r
+wire             reg5_cs_1;\r
+\r
+wire             reg6_cs_0;\r
+wire             reg6_cs_1;\r
+\r
+//////////////////////////\r
+\r
+assign reg0_cs_0 = (addr == 4'h0) ? cs_in : 1'b0;\r
+assign reg0_cs_1 = (addr == 4'h1) ? cs_in : 1'b0;\r
+\r
+assign reg1_cs_0 = (addr == 4'h2) ? cs_in : 1'b0;\r
+assign reg1_cs_1 = (addr == 4'h3) ? cs_in : 1'b0;\r
+\r
+assign reg4_cs_0 = (addr == 4'h8) ? cs_in : 1'b0;\r
+assign reg4_cs_1 = (addr == 4'h9) ? cs_in : 1'b0;\r
+\r
+assign reg5_cs_0 = (addr == 4'ha) ? cs_in : 1'b0;\r
+assign reg5_cs_1 = (addr == 4'hb) ? cs_in : 1'b0;\r
+\r
+assign reg6_cs_0 = (addr == 4'hc) ? cs_in : 1'b0;\r
+assign reg6_cs_1 = (addr == 4'hd) ? cs_in : 1'b0;\r
+\r
+\r
+endmodule\r
+\r
diff --git a/trb3_gbe_test/ipcores/sgmii33/reset_controller_cdr.v b/trb3_gbe_test/ipcores/sgmii33/reset_controller_cdr.v
new file mode 100755 (executable)
index 0000000..fa0a645
--- /dev/null
@@ -0,0 +1,219 @@
+//**************************************************************************\r
+// *************************************************************************\r
+// *                LATTICE SEMICONDUCTOR CONFIDENTIAL                     *\r
+// *                         PROPRIETARY NOTE                              *\r
+// *                                                                       *\r
+// *  This software contains information confidential and proprietary      *\r
+// *  to Lattice Semiconductor Corporation.  It shall not be reproduced    *\r
+// *  in whole or in part, or transferred to other documents, or disclosed *\r
+// *  to third parties, or used for any purpose other than that for which  *\r
+// *  it was obtained, without the prior written consent of Lattice        *\r
+// *  Semiconductor Corporation.  All rights reserved.                     *\r
+// *                                                                       *\r
+// *************************************************************************\r
+//**************************************************************************\r
+\r
+////////////////////////////////////////////////////////////////////////\r
+// This module forces a RESET to the SERDES CDR\r
+//     when the CDR either loses lock  or loses signal\r
+////////////////////////////////////////////////////////////////////////\r
+\r
+`timescale 1ns/100ps\r
+\r
+module reset_controller_cdr (\r
+\r
+       rst_n,\r
+       clk,\r
+\r
+       cdr_lol,\r
+\r
+       cdr_rst_out\r
+       );\r
+\r
+input rst_n;\r
+input clk; // 125Mhz clock\r
+\r
+input cdr_lol;\r
+\r
+output cdr_rst_out;\r
+\r
+\r
+///////////////////////////////////////\r
+\r
+reg cdr_rst_out;\r
+\r
+reg cdr_lol_mstb_1;\r
+reg cdr_lol_mstb_2;\r
+\r
+\r
+reg sht_mx;\r
+reg [5:0] sht_count;\r
+\r
+reg lng_mx;\r
+reg [22:0] lng_count;\r
+\r
+reg cnt_rst;\r
+parameter\r
+       ASSRT_RST           = 3'd0,\r
+       WAIT_SHORT          = 3'd1,\r
+       DSSRT_RST           = 3'd2,\r
+       WAIT_LONG           = 3'd3,\r
+       SEEK_CDR_ERR        = 3'd4,\r
+       SEEK_SIGNAL_RESTORE = 3'd5;\r
+reg[2:0] fsm;\r
+\r
+//////////////////////////////////////\r
+//  Mestastability Filter\r
+//////////////////////////////////////\r
+always @(posedge clk or negedge rst_n)\r
+begin\r
+       if (rst_n == 1'b0) begin\r
+               cdr_lol_mstb_1 <= 1'b1;\r
+               cdr_lol_mstb_2 <= 1'b1;\r
+\r
+\r
+       end\r
+       else begin\r
+               cdr_lol_mstb_1 <= cdr_lol;\r
+               cdr_lol_mstb_2 <= cdr_lol_mstb_1;\r
+\r
+       end\r
+end \r
+\r
+\r
+\r
+///////////////////////////////////////\r
+//  Operate Short Timer (256 nsec)\r
+///////////////////////////////////////\r
+always @(posedge clk or negedge rst_n)\r
+begin\r
+       if (rst_n == 1'b0) begin\r
+               sht_mx <= 1'b0;\r
+               sht_count <= 6'd0;\r
+       end\r
+       else begin\r
+\r
+               // define max count\r
+               if (sht_count[5] && (!cnt_rst)) begin\r
+                       sht_mx <= 1'b1;\r
+               end\r
+               else begin\r
+                       sht_mx <= 1'b0;\r
+               end\r
+\r
+               // operate counter\r
+               if (cnt_rst) begin\r
+                       sht_count <= 6'd0; //clear\r
+               end\r
+               else if (sht_mx) begin\r
+                       sht_count <= sht_count; //hold\r
+               end\r
+               else begin\r
+                       sht_count <= sht_count + 1; //count\r
+               end\r
+       end\r
+end \r
+\r
+\r
+/////////////////////////////////////\r
+//  Operate Long Timer (33 msec)\r
+/////////////////////////////////////\r
+always @(posedge clk or negedge rst_n)\r
+begin\r
+       if (rst_n == 1'b0) begin\r
+               lng_mx <= 1'b0;\r
+               lng_count <= 23'd0;\r
+       end\r
+       else begin\r
+\r
+               // define max count\r
+               if (lng_count[22] && (!cnt_rst)) begin\r
+                       lng_mx <= 1'b1;\r
+               end\r
+               else begin\r
+                       lng_mx <= 1'b0;\r
+               end\r
+\r
+               // operate counter\r
+               if (cnt_rst) begin\r
+                       lng_count <= 6'd0; //clear\r
+               end\r
+               else if (lng_mx) begin\r
+                       lng_count <= lng_count; //hold\r
+               end\r
+               else begin\r
+                       lng_count <= lng_count + 1; //count\r
+               end\r
+       end\r
+end \r
+\r
+\r
+/////////////////////////////////////\r
+//  State Machine\r
+/////////////////////////////////////\r
+always @(posedge clk or negedge rst_n)\r
+begin\r
+       if (rst_n == 1'b0) begin\r
+               cdr_rst_out <= 1'b1;\r
+               cnt_rst <= 1'b1;\r
+               fsm <= ASSRT_RST;\r
+       end\r
+       else begin\r
+\r
+               // defaults\r
+               cnt_rst <= 1'b0;\r
+\r
+               case (fsm)\r
+                       ASSRT_RST: begin\r
+                               cdr_rst_out <= 1'b1; // assert\r
+                               cnt_rst <= 1'b1;\r
+                               fsm <= WAIT_SHORT;\r
+                       end\r
+\r
+                       WAIT_SHORT: begin\r
+                               // wait for 256 nsec\r
+                               if (sht_mx && (!cnt_rst)) begin\r
+                                       fsm <= DSSRT_RST;\r
+                               end\r
+                       end\r
+\r
+                       DSSRT_RST: begin\r
+                               cdr_rst_out <= 1'b0; // de-assert\r
+                               fsm <= WAIT_LONG;\r
+                       end\r
+\r
+                       WAIT_LONG: begin\r
+                               // wait for 33 msec\r
+                               if (lng_mx && (!cnt_rst)) begin\r
+                                       fsm <= SEEK_CDR_ERR;\r
+                               end\r
+                       end\r
+\r
+                       SEEK_CDR_ERR: begin\r
+\r
+                               cnt_rst <= 1'b1;\r
+\r
+\r
+                               // Wait for CDR to fail\r
+                               if (cdr_lol_mstb_2) begin\r
+                                       fsm <= ASSRT_RST;\r
+                               end\r
+                               else begin\r
+                                       fsm <= SEEK_CDR_ERR;\r
+                               end\r
+                       end\r
+\r
+\r
+\r
+                       default: begin\r
+                               fsm <= ASSRT_RST;\r
+                       end\r
+               endcase\r
+\r
+       end\r
+end \r
+\r
+\r
+\r
+endmodule\r
+\r
diff --git a/trb3_gbe_test/ipcores/sgmii33/reset_controller_pcs.v b/trb3_gbe_test/ipcores/sgmii33/reset_controller_pcs.v
new file mode 100755 (executable)
index 0000000..9d2e584
--- /dev/null
@@ -0,0 +1,226 @@
+//**************************************************************************\r
+// *************************************************************************\r
+// *                LATTICE SEMICONDUCTOR CONFIDENTIAL                     *\r
+// *                         PROPRIETARY NOTE                              *\r
+// *                                                                       *\r
+// *  This software contains information confidential and proprietary      *\r
+// *  to Lattice Semiconductor Corporation.  It shall not be reproduced    *\r
+// *  in whole or in part, or transferred to other documents, or disclosed *\r
+// *  to third parties, or used for any purpose other than that for which  *\r
+// *  it was obtained, without the prior written consent of Lattice        *\r
+// *  Semiconductor Corporation.  All rights reserved.                     *\r
+// *                                                                       *\r
+// *************************************************************************\r
+//**************************************************************************\r
+\r
+////////////////////////////////////////////////////////////////////////\r
+// This module implements the SERDES/PCS reset sequence as specified\r
+// in Figure 47 of Lattice Technical Note TN1176\r
+////////////////////////////////////////////////////////////////////////\r
+\r
+`timescale 1ns/100ps\r
+\r
+module reset_controller_pcs (\r
+\r
+       rst_n,\r
+       clk,\r
+\r
+       tx_plol,\r
+       rx_cdr_lol,\r
+\r
+       quad_rst_out,\r
+       tx_pcs_rst_out,\r
+       rx_pcs_rst_out\r
+       );\r
+\r
+input rst_n;\r
+input clk; // 125Mhz clock\r
+\r
+input tx_plol;\r
+input rx_cdr_lol;\r
+\r
+output quad_rst_out;\r
+output tx_pcs_rst_out;\r
+output rx_pcs_rst_out;\r
+\r
+\r
+///////////////////////////////////////\r
+\r
+reg quad_rst_out;\r
+reg tx_pcs_rst_out;\r
+reg rx_pcs_rst_out;\r
+\r
+reg q_mx;\r
+reg [3:0] q_count;\r
+\r
+reg rx_cdr_lol_mstb_1;\r
+reg rx_cdr_lol_mstb_2;\r
+\r
+reg wd_mx;\r
+reg wd_mx_d1;\r
+reg wd_mx_re;\r
+reg [22:0] wd_count;\r
+reg watchdog_flag;\r
+\r
+////////////////////////////////////////////////////////\r
+//  Assert Quad RST For 8 Clocks After Device Hard Reset\r
+////////////////////////////////////////////////////////\r
+always @(posedge clk or negedge rst_n)\r
+begin\r
+       if (rst_n == 1'b0) begin\r
+               q_mx <= 1'b0;\r
+               q_count <= 4'd0;\r
+               quad_rst_out <= 1'b1; // assert\r
+       end\r
+       else begin\r
+\r
+               // define max count\r
+               if (q_count[3]) begin\r
+                       q_mx <= 1'b1;\r
+               end\r
+               else begin\r
+                       q_mx <= 1'b0;\r
+               end\r
+\r
+               // operate counter\r
+               if (q_mx) begin\r
+                       q_count <= q_count; //hold\r
+               end\r
+               else begin\r
+                       q_count <= q_count + 1; //count\r
+               end\r
+\r
+               // operate quad reset\r
+               if (q_mx) begin\r
+                       quad_rst_out <= 1'b0; //de-assert on max-count\r
+               end\r
+               else begin\r
+                       quad_rst_out <= 1'b1; //assert otherwise\r
+               end\r
+       end\r
+end \r
+\r
+\r
+////////////////////////////////////////////////////////////////////\r
+//  Watchdog Timer -- In Case PLLs Don't Acquire Lock Within 33msec\r
+////////////////////////////////////////////////////////////////////\r
+always @(posedge clk or negedge rst_n)\r
+begin\r
+       if (rst_n == 1'b0) begin\r
+               wd_mx <= 1'b0;\r
+               wd_mx_d1 <= 1'b0;\r
+               wd_mx_re <= 1'b0;\r
+               wd_count <= 23'd0;\r
+               watchdog_flag <= 1'b0;\r
+       end\r
+       else begin\r
+\r
+               // define max count\r
+               if (wd_count[22]) begin\r
+                       wd_mx <= 1'b1;\r
+               end\r
+               else begin\r
+                       wd_mx <= 1'b0;\r
+               end\r
+\r
+               // operate counter\r
+               if (quad_rst_out) begin\r
+                       wd_count <= 23'd0; //clear\r
+               end\r
+               else if (wd_mx) begin\r
+                       wd_count <= wd_count; //hold\r
+               end\r
+               else begin\r
+                       wd_count <= wd_count + 1; //count\r
+               end\r
+\r
+               // detect rising edge of max_count flag\r
+               wd_mx_d1 <= wd_mx;\r
+\r
+               wd_mx_re <= wd_mx & (!wd_mx_d1);\r
+\r
+               // generate watchdog flag\r
+               watchdog_flag <= wd_mx_re;\r
+       end\r
+end \r
+\r
+\r
+\r
+\r
+////////////////////////////////////////////////\r
+//  De-Assert TX PCS After TX PLL Acquires Lock\r
+////////////////////////////////////////////////\r
+always @(posedge clk or negedge rst_n)\r
+begin\r
+       if (rst_n == 1'b0) begin\r
+               tx_pcs_rst_out <= 1'b1; // assert\r
+       end\r
+       else begin\r
+\r
+               case (tx_pcs_rst_out)\r
+                       1'b1: begin\r
+                               // if asserted, wait for PLL to acquire lock\r
+                               if ((!quad_rst_out && (!tx_plol))   ||   watchdog_flag) begin\r
+                                       tx_pcs_rst_out <= 1'b0; // deassert\r
+                               end\r
+                       end\r
+\r
+                       1'b0: begin\r
+                               // if de-asserted, stay that way\r
+                               tx_pcs_rst_out <= 1'b0; // deassert\r
+                       end\r
+\r
+                       default: begin\r
+                               tx_pcs_rst_out <= 1'b1; // assert\r
+                       end\r
+               endcase\r
+\r
+       end\r
+end \r
+\r
+\r
+\r
+\r
+\r
+///////////////////////////////////////////////////////\r
+//  De-Assert RX PCS-Chan-0 After RX CDR Acquires Lock\r
+///////////////////////////////////////////////////////\r
+always @(posedge clk or negedge rst_n)\r
+begin\r
+       if (rst_n == 1'b0) begin\r
+               rx_pcs_rst_out <= 1'b1; // assert\r
+               rx_cdr_lol_mstb_1 <= 1'b1;\r
+               rx_cdr_lol_mstb_2 <= 1'b1;\r
+       end\r
+       else begin\r
+\r
+               // metastability - filter\r
+               rx_cdr_lol_mstb_1 <= rx_cdr_lol;\r
+               rx_cdr_lol_mstb_2 <= rx_cdr_lol_mstb_1;\r
+\r
+               case (rx_pcs_rst_out)\r
+                       1'b1: begin\r
+                               // if asserted, wait for CDR to acquire lock\r
+                               if ((!quad_rst_out && (!rx_cdr_lol_mstb_2))   ||   watchdog_flag) begin\r
+                                       rx_pcs_rst_out <= 1'b0; // deassert\r
+                               end\r
+                       end\r
+\r
+                       1'b0: begin\r
+                               // if de-asserted, stay that way\r
+                               rx_pcs_rst_out <= 1'b0; // deassert\r
+                       end\r
+\r
+                       default: begin\r
+                               rx_pcs_rst_out <= 1'b1; // assert\r
+                       end\r
+               endcase\r
+\r
+       end\r
+end \r
+\r
+\r
+\r
+\r
+endmodule\r
+\r
diff --git a/trb3_gbe_test/ipcores/sgmii33/sgmii_channel_smi.v b/trb3_gbe_test/ipcores/sgmii33/sgmii_channel_smi.v
new file mode 100644 (file)
index 0000000..a97ca4f
--- /dev/null
@@ -0,0 +1,237 @@
+//**************************************************************************\r
+// *************************************************************************\r
+// *                LATTICE SEMICONDUCTOR CONFIDENTIAL                     *\r
+// *                         PROPRIETARY NOTE                              *\r
+// *                                                                       *\r
+// *  This software contains information confidential and proprietary      *\r
+// *  to Lattice Semiconductor Corporation.  It shall not be reproduced    *\r
+// *  in whole or in part, or transferred to other documents, or disclosed *\r
+// *  to third parties, or used for any purpose other than that for which  *\r
+// *  it was obtained, without the prior written consent of Lattice        *\r
+// *  Semiconductor Corporation.  All rights reserved.                     *\r
+// *                                                                       *\r
+// *************************************************************************\r
+//**************************************************************************\r
+\r
+`timescale 1ns/100ps\r
+\r
+module sgmii_channel_smi (\r
+\r
+       // Control Interface\r
+       rst_n,\r
+       gbe_mode,\r
+       sgmii_mode,\r
+       signal_detect,\r
+       debug_link_timer_short,\r
+       rx_compensation_err,\r
+       non_an_rate,\r
+\r
+       // G/MII Interface\r
+       in_clk_gmii,\r
+       in_clk_mii,\r
+       data_in_mii,\r
+       en_in_mii,\r
+       err_in_mii,\r
+\r
+       out_clk_gmii,\r
+       out_clk_mii,\r
+       data_out_mii,\r
+       dv_out_mii,\r
+       err_out_mii,\r
+       col_out_mii,\r
+       crs_out_mii,\r
+\r
+       // 8-bit Interface\r
+       data_out_8bi,\r
+       kcntl_out_8bi,\r
+       disparity_cntl_out_8bi,\r
+\r
+       serdes_recovered_clk,\r
+       data_in_8bi,\r
+       kcntl_in_8bi,\r
+       even_in_8bi,\r
+       disp_err_in_8bi,\r
+       cv_err_in_8bi,\r
+       err_decode_mode_8bi,\r
+\r
+       // MDIO Port\r
+       mdc,\r
+       mdio,\r
+       port_id\r
+   );\r
+\r
+\r
+\r
+// I/O Declarations\r
+input         rst_n ;       // System Reset, Active Low\r
+input         signal_detect ;\r
+input         gbe_mode ;  // GBE Mode   (0=SGMII    1=GBE)\r
+input         sgmii_mode ;  // SGMII PCS Mode   (0=MAC    1=PHY)\r
+input         debug_link_timer_short ;  // (0=NORMAL    1=SHORT)\r
+output        rx_compensation_err;  // Active high pulse indicating RX_CTC_FIFO either underflowed or overflowed\r
+input [1:0]   non_an_rate ; // MII Rate Used When Autonegotiation is Disabled (00=10Mbps; 01=100Mbps; 10=1Gbps)\r
+\r
+input         in_clk_mii ;      // G/MII Transmit clock 2.5Mhz/25Mhz/125Mhz \r
+input [7:0]   data_in_mii ;        // G/MII Tx data\r
+input         en_in_mii ;       // G/MII data valid\r
+input         err_in_mii ;       // G/MII Tx error\r
+\r
+input         out_clk_mii ;      // G/MII Receice clock 2.5Mhz/25Mhz/125MHz \r
+output [7:0]   data_out_mii ;       // G/MII Rx data\r
+output         dv_out_mii ;      // G/MII Rx data valid\r
+output         err_out_mii ;      // G/MII Rx error\r
+output         col_out_mii ;        // G/MII collision detect \r
+output         crs_out_mii ;        // G/MII carrier sense detect \r
+\r
+output [7:0]   data_out_8bi ;            // 8BI Tx Data\r
+output         kcntl_out_8bi ;           // 8BI Tx Kcntl\r
+output         disparity_cntl_out_8bi ;  // 8BI Tx Kcntl\r
+\r
+input         serdes_recovered_clk ;\r
+input [7:0]   data_in_8bi  ;     // 8BI Rx Data\r
+input         kcntl_in_8bi ;     // 8BI Rx Kcntl\r
+input         even_in_8bi ;      // 8BI Rx Even\r
+input         disp_err_in_8bi ;  // 8BI Rx Disparity Error\r
+input         cv_err_in_8bi ;    // 8BI Rx Coding Violation Error\r
+input         err_decode_mode_8bi ; // 8BI Error Decode Mode (0=NORMAL,  1=DECODE_MODE)\r
+\r
+input         in_clk_gmii ;     // GMII Transmit clock 125Mhz\r
+input         out_clk_gmii ;     // GMII Receive clock 125Mhz\r
+\r
+input          mdc;\r
+inout          mdio;\r
+input [4:0]    port_id;\r
+\r
+\r
+wire           mdin;\r
+wire           mdout;\r
+wire           mdout_en;\r
+\r
+// Internal Signals \r
+\r
+wire           mr_an_complete;\r
+wire           mr_page_rx;\r
+wire [15:0]    mr_lp_adv_ability;\r
+\r
+wire           mr_main_reset;\r
+wire           mr_an_enable;\r
+wire           mr_restart_an;\r
+wire [15:0]    mr_adv_ability;\r
+\r
+wire [1:0]     operational_rate;\r
+\r
+\r
+\r
+\r
+\r
+\r
+\r
+\r
+// SGMII PCS\r
+sgmii33 sgmii33_U (\r
+       // Clock and Reset\r
+       .rst_n (rst_n ),\r
+       .signal_detect (signal_detect),\r
+       .gbe_mode (gbe_mode),\r
+       .sgmii_mode (sgmii_mode),\r
+       .debug_link_timer_short (debug_link_timer_short), \r
+       .operational_rate (operational_rate),\r
+       .rx_compensation_err (rx_compensation_err),\r
+       .tx_clk_125 (in_clk_gmii),\r
+       .serdes_recovered_clk (serdes_recovered_clk),\r
+       .rx_clk_125 (out_clk_gmii),\r
+\r
+       // Control\r
+\r
+\r
+       // (G)MII TX Port\r
+       .tx_clk_mii (in_clk_mii),\r
+       .tx_d (data_in_mii),\r
+       .tx_en (err_in_mii),\r
+       .tx_er (en_in_mii),\r
+\r
+       // (G)MII RX Port\r
+       .rx_clk_mii (out_clk_mii),\r
+       .rx_d (data_out_mii),\r
+       .rx_dv (dv_out_mii),\r
+       .rx_er (err_out_mii),\r
+       .col (col_out_mii),\r
+       .crs (crs_out_mii),\r
+                  \r
+       // 8BI TX Port\r
+       .tx_data (data_out_8bi),\r
+       .tx_kcntl (kcntl_out_8bi),\r
+       .tx_disparity_cntl (disparity_cntl_out_8bi),\r
+\r
+       // 8BI RX Port\r
+       .rx_data (data_in_8bi),\r
+       .rx_kcntl (kcntl_in_8bi),\r
+       .rx_even (even_in_8bi),\r
+       .rx_disp_err (disp_err_in_8bi),\r
+       .rx_cv_err (cv_err_in_8bi),\r
+       .rx_err_decode_mode (err_decode_mode_8bi),\r
+\r
+       // Management Interface  I/O\r
+       .mr_adv_ability (mr_adv_ability),\r
+       .mr_an_enable (mr_an_enable), \r
+       .mr_main_reset (mr_main_reset),  \r
+       .mr_restart_an (mr_restart_an),   \r
+\r
+       .mr_an_complete (mr_an_complete),   \r
+       .mr_lp_adv_ability (mr_lp_adv_ability), \r
+       .mr_page_rx (mr_page_rx)\r
+       );\r
+\r
+\r
+\r
+// SMI Register Interface for SGMII IP Core\r
+register_interface_smi   ri (\r
+\r
+       // Control Signals\r
+       .rst_n (rst_n),\r
+       .gbe_mode (gbe_mode),\r
+       .sgmii_mode (sgmii_mode),\r
+\r
+       // MDIO Port\r
+       .mdc (mdc),\r
+       .mdin (mdin),\r
+       .mdout (mdout),\r
+       .mdout_en (mdout_en),\r
+       .port_id (port_id),\r
+\r
+       // Register Outputs\r
+       .mr_an_enable (mr_an_enable),\r
+       .mr_restart_an (mr_restart_an),\r
+       .mr_main_reset (mr_main_reset),\r
+       .mr_adv_ability (mr_adv_ability),\r
+\r
+       // Register Inputs\r
+       .mr_an_complete (mr_an_complete),\r
+       .mr_page_rx (mr_page_rx),\r
+       .mr_lp_adv_ability (mr_lp_adv_ability)\r
+       );\r
+\r
+\r
+\r
+// (G)MII Rate Resolution for SGMII IP Core\r
+rate_resolution   rate_resolution (\r
+       .gbe_mode (gbe_mode),\r
+       .sgmii_mode (sgmii_mode),\r
+       .an_enable (mr_an_enable),\r
+       .advertised_rate (mr_adv_ability[11:10]),\r
+       .link_partner_rate (mr_lp_adv_ability[11:10]),\r
+       .non_an_rate (non_an_rate),\r
+\r
+       .operational_rate (operational_rate)\r
+);\r
+\r
+\r
+\r
+\r
+\r
+// Bidirectional Assignments\r
+assign mdio = mdout_en ? mdout : 1'bz; // MDIO Output\r
+assign mdin = mdio;                   // MDIO Input\r
+\r
+endmodule\r
+\r