anchor.diff:     endrule
   `endif 
     
  -   rule finish_setup_n2b;
  -      if (verbose) $display("mkMPEngine::finish_setup_n2b");
  -      let x <- n2b.finish;
  -      conff.deq;
  -      stage <= Config_mpNext;
  -   endrule
  -
  -   rule finish_setup_mp2b;
  -      if (verbose) $display("mkMPEngine::finish_setup_mp2b");
  -      let y <- mp2b.finish;
  -      conff.deq;
  -      stage <= Initialized;
  -   endrule
  -      
  -   rule setup_needle (stage == Config_needle);
  -      conff.enq(True);
  -      match {.needle_sglId, .mpNext_sglId, .needle_len} = ssfifo.first;
  -      needleLenReg <= extend(needle_len);
  -      if (verbose) $display("mkMPEngine::setup_needle %d %d", needle_sglId, needle_len);
  -      n2b.start(needle_sglId, 0, 0, pack(truncate(needle_len)));
  -   endrule
  -   
  -   rule setup_mpNext (stage == Config_mpNext);
  -      conff.enq(True);
  -      match {.needle_sglId, .mpNext_sglId, .needle_len} = ssfifo.first;
  -      needleLenReg <= extend(needle_len);
  -      if (verbose) $display("mkMPEngine::setup_mpNext %d %d", mpNext_sglId, needle_len);
  -      mp2b.start(mpNext_sglId, 0, 0, pack(truncate(needle_len)));
  -      ssfifo.deq;
  -   endrule
  -
  -   rule search (stage == Initialized && !efifo.notEmpty && !haystack.notEmpty);
  -      stage <= Search;
  -      conff.enq(True);
  -      match {.haystack_sglId, .haystack_len, .haystack_base} <- toGet(ssfifo).get;
  -      haystackLenReg <= extend(haystack_len);
  -      haystackBase <= extend(haystack_base);
  -      iReg <= 1;
  -      jReg <= 1;
  -      epochReg <= 0;
  -      if (verbose) $display("mkMPEngine::search %d %d %d",  haystack_sglId, haystack_base, haystack_len);
  -   endrule
  -   
  -   interface PipeIn setsearch = toPipeIn(ssfifo);   
  +   interface PipeIn needle = n2b.pipe;
  +   interface PipeIn mpNext = mp2b.pipe;
  +   interface PipeIn haystack = toPipeIn(haystackFifo);
      interface PipeOut locdone = toPipeOut(locf);
   
   endmodule
  
positive.code:    Reg#(Bit#(32)) iReg <- mkReg(0); // offset in needle
     Reg#(Bit#(2))  epochReg <- mkReg(0);
  
     BRAMWriter#(NeedleIdxWidth,configBusWidth) n2b <- mkBRAMWriter(0, needle.portB, configReader);
     BRAMWriter#(NeedleIdxWidth,configBusWidth) mp2b <- mkBRAMWriter(1, mpNext.portB, configReader);
  
     FIFOF#(Tuple2#(Bit#(2),Bit#(32))) efifo <- mkSizedFIFOF(2);
     FIFOF#(Triplet#(Bit#(32))) ssfifo <- mkFIFOF;
     FIFO#(void) doneFifo <- mkFIFO;
     
     rule countCycles;
  
negative.code: 
  endmodule
  
  module mkMPStreamEngine(MPStreamEngine#(haystackBusWidth,configBusWidth))
  
     provisos(Add#(a__, 8, haystackBusWidth),
  	    Div#(haystackBusWidth,8,haystackBusBytes),
  