1 == 0 || C_PLL0_RX_EXTERNAL_CLK_TO_DATA == 2) ? 1'b0 : !rst_seq_done ? bsc_en_vtc :  n1_en_vtc_in;
   assign n2_en_vtc          = (C_EN_BSC2 == 0 || C_PLL0_RX_EXTERNAL_CLK_TO_DATA == 2) ? 1'b0 : !rst_seq_done ? bsc_en_vtc :  n2_en_vtc_in;
   assign n3_en_vtc          = (C_EN_BSC3 == 0 || C_PLL0_RX_EXTERNAL_CLK_TO_DATA == 2) ? 1'b0 : !rst_seq_done ? bsc_en_vtc :  n3_en_vtc_in;
   assign n4_en_vtc          = (C_EN_BSC4 == 0 || C_PLL0_RX_EXTERNAL_CLK_TO_DATA == 2) ? 1'b0 : !rst_seq_done ? bsc_en_vtc :  n4_en_vtc_in;
   assign n5_en_vtc          = (C_EN_BSC5 == 0 || C_PLL0_RX_EXTERNAL_CLK_TO_DATA == 2) ? 1'b0 : !rst_seq_done ? bsc_en_vtc :  n5_en_vtc_in;
   assign n6_en_vtc          = (C_EN_BSC6 == 0 || C_PLL0_RX_EXTERNAL_CLK_TO_DATA == 2) ? 1'b0 : !rst_seq_done ? bsc_en_vtc :  n6_en_vtc_in;
   assign n7_en_vtc          = (C_EN_BSC7 == 0 || C_PLL0_RX_EXTERNAL_CLK_TO_DATA == 2) ? 1'b0 : !rst_seq_done ? bsc_en_vtc :  n7_en_vtc_in;

   assign n0_tbyte           = (C_EN_BSC0 == 1) ? n0_tbyte_d : 4'b0000;
   assign n1_tbyte           = (C_EN_BSC1 == 1) ? n1_tbyte_d : 4'b0000;
   assign n2_tbyte           = (C_EN_BSC2 == 1) ? n2_tbyte_d : 4'b0000;
   assign n3_tbyte           = (C_EN_BSC3 == 1) ? n3_tbyte_d : 4'b0000;
   assign n4_tbyte           = (C_EN_BSC4 == 1) ? n4_tbyte_d : 4'b0000;
   assign n5_tbyte           = (C_EN_BSC5 == 1) ? n5_tbyte_d : 4'b0000;
   assign n6_tbyte           = (C_EN_BSC6 == 1) ? n6_tbyte_d : 4'b0000;
   assign n7_tbyte           = (C_EN_BSC7 == 1) ? n7_tbyte_d : 4'b0000;

