anchor.diff:      Gearbox#(4, 1, Bit#(10)) dataGearbox <- mkNto1Gearbox(slow_clock, slow_reset, defaultClock, defaultReset); 
       Gearbox#(4, 1, Bit#(1))  syncGearbox <- mkNto1Gearbox(slow_clock, slow_reset, defaultClock, defaultReset); 
   
  -    Reg#(Bit#(1)) vsync_reg <- mkReg(0);
  -    Reg#(Bit#(1)) hsync_reg <- mkReg(0);
       Reg#(Bit#(1)) active_video_reg <- mkReg(0);
       Wire#(Bit#(1))  xsvi_framestart_old_wire <- mkDWire(0);
       Wire#(Bit#(10)) xsvi_video_data_wire <- mkDWire(0);
  -
  -    Reg#(Bit#(1))     framestart <- mkReg(0);
  +    Reg#(Bit#(1))  framestart_wire <- mkSyncReg(0, slow_clock, slow_reset, defaultClock);
  +
       Reg#(State)       hstate <- mkReg(Idle);
       Reg#(State)       vstate <- mkReg(Idle);
       Reg#(Bit#(16))    vsync_count <- mkReg(0);
       Reg#(Bit#(16))    hsync_count <- mkReg(0);
       Reg#(Bit#(32))    debugind_value <- mkReg(0);
  +    Reg#(Bit#(32))    diff <- mkReg(0);
  +    Reg#(Bit#(1))     framestart_reg <- mkReg(0, clocked_by slow_clock, reset_by slow_reset);
  +    Reg#(Bit#(1))     framestart_delay_reg <- mkReg(0, clocked_by slow_clock, reset_by slow_reset);
  +    Reg#(Bit#(1))     framestart_new <- mkReg(0);
       
       rule start_fsm if (xsvi_framestart_old_wire == 1);
           vsync_count <= 0;
  
positive.code: 
      interface ImageonSensorData in;
          method Action fsync(Bit#(1) v);
  	    xsvi_framestart_old_wire <= v;
  	endmethod
          method Bit#(1) active_video();
              return active_video_reg;
          endmethod
  
negative.code: 	    dataGearbox.deq;
  	    syncGearbox.deq;
              active_video_reg <= pack(hstate == Active && vstate == Active);
              framestart_new <= syncGearbox.first[0];
              let dval = diff;
              dval = {diff[28:0], framestart_wire, xsvi_framestart_old_wire, framestart_new};
              if (diff[8] == 1)
                  begin
                  debugind_value <= diff;
                  dval = 0;
                  end
              diff <= dval;
  	    return XsviData {
  		fsync: xsvi_framestart_old_wire, //framestart_new,
  		vsync: pack(vstate == Sync),
  		hsync: pack(hstate == Sync),
  		active_video: active_video_reg,
  