anchor.diff:  
      interface tck = mytck;
      interface rst = myrst;
  -   method capture = bscan.capture;
  -   method sel = bscan.sel;
  -   method shift = bscan.shift;
      method tdi = bscan.tdi;
      method tdo = bscan.tdo;
  -   method update = bscan.update;
  +   method capture;
  +       return bscan.sel & bscan.capture;
  +   endmethod
  +   method shift;
  +       return bscan.sel & bscan.shift;
  +   endmethod
  +   method update;
  +       return bscan.sel & bscan.update;
  +   endmethod
      method first();
         return selected.read() && !selectdelay;
  -   endmethod
  -   method selsync();
  -      return pack(selected.read());
      endmethod
   endmodule
   
  
positive.code:    interface Clock    tck;
     method Bit#(1)     reset();
     method Bit#(1)     capture();
     method Bit#(1)     sel();
     method Bit#(1)     shift();
     method Bit#(1)     tdi();
     method Action      tdo(Bit#(1) v);
     method Bit#(1)     update();
     method Bool        first();
     method Bit#(1)     selsync();
  endinterface
  module mkBscanTop#(Integer bus)(BscanTop);
     Clock defaultClock <- exposeCurrentClock();
  
negative.code: 
     Reg#(Bit#(asz)) addrReg <- mkReg(0);
     Reg#(Bool) readData <- mkReg(False);
     Reg#(Bool) firstItem <- mkReg(False);
     Reg#(Bool) selected <- mkReg(False);
     SyncBitIfc#(Bool) selectedj <- mkSyncBits(False, defaultClock, defaultReset, bscan.tck, bscan.rst);
  
     Reg#(Bit#(dsz)) shiftReg <- mkReg(0, clocked_by bscan.tck, reset_by bscan.rst);
     SyncBitIfc#(Bit#(dsz)) tojtag <- mkSyncBits(0, defaultClock, defaultReset, bscan.tck, bscan.rst);
     SyncBitIfc#(Bit#(dsz)) fromjtag <- mkSyncBits(0, bscan.tck, bscan.rst, defaultClock, defaultReset);
     SyncPulseIfc startWrite <- mkSyncHandshake(bscan.tck, bscan.rst, defaultClock);
  
     rule captureRule if(bscan.capture() == 1);
         shiftReg <= tojtag.read();
     endrule
     rule shiftRule if (bscan.shift() == 1);
         shiftReg <= { bscan.tdi(), shiftReg[dsz-1:1] };
     endrule
     rule updateRule if(bscan.update() == 1);
         startWrite.send();
         fromjtag.send(shiftReg);
     endrule
  
     rule firstRule if (bscan.first());
         firstItem <= True;
         selected <= False;
         selectedj.send(False);
         tojtag.send(0);
     endrule
     rule addrRule if (startWrite.pulse());
         let v = fromInteger(0);  // first time USER1, reset address
         if (firstItem) begin
             selected <= fromjtag.read() == fromInteger(id);
             selectedj.send(fromjtag.read() == fromInteger(id));
         end
         else
             v = addrReg + 1;
         addrReg <= v;
         firstItem <= False;
     endrule
     rule readdataRule;
         readData <= startWrite.pulse();
     endrule
  
     interface BRAMClient bramClient;
        interface Get request;
  	 method ActionValue#(BRAMRequest#(atype,dtype)) get() if ((selected && startWrite.pulse()) || readData);
              return BRAMRequest {write:!readData, responseOnWrite:False, address:unpack(addrReg), datain:unpack(fromjtag.read())};
  	 endmethod
        endinterface
  