anchor.diff:          frame_delay <= fd;
           frame_run <= fr;
           output_framesync_reg <= fstemp;
  +    endrule
  +
  +    rule data_pipeline;
  +        raw_empty_reg <= serdes.raw_empty();
  +    endrule
  +
  +    rule calculate_framedata;
  +        if (raw_empty_reg == 0)
  +            begin
  +            let idv = imgdatavalid_reg;
  +            raw_data_delay_reg <= serdes.raw_data()[9:0];
  +            if (imgdatavalid_reg == 1)
  +                begin
  +                let dor = serdes.raw_data()[49:10];
  +                if (remapkernel_reg == 0)
  +                    begin
  +                    dor[39: 30] = serdes.raw_data()[19: 10];
  +                    dor[29: 20] = serdes.raw_data()[29: 20];
  +                    dor[19: 10] = serdes.raw_data()[39: 30];
  +                    dor[ 9:  0] = serdes.raw_data()[49: 40];
  +                    end
  +                remapkernel_reg <= ~ remapkernel_reg;
  +                if (raw_data_delay_reg == decoder_code_le_reg)
  +                    idv = 0;
  +                dataout_reg <= dor;
  +                end
  +            else if (raw_data_delay_reg == decoder_code_ls_reg)
  +                idv = 1;
  +            imgdatavalid_reg <= idv;
  +            end
  +        sframe_reg <= pack(raw_data_delay_reg == decoder_code_fs_reg && serdes.raw_data()[9:0] == 10'h0);
       endrule
   
       Reg#(Bit#(32)) diff <- mkReg(0);
  
positive.code:             fr = 1;
              fd = 0;
              end
          if (frame_run == 1 && frame_delay == syncgen_delay_reg )
              begin
              fr = 0;
              fstemp = 1;
  
negative.code:             dval = 0;
              end
          diff <= dval;
      endrule
  
      interface ImageonSensorControl control;
  