module one_gig_eth_pcs_pma_support
   (
      // Transceiver Interface
      //----------------------


      input        gtrefclk,              // gtrefclk routed through an IBUFG.
      input        gtrefclk_bufg,         // gtrefclk routed through a BUFG for driving logic.
      output       txp,                   // Differential +ve of serial transmission from PMA to PMD.
      output       txn,                   // Differential -ve of serial transmission from PMA to PMD.
      input        rxp,                   // Differential +ve for serial reception from PMD to PMA.
      input        rxn,                   // Differential -ve for serial reception from PMD to PMA.
      output       userclk_out,
      output       userclk2_out,
      output       rxuserclk_out,
      output       rxuserclk2_out,
      input        independent_clock_bufg,    // Freerun Independent clock,
      output       pma_reset_out,             // transceiver PMA reset signal
      output       mmcm_locked_out,           // MMCM Locked
      output       resetdone,
      // GMII Interface
      //---------------
      input [7:0]  gmii_txd,              // Transmit data from client MAC.
      input        gmii_tx_en,            // Transmit control signal from client MAC.
      input        gmii_tx_er,            // Transmit control signal from client MAC.
      output [7:0] gmii_rxd,              // Received Data to client MAC.
      output       gmii_rx_dv,            // Received control signal to client MAC.
      output       gmii_rx_er,            // Received control signal to client MAC.
      output       gmii_isolate,          // Tristate control to electrically isolate GMII.

      // Management: MDIO Interface
      //---------------------------

      input        mdc,                   // Management Data Clock
      input        mdio_i,                // Management Data In
      output       mdio_o,                // Management Data Out
      output       mdio_t,                // Management Data Tristate
      input [4:0]  phyaddr,               // MDIO address
      input [4:0]  configuration_vector,  // Alternative to MDIO interface.
      input        configuration_valid,   // Validation signal for Config vector

      // General IO's
      //-------------
      output [15:0] status_vector,         // Core status.
      input        reset,                 // Asynchronous reset for entire core.

      input        signal_detect,          // Input from PMD to indicate presence of optical input.
      input        gt0_qplloutclk_in,
      input        gt0_qplloutrefclk_in



   );


   //---------------------------------------------------------------------------
   // Internal signals used in this block level wrapper.
   //---------------------------------------------------------------------------

   // Core <=> Transceiver interconnect
   wire         cplllock;                // reset done indication from transceiver
   wire         mmcm_reset;               // Reset to MMCM based on resetdone
   wire         mmcm_locked;              // Signal indicating that MMCM has locked
   wire         pma_reset;                // Reset synchronized to system clock
   wire         txoutclk;                 // txoutclk from GT transceiver (62.5MHz)
   wire         rxoutclk;                 // txoutclk from GT transceiver (62.5MHz)
   wire         userclk;
   wire         userclk2;
   wire         rxuserclk;
   wire         rxuserclk2;

      // GT Interface
      //-------------
   //wire                gt0_qplloutclk;
   //wire                gt0_qplloutrefclk;

one_gig_eth_pcs_pma
pcs_pma_i
   (

      // Transceiver Interface
      //----------------------

      .gtrefclk (gtrefclk),              // Very high quality clock for GT transceiver.
      .gtrefclk_bufg (gtrefclk_bufg),
      .txp (txp),                   // Differential +ve of serial transmission from PMA to PMD.
      .txn (txn),                   // Differential -ve of serial transmission from PMA to PMD.
      .rxp (rxp),                   // Differential +ve for serial reception from PMD to PMA.
      .rxn (rxn),                   // Differential -ve for serial reception from PMD to PMA.

      .txoutclk                             (txoutclk),
      .rxoutclk                             (rxoutclk),
      .resetdone                            (resetdone),
      .cplllock                             (cplllock),
      .mmcm_reset                           (mmcm_reset),
      .userclk                              (userclk),
      .userclk2                             (userclk2),
      .rxuserclk                              (rxuserclk),
      .rxuserclk2                             (rxuserclk2),
      .independent_clock_bufg        (independent_clock_bufg),
      .pma_reset                            (pma_reset),
      .mmcm_locked                          (mmcm_locked),

      .gmii_txd                      (gmii_txd),
      .gmii_tx_en                    (gmii_tx_en),
      .gmii_tx_er                    (gmii_tx_er),
      .gmii_rxd                      (gmii_rxd),
      .gmii_rx_dv                    (gmii_rx_dv),
      .gmii_rx_er                    (gmii_rx_er),
      .gmii_isolate                  (gmii_isolate),

      // Management: MDIO Interface
      //---------------------------

      .mdc                           (mdc),
      .mdio_i                        (mdio_i),
      .mdio_o                        (mdio_o),
      .mdio_t                        (mdio_t),
      .phyaddr                       (phyaddr),
      .configuration_vector          (configuration_vector),
      .configuration_valid           (configuration_valid),


      // General IO's
      //-------------
      .status_vector          (status_vector),         // Core status.
      .reset                  (pma_reset),                 // Asynchronous reset for entire core.

      .signal_detect           (signal_detect) ,         // Input from PMD to indicate presence of optical input.
      .gt0_qplloutclk_in       (gt0_qplloutclk_in),
      .gt0_qplloutrefclk_in    (gt0_qplloutrefclk_in)
   );


  //----------------------------------------------------------------------------
  // Instantiate the clocking module.
  //----------------------------------------------------------------------------
   one_gig_eth_pcs_pma_clocking core_clocking_i
   (
      .txoutclk                  (txoutclk),
      .rxoutclk                  (rxoutclk),
      .mmcm_reset                (mmcm_reset),
      .mmcm_locked               (mmcm_locked),
      .userclk                   (userclk),
      .userclk2                  (userclk2),
      .rxuserclk                 (rxuserclk),
      .rxuserclk2                (rxuserclk2)
   );

assign gtrefclk_out   = gtrefclk;
assign gtrefclk_bufg_out   = gtrefclk_bufg;
assign userclk_out    = userclk;
assign userclk2_out   = userclk2;
assign rxuserclk_out  = rxuserclk;
assign rxuserclk2_out = rxuserclk2;


   //---------------------------------------------------------------------------
   // Transceiver PMA reset circuitry
   //---------------------------------------------------------------------------
   one_gig_eth_pcs_pma_resets core_resets_i
   (
     .reset                     (reset),
     .independent_clock_bufg    (independent_clock_bufg),

     .pma_reset                 (pma_reset)
   );

assign pma_reset_out = pma_reset;


 assign   mmcm_locked_out              = mmcm_locked;

endmodule // one_gig_eth_pcs_pma_support