`define otp_testbits_open    otp[49]

initial begin
   #100_000;

   // Slew
   // ----------------------------------------------------------------
   vcore_vin_uvlo.VIN_SLEW  = 100;
   vcore_vin_uvlo.VOUT_SLEW = 100;
   
   vddi2c_detect = 1'b1;  
   sel_in_reg    = 1'b1;
   #100_000;


   $display("\n VIN plug @ 7V");
   vcore_vin_uvlo.vin_lvl(7000);   
 
   @(posedge vin_uvlo);
   $display("\n enter precharge");
   
   @(posedge en_clo_det);
   $display("\n CLO detection on going"); 
      
   @(posedge en_cp);
   $display("\n enter precharge");
    
   $display("\n// read testmode 0");
   i2c_test_mode_sns_fld = 0;
   i2c_read_fields(`TEST_REGISTER0,8'hf8);

   #200_000;
   $display("\n// enter testmode");
   force `otp_testbits_open = 1'b1;
   
   #100_000;       
   $display("\n// read testmode 1");
   i2c_test_mode_sns_fld = 1;
   i2c_read_fields(`TEST_REGISTER0,8'hf8);

   #100_000;       
   $display("\n// write in test register");
   check_digital_net_id("adc_az_dis",adc_az_dis,1'b0);

   i2c_tb_adc_az_dis_fld = 1'b1;
   i2c_write_fields(fnGetAddr("i2c_tb_adc_az_dis_fld"));   
   check_digital_net_id("adc_az_dis",adc_az_dis,1'b1);

   #200_000;
   $display("\n// exit testmode");
   release `otp_testbits_open;

   $display("\n// read testmode 0");
   i2c_test_mode_sns_fld = 0;
   i2c_read_fields(`TEST_REGISTER0,8'hf8);

   repeat (1) #1_000_000;
// ----------------------------------------------------------------

   // End
   // ----------------------------------------------------------------
   END_SIM;
   
end

