module BUFHCE #(
  `ifdef XIL_TIMING //Simprim 
  parameter LOC = "UNPLACED",
  `endif
  parameter CE_TYPE = "SYNC",
  parameter integer INIT_OUT = 0,
  parameter [0:0] IS_CE_INVERTED = 1'b0
)(
  output O,

  input CE,
  input I
);

  `ifdef XIL_TIMING //Simprim 
  reg notifier;
  `endif
  wire del_I, delCE;
  wire  NCE, o_bufg_o, o_bufg1_o;
  reg CE_TYPE_BINARY;
  reg INIT_OUT_BINARY;
  reg IS_CE_INVERTED_BIN = IS_CE_INVERTED;

  initial begin
    case (CE_TYPE)
      "SYNC" : CE_TYPE_BINARY = 1'b0;
      "ASYNC" : CE_TYPE_BINARY = 1'b1;
      default : begin
        $display("Attribute Syntax Error : The Attribute CE_TYPE on BUFHCE instance %m is set to %s.  Legal values for this attribute are SYNC, or ASYNC.", CE_TYPE);
        #1 $finish;
      end
    endcase

    if ((INIT_OUT >= 0) && (INIT_OUT <= 1))
      INIT_OUT_BINARY = INIT_OUT;
    else begin
      $display("Attribute Syntax Error : The Attribute INIT_OUT on BUFHCE instance %m is set to %d.  Legal values for this attribute are  0 to 1.", INIT_OUT);
      #1 $finish;
    end

  end

    
    BUFGCTRL bufgctrl0_inst (.O(o_bufg_o),
			     .CE0(~NCE),
			     .CE1(NCE),
			     .I0(del_I),
			     .I1(1'b0), 
			     .IGNORE0(CE_TYPE_BINARY), 
			     .IGNORE1(1'b0), 
			     .S0(1'b1), 
			     .S1(1'b1));
    
    defparam bufgctrl0_inst.INIT_OUT = 1'b0;
    defparam bufgctrl0_inst.PRESELECT_I0 = "TRUE";
    defparam bufgctrl0_inst.PRESELECT_I1 = "FALSE";
                               
                                       
    INV I1 (.I(delCE ^ IS_CE_INVERTED_BIN),
            .O(NCE));

    
    BUFGCTRL bufgctrl1_inst (.O(o_bufg1_o), 
			     .CE0(~NCE), 
			     .CE1(NCE), 
			     .I0(del_I), 
			     .I1(1'b1), 
			     .IGNORE0(CE_TYPE_BINARY), 
			     .IGNORE1(1'b0), 
			     .S0(1'b1), 
			     .S1(1'b1));
    
    defparam bufgctrl1_inst.INIT_OUT = 1'b0;
    defparam bufgctrl1_inst.PRESELECT_I0 = "TRUE";
    defparam bufgctrl1_inst.PRESELECT_I1 = "FALSE";

    
    assign O = (INIT_OUT == 1) ? o_bufg1_o : o_bufg_o;

    
`ifndef XIL_TIMING
    
    assign del_I = I;
    assign delCE = CE;
    
`endif

    
    specify

	(I => O) = (0:0:0, 0:0:0);
      
`ifdef XIL_TIMING

	$period (posedge I, 0:0:0, notifier);
	$setuphold (negedge I, negedge CE, 0:0:0, 0:0:0, notifier,,, del_I, delCE);
	$setuphold (negedge I, posedge CE, 0:0:0, 0:0:0, notifier,,, del_I, delCE);
	$setuphold (posedge I, negedge CE, 0:0:0, 0:0:0, notifier,,, del_I, delCE);
	$setuphold (posedge I, posedge CE, 0:0:0, 0:0:0, notifier,,, del_I, delCE);

`endif

	specparam PATHPULSE$ = 0;
	
    endspecify

    
endmodule