anchor.diff:              && retrycounter >= 'h8000);
           serdes_end.deq();
           let mc = maxcount;
  -        let cric = 2'b11;
  +        let inctemp = 0;
           let as = AEdge;
  -        retrycounter <= retrycounter - 1;
           if (edge_int != 0)
               begin
               data_init1 <= rotateBitsBy(ctrl_data, 10-1);
               data_init2 <= rotateBitsBy(ctrl_data, 10-2);
               edge_init <= edge_int;
  -            cric = 2'b00;
               as = AWait;
               end
           else if (maxcount[10] == 1)
  -            begin
  -            cric = 2'b00;
               as = AReset;
  -            end
           else
  +            begin
               maxcount <= maxcount - 1;
  -        serdes_start.enq(cric);
  +            inctemp = 1;
  +            end
  +        retrycounter <= retrycounter - 1;
           astate <= as;
  +        serdes_start.enq(inctemp);
       endrule
       rule afsmwait_rule if (bvi_resets_reg.read() != 0 && astate == AWait);
           serdes_end.deq();
  
positive.code:             as = AReset;
          else
              begin
              cric = 2'b11;
              maxcount <= maxcount - 1;
              end
          astate <= as;
          serdes_start.enq(cric);
      endrule
      rule afsm1stable_rule if (bvi_resets_reg.read() != 0 && astate == AFirst);
          serdes_end.deq();
          let as = astate;
          let mc = maxcount;
          let cric = 2'b11;
          if (gencounter >= 'h8000)
              begin
              windowcount <= windowcount + 1;
  
negative.code:             begin
              let gc = gencounter - 1;
              if (ctrl_data == data_init1)
                  inctemp = 0;
              else
                  begin
                  mc = mc - 1;
                  gc = 15;
                  as = ARotated;
                  end
              gencounter <= gc;
              end
          maxcount <= mc;
          astate <= as;
          serdes_start.enq(inctemp);
      endrule
      rule afsmsecond_rule if (bvi_resets_reg.read() != 0 && astate == ASecond);
          serdes_end.deq();
          let as = astate;
          let inctemp = 0;
          if (ctrl_data == data_init2)
              begin
              gencounter <= {7'b0, windowcount[9:1]} - 16'b10;
              as = AFound;
              end
          else if (maxcount[10] == 1)
              as = AReset;
          else
              begin
              windowcount <= windowcount + 1;
              inctemp = 1;
              maxcount <= maxcount - 1;
              end
          astate <= as;
          serdes_start.enq(inctemp);
      endrule
      rule afsmfound_rule if (bvi_resets_reg.read() != 0 && astate == AFound);
          serdes_end.deq();
  