anchor.diff:     Array#(Reg#(Bool)) header_done <- mkCReg(2, True);
      Array#(Reg#(MetadataT)) meta <- mkCReg(2, defaultValue);
      PulseWire w_deparse_header_done <- mkPulseWire();
  -   Array#(Reg#(Bool)) sop_tmp <- mkCReg(2, False);
  -   Array#(Reg#(Bool)) eop_tmp <- mkCReg(2, False);
  -
  -   let mask_this_cycle = data_in_ff.first.mask;
  -   let sop_this_cycle = data_in_ff.first.sop;
  -   let eop_this_cycle = data_in_ff.first.eop;
  -   let data_this_cycle = data_in_ff.first.data;
  +
  +   // pipeline register at data_in
  +   Array#(Reg#(ByteStream#(16))) data_in_tmp <- mkCReg(2, defaultValue);
   
      // stage 1
      FIFO#(void) flit_ff <- mkFIFO;
  
positive.code:     end
      else begin
        dbprint(4, $format("Deparser:rl_deparse_payload ", fshow(v)));
        deparse_send_r <= v;
        flit_ff.enq(?);
      end
    endrule
  
    // reset all temporary states at last beat
    rule rl_reset if (deparse_done[1] && eop_this_cycle);
      // forward data_in to data_out
      let v = data_in_ff.first;
      data_in_ff.deq;
      rg_tmp[1] <= 0;
      rg_buffered[2] <= 0;
      rg_processed[2] <= 0;
      dbprint(4, $format("Deparser:rl_reset"));
      deparse_send_r <= v;
      flit_ff.enq(?);
    endrule
  
  
negative.code:   endrule
  
    // process payload portion of packet, until last beat
    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: 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)));
  