anchor.diff:     RingBuffer statusRing <- mkRingBuffer;
      Reg#(Bool) hwenabled <- mkReg(False);
      Reg#(Bool) cmdBusy <- mkReg(False);
  +   UInt#(64) cmd;
   
  -   rule cmdFetchRule (hwenabled && !cmdBusy & (cmdRing.notEmpty()));
  -      Bit#(40) nextCmdAddress = cmdRing.get(2);
  -      cmdBusy <= True;
  -      StmtFSM FetchCmd =
  -      for ii <= 0; ii < 8; ii <= ii + 1) seq
  -	 cmd_read_chan.readReq.put(nextCmdAddress);
  -	 nextCmdAddress <= nextCmdAddress + 8;
  +   // wait for hwenabled
  +   // wait for not cmdBusy
  +   // wait for cmdRing not empty
  +   // then start fetches for the next command
  +   Stmt CmdFetch = 
  +   seq
  +      while (True) seq
  +	 while(!(hwenabled && cmdRing.notEmpty())) noAction;
  +	 cmd_read_chan.readReq.put(cmdRing.expBufferLast);
  +	 cmdRing.expBufferLast <= cmdRing.expBufferLast + 8;
         endseq
  -   endrule
  -  rule cmdDispatchRule
  -     UInt#(64) cmd = cmd_read_chan.readData.get
  +   endseq
      
  +   function UInt#(8) getopcode(UInt#(64) a);
  +      return a[63:56];
  +   endfunction
   
  +   Stmt CmdDispatch = 
  +   seq
  +      while (True) seq
  +	 cmd = cmd_read_chan.readData.get();
  +	 let fn = getopcode(cmd);
  +	 if (fn == cmdNop)
  +	    cmdServer = nopServer;
  +	 else if (fn == cmdCOPY)
  +	    cmdServer = ce;
  +	 else if (fn == cmdECHO)
  +	    cmdServer = echoServer;
  +	 cmdServer.put(cmd);
  +	 for (ii = 1; ii < 8; ii = ii + 1)
  +	    cmdServer.put(cmd_read_chan.readData.get());
  +      endseq
  +   endseq
      
  -   rule writeRule;
  -      let v <- dma_write_chan.writeDone.get;
  -      indication.coreIndication.writeWordResult(unpack(0));
  -   endrule
  +   
  +   Stmt CmdCompletion =
  +   seq
  +      while(True) seq
  +	 while(!(hwenabled && statusRing.notFull())) noAction;
  +      endseq
  +   endseq
   
  -   rule readRule;
  -      let v <- dma_read_chan.readData.get;
  -      indication.coreIndication.readWordResult(v);
  -   endrule
  -   
      rule copyCompletion;
         let v <- ce.response.get();
         indication.coreIndication.completion(1, v);
  
positive.code: endinterface
  
  interface CoreIndication;
     method Action readWordResult(Bit#(64) v);
     method Action writeWordResult(Bit#(64) v);
     method Action setResult(Bit#(1) cmd, Bit#(2) regist, Bit#(40) addr);
     method Action getResult(Bit#(1) cmd, Bit#(2) regist, Bit#(40) addr);
     method Action completion(Bit#(32) command, Bit#(32) tag);
  
negative.code:    AxiDMA#(Bit#(64))   dma <- mkAxiDMA(indication.dmaIndication);
  `endif
  
     Server#(Bit#(64), Bit#(64)) ce <- mkCopyEngine(dma.read.readChannels[2], dma.write.writeChannels[2]);
     Server#(Bit#(64), Bit#(64)) discardServer <- mkNopServer();
     Server#(Bit#(64), Bit#(64)) echoServer <- mkEchoServer();
     
     Server#(Bit#(64), Bit#(64)) cmdServer;
     Server#(Bit#(64), Bit#(64)) responseServer;
  
     ReadChan#(Bit#(64))   dma_read_chan = dma.read.readChannels[0];
     WriteChan#(Bit#(64)) dma_write_chan = dma.write.writeChannels[0];
  