anchor.diff:    endrule
   
     // process payload portion of packet, until last beat
  -  rule rl_deparse_payload if (deparse_done[1] && !eop_this_cycle);
  +  rule rl_deparse_payload if (deparse_done[1] && !data_in_tmp[1].eop);
       let v = data_in_ff.first;
       data_in_ff.deq;
  +    data_in_tmp[1] <= v;
       if (rg_buffered[1] != 0) begin
         Bit#(128) data_mask = create_mask(cExtend(rg_buffered[1]));
         Bit#(16) mask_out = create_mask(cExtend(rg_buffered[1] >> 3));
  -      let data = ByteStream { sop: v.sop, eop: v.eop, data: truncate(rg_tmp[1]) & data_mask, mask: mask_out, user:0 };
  +      let data = ByteStream { sop: data_in_tmp[1].sop,
  +                              eop: data_in_tmp[1].eop,
  +                              data: truncate(rg_tmp[1]) & data_mask,
  +                              mask: mask_out,
  +                              user:data_in_tmp[1].user};
         deparse_send_r <= data;
         flit_ff.enq(?);
         dbprint(4, $format("Deparser:rl_deparse_payload rg_buffered=%d", rg_buffered[1], fshow(data)));
  
positive.code:         // take data from data_in_ff, shift and append
          // rg_tmp = data << rg_buffered | rg_tmp;
          // rg_buffered += len
          rg_tmp[0] <= zeroExtend(data_this_cycle) << rg_buffered[0] | rg_tmp[0];
          sop_tmp[0] <= sop_this_cycle;
          eop_tmp[0] <= eop_this_cycle;
  
          dbprint(4, $format("Deparser:rl_data_ff_load "));
          data_in_ff.deq;
  
          UInt#(NumBytes) n_bytes_used = countOnes(mask_this_cycle);
          UInt#(NumBits) n_bits_used = cExtend(n_bytes_used) << 3;
          move_buffered_amt(cExtend(n_bits_used));
          dbprint(4, $format("load state %d %d ", rg_buffered[0], n_bits_used, fshow(state)));
  
negative.code:     end
      else begin
        dbprint(4, $format("Deparser:rl_deparse_payload ", fshow(v)));
        let data = ByteStream { sop: data_in_tmp[1].sop,
                                eop: data_in_tmp[1].eop,
                                data: data_in_tmp[1].data,
                                mask: data_in_tmp[1].mask,
                                user: data_in_tmp[1].user };
        deparse_send_r <= data;
        flit_ff.enq(?);
      end
    endrule
  
    // reset all temporary states at last beat
    rule rl_reset if (deparse_done[1] && data_in_tmp[1].eop);
      data_in_tmp[1] <= defaultValue;
      rg_tmp[1] <= 0;
      rg_buffered[2] <= 0;
      rg_processed[2] <= 0;
      dbprint(4, $format("Deparser:rl_reset"));
      let data = ByteStream { sop: data_in_tmp[1].sop,
                              eop: data_in_tmp[1].eop,
                              data: data_in_tmp[1].data,
                              mask: data_in_tmp[1].mask,
                              user: data_in_tmp[1].user };
      deparse_send_r <= data;
      flit_ff.enq(?);
    endrule
  
  