anchor.diff:        writeEngine.dataPipe.enq(pack(v));
      endrule
      rule sendHeader if (indState == SendHeader && interruptStatus);
  -      Bit#(16) numWords = portal.messageSize(readyChannel) >> 5;
  +      Bit#(16) messageBits = portal.messageSize(readyChannel);
  +      Bit#(16) roundup = messageBits[4:0] == 0 ? 0 : 1;
  +      Bit#(16) numWords = (messageBits >> 5) + roundup;
         Bit#(16) totalWords = numWords + 1;
         if (numWords[0] == 0)
   	 totalWords = numWords + 2;
  +      paddingReg <= numWords[0] == 0;
         Bit#(32) hdr = extend(readyChannel) << 16 | extend(totalWords);
  -      $display("sendHeader hdr=%h numWords=%d", hdr, numWords);
  +      $display("sendHeader hdr=%h messageBits=%d numWords=%d totalWords=%d paddingReg=%d indHeadReg=%h", hdr, messageBits, numWords, totalWords, paddingReg, indHeadReg);
   
         indHeadReg <= indHeadReg + totalWords;
         messageWordsReg <= numWords;
  
positive.code:    Waiting,
     SendHeader,
     SendMessage,
     Stop
     } SharedMemoryPortalState deriving (Bits,Eq);
  
  
negative.code:    Vector#(numIndications, Bool) readyBits = map(pipeOutNotEmpty, portal.indications);
     Bool      interruptStatus = False;
     Bit#(16)  readyChannel = -1;
     for (Integer i = valueOf(numIndications) - 1; i >= 0; i = i - 1) begin
        if (readyBits[i]) begin
           interruptStatus = True;
           readyChannel = fromInteger(i);
  