///******************************************************************************
//
//    File Name    : receive_buffer_top

//    Description  : This module is the top module for the receive buffer

// Targeted device : Family           Die          Package
//                   IGLOO2           M2S010T      484 FBGA
// Author          : Solutions Team
//                              --RK
//
// COPYRIGHT 2013 BY MICROSEMI
// THE INFORMATION CONTAINED IN THIS DOCUMENT IS SUBJECT TO LICENSING RESTRICTIONS 
// FROM ACTEL CORP.  IF YOU ARE NOT IN POSSESSION OF WRITTEN AUTHORIZATION FROM 
// ACTEL FOR USE OF THIS FILE, THEN THE FILE SHOULD BE IMMEDIATELY DESTROYED AND 
// NO BACK-UP OF THE FILE SHOULD BE MADE. 
// 

//******************************************************************************/

`timescale 1 ns/100 ps

//******************************************************************************
//**************************** Module Declaration ******************************
//******************************************************************************
module receive_buffer_top(
    CLEARIN_i                        ,
    ERR_CNTR_255_i                   ,
    RX_CLKIN_i                       ,
    RX_DATAIN_i                      ,
    RX_RESETN_i                      ,
    RX_VALIN_i                       ,
    RX_READY_i                       ,
    CLEAR_ERRCNTR_o                  ,
    RX_DATAOUT_o                     ,
    RX_VALOUT_o                      ,
    RB_LOCK_o
   )                                 ;

input         CLEARIN_i              ;
input         ERR_CNTR_255_i         ;
input         RX_CLKIN_i             ;
input  [9:0]  RX_DATAIN_i            ;
input         RX_RESETN_i            ;
input         RX_VALIN_i             ;
input         RX_READY_i             ;

output        CLEAR_ERRCNTR_o        ;
output [29:0] RX_DATAOUT_o           ;
output        RX_VALOUT_o            ;
output        RB_LOCK_o              ;

wire          CLEAR_ERRCNTR_o_net_0  ;
wire          CLEARIN_i;
wire          DATA_ALIGNER_v1_0_LOCK_GEN_o;
wire          ERR_CNTR_255_i         ;
wire          receive_control_0_START_LOCK_o;
wire          RX_CLKIN_i             ;
wire [9:0]    RX_DATAIN_i            ;
wire [29:0]   RX_DATAOUT_o_net_0     ;
wire          RX_RESETN_i            ;
wire          RX_VALIN_i             ;
wire          RX_VALOUT_o_net_0      ;
wire          CLEAR_ERRCNTR_o_net_1  ;
wire          RX_VALOUT_o_net_1      ;
wire [29:0] RX_DATAOUT_o_net_1       ;

//******************************************************************************
//*************************** Concurrent Assignment ****************************
//******************************************************************************
assign CLEAR_ERRCNTR_o_net_1 = CLEAR_ERRCNTR_o_net_0;
assign CLEAR_ERRCNTR_o       = CLEAR_ERRCNTR_o_net_1;
assign RX_VALOUT_o_net_1     = RX_VALOUT_o_net_0;
assign RX_VALOUT_o           = RX_VALOUT_o_net_1;
assign RX_DATAOUT_o_net_1    = RX_DATAOUT_o_net_0;
assign RX_DATAOUT_o[29:0]    = RX_DATAOUT_o_net_1;
assign RB_LOCK_o             = DATA_ALIGNER_v1_0_LOCK_GEN_o;

//******************************************************************************
//**************************** Component Instances *****************************
//******************************************************************************

rx_data_aligner rx_data_aligner_0(
        .RX_CLKIN_i   ( RX_CLKIN_i ),
        .RX_RESETN_i  ( RX_RESETN_i ),
        .RX_DATAIN_i  (RX_DATAIN_i),
        .RX_VALIN_i   ( RX_VALIN_i ),
        .START_LOCK_i ( receive_control_0_START_LOCK_o ),  
        .RX_READY_i(RX_READY_i),      

        .RX_DATAOUT_o ( RX_DATAOUT_o_net_0 ),
        .RX_VALOUT_o  ( RX_VALOUT_o_net_0 ),
        .LOCK_GEN_o   ( DATA_ALIGNER_v1_0_LOCK_GEN_o )
        );

receive_control receive_control_0(
        .RX_CLKIN_i      ( RX_CLKIN_i ),
        .RX_RESETN_i     ( RX_RESETN_i ),
        .RX_VALIN_i      ( RX_VALIN_i ),
        .ERR_CNTR_255_i  ( ERR_CNTR_255_i ),
        .CLEARIN_i       ( CLEARIN_i ),
        .LOCK_GENIN_i    ( DATA_ALIGNER_v1_0_LOCK_GEN_o ),

        .START_LOCK_o    ( receive_control_0_START_LOCK_o ),
        .CLEAR_ERRCNTR_o ( CLEAR_ERRCNTR_o_net_0 ) 
        );


endmodule