generate
  if(C_EN_MULTI_INTF == 1'b1 ) begin
     always @(posedge app_clk)
     begin
        if( C_TX_IN_NIB0 == 1'b1 && !rst_seq_done_app_clk_sync)
          n0_tbyte_d  <= 4'b0000;
        else
         n0_tbyte_d   <=  n0_tbyte_in;
     end //always
  end
  else begin
  if(C_NIB0_PLL1 == 1'b0) begin : GEN_NIB0_TBYTE
     always @(posedge pll0_clkout0_int)
     begin
        if( C_TX_IN_NIB0 == 1'b1 && !rst_seq_done_pll0_sync)
          n0_tbyte_d  <= 4'b0000;
        else if( C_TX_IN_NIB0 == 1'b1 && rst_seq_done_pll0_sync && C_EN_TX_TRI== 1'b1 && C_DATA_TRI == 0 )
          n0_tbyte_d  <= n0_tbyte_in;
        else if( C_TX_IN_NIB0 == 1'b1 && rst_seq_done_pll0_sync )
          n0_tbyte_d  <= 4'b1111;
        else
         n0_tbyte_d   <=  n0_tbyte_in;
     end //always
  end
  else begin
     always @(posedge pll1_clkout0_int)
     begin
        if( C_TX_IN_NIB0 == 1'b1 && !rst_seq_done_pll0_sync)
          n0_tbyte_d  <= 4'b0000;
        else if( C_TX_IN_NIB0 == 1'b1 && rst_seq_done_pll0_sync && C_EN_TX_TRI== 1'b1 && C_DATA_TRI == 0 )
          n0_tbyte_d  <= n0_tbyte_in;
        else if( C_TX_IN_NIB0 == 1'b1 && rst_seq_done_pll0_sync )
          n0_tbyte_d  <= 4'b1111;
        else
         n0_tbyte_d   <=  n0_tbyte_in;
     end //always
  end
  end
endgenerate

generate
  if(C_EN_MULTI_INTF == 1'b1 ) begin
     always @(posedge app_clk)
     begin
        if( C_TX_IN_NIB1 == 1'b1 && !rst_seq_done_app_clk_sync)
          n1_tbyte_d  <= 4'b0000;
        else
         n1_tbyte_d   <=  n1_tbyte_in;
     end //always
  end
  else begin
  if(C_NIB1_PLL1 == 1'b0) begin : GEN_NIB1_TBYTE
     always @(posedge pll0_clkout0_int)
     begin
        if( C_TX_IN_NIB1 == 1'b1 && !rst_seq_done_pll0_sync)
          n1_tbyte_d  <= 4'b0000;
        else if( C_TX_IN_NIB1 == 1'b1 && rst_seq_done_pll0_sync && C_EN_TX_TRI== 1'b1 && C_DATA_TRI == 0 )
          n1_tbyte_d  <= n1_tbyte_in;
        else if( C_TX_IN_NIB1 == 1'b1 && rst_seq_done_pll0_sync )
          n1_tbyte_d  <= 4'b1111;
        else
         n1_tbyte_d   <=  n1_tbyte_in;
     end //always
  end
  else begin
     always @(posedge pll1_clkout0_int)
     begin
        if( C_TX_IN_NIB1 == 1'b1 && !rst_seq_done_pll0_sync)
          n1_tbyte_d  <= 4'b0000;
        else if( C_TX_IN_NIB1 == 1'b1 && rst_seq_done_pll0_sync && C_EN_TX_TRI== 1'b1 && C_DATA_TRI == 0 )
          n1_tbyte_d  <= n1_tbyte_in;
        else if( C_TX_IN_NIB1 == 1'b1 && rst_seq_done_pll0_sync )
          n1_tbyte_d  <= 4'b1111;
        else
         n1_tbyte_d   <=  n1_tbyte_in;
     end //always
  end
 end
endgenerate


generate
  if(C_EN_MULTI_INTF == 1'b1 ) begin
     always @(posedge app_clk)
     begin
        if( C_TX_IN_NIB2 == 1'b1 && !rst_seq_done_app_clk_sync)
          n2_tbyte_d  <= 4'b0000;
        else
         n2_tbyte_d   <=  n2_tbyte_in;
     end //always
  end
  else begin

  if(C_NIB2_PLL1 == 1'b0) begin : GEN_NIB2_TBYTE
     always @(posedge pll0_clkout0_int)
     begin
        if( C_TX_IN_NIB2 == 1'b1 && !rst_seq_done_pll0_sync)
          n2_tbyte_d  <= 4'b0000;
        else if( C_TX_IN_NIB2 == 1'b1 && rst_seq_done_pll0_sync && C_EN_TX_TRI== 1'b1 && C_DATA_TRI == 0 )
          n2_tbyte_d  <= n2_tbyte_in;
        else if( C_TX_IN_NIB2 == 1'b1 && rst_seq_done_pll0_sync )
          n2_tbyte_d  <= 4'b1111;
        else
         n2_tbyte_d   <=  n2_tbyte_in;
     end //always
  end
  else begin
     always @(posedge pll1_clkout0_int)
     begin
        if( C_TX_IN_NIB2 == 1'b1 && !rst_seq_done_pll0_sync)
          n2_tbyte_d  <= 4'b0000;
        else if( C_TX_IN_NIB2 == 1'b1 && rst_seq_done_pll0_sync && C_EN_TX_TRI== 1'b1 && C_DATA_TRI == 0 )
          n2_tbyte_d  <= n2_tbyte_in;
        else if( C_TX_IN_NIB2 == 1'b1 && rst_seq_done_pll0_sync )
          n2_tbyte_d  <= 4'b1111;
        else
         n2_tbyte_d   <=  n2_tbyte_in;
     end //always
  end
end
endgenerate

generate
  if(C_EN_MULTI_INTF == 1'b1 ) begin
     always @(posedge app_clk)
     begin
        if( C_TX_IN_NIB3 == 1'b1 && !rst_seq_done_app_clk_sync)
          n3_tbyte_d  <= 4'b0000;
        else
         n3_tbyte_d   <=  n3_tbyte_in;
     end //always
  end
  else begin

  if(C_NIB3_PLL1 == 1'b0) begin : GEN_NIB3_TBYTE
     always @(posedge pll0_clkout0_int)
     begin
        if( C_TX_IN_NIB3 == 1'b1 && !rst_seq_done_pll0_sync)
          n3_tbyte_d  <= 4'b0000;
        else if( C_TX_IN_NIB3 == 1'b1 && rst_seq_done_pll0_sync && C_EN_TX_TRI== 1'b1 && C_DATA_TRI == 0 )
          n3_tbyte_d  <= n3_tbyte_in;
        else if( C_TX_IN_NIB3 == 1'b1 && rst_seq_done_pll0_sync )
          n3_tbyte_d  <= 4'b1111;
        else
         n3_tbyte_d   <=  n3_tbyte_in;
     end //always
  end
  else begin
     always @(posedge pll1_clkout0_int)
     begin
        if( C_TX_IN_NIB3 == 1'b1 && !rst_seq_done_pll0_sync)
          n3_tbyte_d  <= 4'b0000;
        else if( C_TX_IN_NIB3 == 1'b1 && rst_seq_done_pll0_sync && C_EN_TX_TRI== 1'b1 && C_DATA_TRI == 0 )
          n3_tbyte_d  <= n3_tbyte_in;
        else if( C_TX_IN_NIB3 == 1'b1 && rst_seq_done_pll0_sync )
          n3_tbyte_d  <= 4'b1111;
        else
         n3_tbyte_d   <=  n3_tbyte_in;
     end //always
  end
end
endgenerate


generate
  if(C_EN_MULTI_INTF == 1'b1 ) begin
     always @(posedge app_clk)
     begin
        if( C_TX_IN_NIB4 == 1'b1 && !rst_seq_done_app_clk_sync)
          n4_tbyte_d  <= 4'b0000;
        else
         n4_tbyte_d   <=  n4_tbyte_in;
     end //always
  end
  else begin

  if(C_NIB4_PLL1 == 1'b0) begin : GEN_NIB4_TBYTE
     always @(posedge pll0_clkout0_int)
     begin
        if( C_TX_IN_NIB4 == 1'b1 && !rst_seq_done_pll0_sync)
          n4_tbyte_d  <= 4'b0000;
        else if( C_TX_IN_NIB4 == 1'b1 && rst_seq_done_pll0_sync && C_EN_TX_TRI== 1'b1 && C_DATA_TRI == 0 )
          n4_tbyte_d  <= n4_tbyte_in;
        else if( C_TX_IN_NIB4 == 1'b1 && rst_seq_done_pll0_sync )
          n4_tbyte_d  <= 4'b1111;
        else
         n4_tbyte_d   <=  n4_tbyte_in;
     end //always
  end
  else begin
     always @(posedge pll1_clkout0_int)
     begin
        if( C_TX_IN_NIB4 == 1'b1 && !rst_seq_done_pll0_sync)
          n4_tbyte_d  <= 4'b0000;
        else if( C_TX_IN_NIB4 == 1'b1 && rst_seq_done_pll0_sync && C_EN_TX_TRI== 1'b1 && C_DATA_TRI == 0 )
          n4_tbyte_d  <= n4_tbyte_in;
        else if( C_TX_IN_NIB4 == 1'b1 && rst_seq_done_pll0_sync )
          n4_tbyte_d  <= 4'b1111;
        else
         n4_tbyte_d   <=  n4_tbyte_in;
     end //always
  end
end
endgenerate


generate
  if(C_EN_MULTI_INTF == 1'b1 ) begin
     always @(posedge app_clk)
     begin
        if( C_TX_IN_NIB5 == 1'b1 && !rst_seq_done_app_clk_sync)
          n5_tbyte_d  <= 4'b0000;
        else
         n5_tbyte_d   <=  n5_tbyte_in;
     end //always
  end
  else begin

  if(C_NIB5_PLL1 == 1'b0) begin : GEN_NIB5_TBYTE
     always @(posedge pll0_clkout0_int)
     begin
       if( C_TX_IN_NIB5 == 1'b1 && !rst_seq_done_pll0_sync)
          n5_tbyte_d  <= 4'b0000;
        else if( C_TX_IN_NIB5 == 1'b1 && rst_seq_done_pll0_sync && C_EN_TX_TRI== 1'b1 && C_DATA_TRI == 0 )
          n5_tbyte_d  <= n5_tbyte_in;
        else if( C_TX_IN_NIB5 == 1'b1 && rst_seq_done_pll0_sync )
          n5_tbyte_d  <= 4'b1111;
        else
         n5_tbyte_d   <=  n5_tbyte_in;
     end //always
  end
  else begin
     always @(posedge pll1_clkout0_int)
     begin
       if( C_TX_IN_NIB5 == 1'b1 && !rst_seq_done_pll0_sync)
          n5_tbyte_d  <= 4'b0000;
        else if( C_TX_IN_NIB5 == 1'b1 && rst_seq_done_pll0_sync && C_EN_TX_TRI== 1'b1 && C_DATA_TRI == 0 )
          n5_tbyte_d  <= n5_tbyte_in;
        else if( C_TX_IN_NIB5 == 1'b1 && rst_seq_done_pll0_sync )
          n5_tbyte_d  <= 4'b1111;
        else
         n5_tbyte_d   <=  n5_tbyte_in;
     end //always
  end
end
endgenerate

generate
  if(C_EN_MULTI_INTF == 1'b1 ) begin
     always @(posedge app_clk)
     begin
        if( C_TX_IN_NIB6 == 1'b1 && !rst_seq_done_app_clk_sync)
          n6_tbyte_d  <= 4'b0000;
        else
         n6_tbyte_d   <=  n6_tbyte_in;
     end //always
  end
  else begin

  if(C_NIB6_PLL1 == 1'b0) begin : GEN_NIB6_TBYTE
     always @(posedge pll0_clkout0_int)
     begin
       if( C_TX_IN_NIB6 == 1'b1 && !rst_seq_done_pll0_sync)
          n6_tbyte_d  <= 4'b0000;
        else if( C_TX_IN_NIB6 == 1'b1 && rst_seq_done_pll0_sync && C_EN_TX_TRI== 1'b1 && C_DATA_TRI == 0 )
          n6_tbyte_d  <= n6_tbyte_in;
        else if( C_TX_IN_NIB6 == 1'b1 && rst_seq_done_pll0_sync )
          n6_tbyte_d  <= 4'b1111;
        else
         n6_tbyte_d   <=  n6_tbyte_in;
     end //always
  end
  else begin
     always @(posedge pll1_clkout0_int)
     begin
       if( C_TX_IN_NIB6 == 1'b1 && !rst_seq_done_pll0_sync)
          n6_tbyte_d  <= 4'b0000;
        else if( C_TX_IN_NIB6 == 1'b1 && rst_seq_done_pll0_sync && C_EN_TX_TRI== 1'b1 && C_DATA_TRI == 0 )
          n6_tbyte_d  <= n6_tbyte_in;
        else if( C_TX_IN_NIB6 == 1'b1 && rst_seq_done_pll0_sync )
          n6_tbyte_d  <= 4'b1111;
        else
         n6_tbyte_d   <=  n6_tbyte_in;
     end //always
  end
end
endgenerate

generate
  if(C_EN_MULTI_INTF == 1'b1 ) begin
     always @(posedge app_clk)
     begin
        if( C_TX_IN_NIB0 == 1'b1 && !rst_seq_done_app_clk_sync)
          n7_tbyte_d  <= 4'b0000;
        else
         n7_tbyte_d   <=  n7_tbyte_in;
     end //always
  end
  else begin

  if(C_NIB7_PLL1 == 1'b0) begin : GEN_NIB7_TBYTE
     always @(posedge pll0_clkout0_int)
     begin
       if( C_TX_IN_NIB7 == 1'b1 && !rst_seq_done_pll0_sync)
          n7_tbyte_d  <= 4'b0000;
        else if( C_TX_IN_NIB7 == 1'b1 && rst_seq_done_pll0_sync && C_EN_TX_TRI== 1'b1 && C_DATA_TRI == 0 )
          n7_tbyte_d  <= n7_tbyte_in;
        else if( C_TX_IN_NIB7 == 1'b1 && rst_seq_done_pll0_sync )
          n7_tbyte_d  <= 4'b1111;
        else
         n7_tbyte_d   <=  n7_tbyte_in;
     end //always
  end
  else begin
     always @(posedge pll1_clkout0_int)
     begin
       if( C_TX_IN_NIB7 == 1'b1 && !rst_seq_done_pll0_sync)
          n7_tbyte_d  <= 4'b0000;
        else if( C_TX_IN_NIB7 == 1'b1 && rst_seq_done_pll0_sync && C_EN_TX_TRI== 1'b1 && C_DATA_TRI == 0 )
          n7_tbyte_d  <= n7_tbyte_in;
        else if( C_TX_IN_NIB7 == 1'b1 && rst_seq_done_pll0_sync )
          n7_tbyte_d  <= 4'b1111;
        else
         n7_tbyte_d   <=  n7_tbyte_in;
     end //always
  end
end
endgenerate

 
   assign n0_dly_rdy_out     = n0_dly_rdy;
   assign n1_dly_rdy_out     = n1_dly_rdy;
   assign n2_dly_rdy_out     = n2_dly_rdy;
   assign n3_dly_rdy_out     = n3_dly_rdy;
   assign n4_dly_rdy_out     = n4_dly_rdy;
   assign n5_dly_rdy_out     = n5_dly_rdy;
   assign n6_dly_rdy_out     = n6_dly_rdy;
   assign n7_dly_rdy_out     = n7_dly_rdy;

   assign n0_vtc_rdy_out     = n0_vtc_rdy;
   assign n1_vtc_rdy_out     = n1_vtc_rdy;
   assign n2_vtc_rdy_out     = n2_vtc_rdy;
   assign n3_vtc_rdy_out     = n3_vtc_rdy;
   assign n4_vtc_rdy_out     = n4_vtc_rdy;
   assign n5_vtc_rdy_out     = n5_vtc_rdy;
   assign n6_vtc_rdy_out     = n6_vtc_rdy;
   assign n7_vtc_rdy_out     = n7_vtc_rdy;

   assign n0_dly_rdy_to_rst  = (C_EN_BSC0 ==1) ? n0_dly_rdy : 1'b1;
   assign n1_dly_rdy_to_rst  = (C_EN_BSC1 ==1) ? n1_dly_rdy : 1'b1;
   assign n2_dly_rdy_to_rst  = (C_EN_BSC2 ==1) ? n2_dly_rdy : 1'b1;
   assign n3_dly_rdy_to_rst  = (C_EN_BSC3 ==1) ? n3_dly_rdy : 1'b1;
   assign n4_dly_rdy_to_rst  = (C_EN_BSC4 ==1) ? n4_dly_rdy : 1'b1;
   assign n5_dly_rdy_to_rst  = (C_EN_BSC5 ==1) ? n5_dly_rdy : 1'b1;
   assign n6_dly_rdy_to_rst  = (C_EN_BSC6 ==1) ? n6_dly_rdy : 1'b1;
   assign n7_dly_rdy_to_rst  = (C_EN_BSC7 ==1) ? n7_dly_rdy : 1'b1;

   assign all_bsc_dly_rdy_in = &{n7_dly_rdy_to_rst,n6_dly_rdy_to_rst,n5_dly_rdy_to_rst,n4_dly_rdy_to_rst,n3_dly_rdy_to_rst,n2_dly_rdy_to_rst,n1_dly_rdy_to_rst,n0_dly_rdy_to_rst};

   assign n0_vtc_rdy_to_rst  = (C_EN_BSC0 ==1) ? n0_vtc_rdy : 1'b1;
   assign n1_vtc_rdy_to_rst  = (C_EN_BSC1 ==1) ? n1_vtc_rdy : 1'b1;
   assign n2_vtc_rdy_to_rst  = (C_EN_BSC2 ==1) ? n2_vtc_rdy : 1'b1;
   assign n3_vtc_rdy_to_rst  = (C_EN_BSC3 ==1) ? n3_vtc_rdy : 1'b1;
   assign n4_vtc_rdy_to_rst  = (C_EN_BSC4 ==1) ? n4_vtc_rdy : 1'b1;
   assign n5_vtc_rdy_to_rst  = (C_EN_BSC5 ==1) ? n5_vtc_rdy : 1'b1;
   assign n6_vtc_rdy_to_rst  = (C_EN_BSC6 ==1) ? n6_vtc_rdy : 1'b1;
   assign n7_vtc_rdy_to_rst  = (C_EN_BSC7 ==1) ? n7_vtc_rdy : 1'b1;

   assign all_bsc_vtc_rdy_in = &{n7_vtc_rdy_to_rst,n6_vtc_rdy_to_rst,n5_vtc_rdy_to_rst,n4_vtc_rdy_to_rst,n3_vtc_rdy_to_rst,n2_vtc_rdy_to_rst,n1_vtc_rdy_to_rst,n0_vtc_rdy_to_rst};

<: if {$rx_dly_mode == "COUNT"} { :>
   assign core_rdy = ~rst_in;
<: } else { :>
   assign core_rdy = all_bsc_dly_rdy_in && all_bsc_vtc_rdy_in;
<: } :>

  generate 
  genvar bs;
    for (bs = 0; bs <= 51; bs=bs+1) 
    begin : CORE_RDY_GEN
      always @(posedge riu_clk)
      begin
        core_rdy_r[bs]               <= core_rdy;
      end
    end
  endgenerate


    high_speed_selectio_wiz_v3_3_1_sync_cell #(.C_SYNC_STAGE(2), .C_DW(1), .pTCQ(10)) 
    sync_cell_rst_seq_pll0_inst       (.src_data(rst_seq_done1), .dest_clk(pll0_clkout0_int), .dest_data(rst_seq_done_pll0_sync));

generate
if(USE_PLL1) begin : GEN_PLL1_RST_SEQ_DONE

    high_speed_selectio_wiz_v3_3_1_sync_cell #(.C_SYNC_STAGE(2), .C_DW(1), .pTCQ(10)) 
    sync_cell_rst_seq_pll1_inst       (.src_data(rst_seq_done2), .dest_clk(pll1_clkout0_int), .dest_data(rst_seq_done_pll1_sync));
end
endgenerate

generate
if(C_EN_MULTI_INTF == 1'b1) begin : GEN_APP_CLK_RST_SEQ_DONE

    assign intf_rdy          = rst_seq_done_app_clk_sync;

    high_speed_selectio_wiz_v3_3_1_sync_cell #(.C_SYNC_STAGE(2), .C_DW(1), .pTCQ(10)) 
    sync_cell_rst_seq_app_clk_inst       (.src_data(rst_seq_done3), .dest_clk(app_clk), .dest_data(rst_seq_done_app_clk_sync));
end
endgenerate

   // Generation of Data from IOBuffer to BITSLICE
   generate
      genvar i, j, k, m;

      for (i = 1; i < 12 ; i = i + 2) 
      begin : bg0
         assign data_to_bs_from_buf[i] = (C_DIFF_EN[i-1] == 1) && (C_ALL_RX_EN[i] == 1'b1) ? data_to_bs_n[i-1] : data_to_bs[i];
      end

      for (j = 14; j < 25 ; j = j + 2) 
      begin : bg1
         assign data_to_bs_from_buf[j] = (C_DIFF_EN[j-1] == 1) && (C_ALL_RX_EN[j] == 1'b1) ? data_to_bs_n[j-1] : data_to_bs[j];
      end

      for (k = 27; k < 38 ; k = k + 2) 
      begin : bg2
         assign data_to_bs_from_buf[k] = (C_DIFF_EN[k-1] == 1) && (C_ALL_RX_EN[k] == 1'b1) ? data_to_bs_n[k-1] : data_to_bs[k];
      end

      for (m = 40; m < 51 ; m = m + 2) 
      begin : bg3
         assign data_to_bs_from_buf[m] = (C_DIFF_EN[m-1] == 1) && (C_ALL_RX_EN[m] == 1'b1) ? data_to_bs_n[m-1]  : data_to_bs[m];
      end
   endgenerate



endmodule
