anchor.diff:          return idx == fromInteger(valueof(size) - 1) ? 0 : idx + 1;
       endfunction
   
  -    function indexT incrIndex(indexT idx, Integer incr);
  -        incr = incr % valueof(size); // incr <= size-1
  -        Integer remain = valueof(size) - incr; // 1 <= remain <= size
  -        if(remain == valueof(size) || idx <= fromInteger(remain - 1)) begin
  -            // add remain == valueof(size) may optmize a little
  -            // because compiler may not know that idx < size
  -            return idx + fromInteger(incr);
  -        end
  -        else begin
  -            return idx - fromInteger(remain);
  -        end
  -    endfunction
  -
  -    function Maybe#(t) findLast(function Bool pred(t x), Vector#(n, t) in);
  -        return find(pred, reverse(in));
  -    endfunction
  -
  -    function List#(t) readListEhr(Integer i, List#(Ehr#(n, t)) ehrList);
  -        function t getVal(Ehr#(n, t) e) = e[i];
  -        return List::map(getVal, ehrList);
  +    function indexT incrIndex(indexT idx, SupCnt incr);
  +        Bit#(TLog#(TAdd#(size, 1))) newIdx = zeroExtend(idx) + zeroExtend(incr);
  +        if(newIdx >= fromInteger(valueof(size))) begin
  +            newIdx = newIdx - fromInteger(valueof(size));
  +        end
  +        return truncate(newIdx);
       endfunction
   
       // get the index to query renaming_table
       function Bit#(TLog#(NumArchReg)) getRTIndex(ArchRIndx arch) = pack(arch);
   
       // vector of index to claim free phy regs for each rename port
  -    Vector#(SupSize, indexT) claimIndex = map(incrIndex(enqP), genVector);
  +    Vector#(SupSize, indexT) claimIndex;
  +    for(Integer i = 0; i < valueof(SupSize); i = i+1) begin
  +        claimIndex[i] = incrIndex(enqP, fromInteger(i));
  +    end
   
       // vector of index to commit phy regs for each commit port
  -    Vector#(SupSize, indexT) commitIndex = map(incrIndex(deqP), genVector);
  +    Vector#(SupSize, indexT) commitIndex;
  +    for(Integer i = 0; i < valueof(SupSize); i = i+1) begin
  +        commitIndex[i] = incrIndex(deqP, fromInteger(i));
  +    end
   
       // similar to LSQ, get virtual tag by using enqP as pivot (enqP is changed at end of cycle)
       // valid entry i --> i < enqP ? i + size : i
  
positive.code:     // function to search claimed phy regs just in this cycle to
      // get phy reg for an arch reg for get_renaming at port getPort
      function Maybe#(PhyRIndx) search_claimed_renamings(Integer getPort, ArchRIndx arch_reg);
          List#(Maybe#(RenameClaim)) claims = readListEhr(1, List::take(getPort, toList(claimEn)));
          function Maybe#(PhyRIndx) getHit(Maybe#(RenameClaim) x);
              if(x matches tagged Valid .e) begin
                  return e.arch == (Valid (arch_reg)) ? Valid (e.phy) : Invalid;
              end
              else begin
  
negative.code: 
              method Action claimRename(ArchRegs r, SpecBits sb) if(guard);
                  // record the claim
                  claimEn[i].wset(RenameClaim {
                      arch: r.dst,
                      phy: claim_phy_reg,
                      specBits: sb
  