anchor.diff:  
   `ifdef XSIM
   import "BVI" XsimLink =
  -module mkSimLink#(String name)(SimLink#(32));
  -   parameter NAME=name;
  +module mkSimLink#(Integer linknumber)(SimLink#(32));
  +   parameter LINKNUMBER=linknumber;
   
      method start(listening) enable (EN_start);
      interface PipeOut rx;
  
positive.code:    Reg#(Bool) started   <- mkReg(False);
  
     rule open if (!opened && started);
        bsimLinkOpen(name, listening);
        opened <= True;
     endrule
  
     rule receive if (bsimLinkCanReceive(name, listening));
        let v <- bsimLinkReceive(name, listening);
        rxFifo.enq(v);
     endrule
  
     rule transmit if (bsimLinkCanTransmit(name, listening));
        let v <- toGet(txFifo).get();
        bsimLinkTransmit(name, listening, v);
     endrule
  
     interface rx = toPipeOut(rxFifo);
  
negative.code: endinterface
  
  `ifdef BSIM
  import "BDPI" function Action                 bsimLinkOpen(Integer linknumber, Bool listening);
  import "BDPI" function Bool                   bsimLinkCanReceive(Integer linknumber, Bool listening);
  import "BDPI" function Bool                   bsimLinkCanTransmit(Integer linknumber, Bool listening);
  import "BDPI" function ActionValue#(Bit#(32)) bsimLinkReceive32(Integer linknumber, Bool listening);
  import "BDPI" function Action                 bsimLinkTransmit32(Integer linknumber, Bool listening, Bit#(32) value);
  import "BDPI" function ActionValue#(Bit#(64)) bsimLinkReceive64(Integer linknumber, Bool listening);
  import "BDPI" function Action                 bsimLinkTransmit64(Integer linknumber, Bool listening, Bit#(64) value);
  
  typeclass SelectLinkWidth#(numeric type dsz);
     function ActionValue#(Bit#(dsz)) bsimLinkReceive(Integer linknumber, Bool listening);
     function Action bsimLinkTransmit(Integer linknumber, Bool listening, Bit#(dsz) value);
  endtypeclass
  
  instance SelectLinkWidth#(32);
     function ActionValue#(Bit#(32)) bsimLinkReceive(Integer linknumber, Bool listening);
     actionvalue
        let v <- bsimLinkReceive32(linknumber, listening);
        return v;
     endactionvalue
     endfunction
     function Action bsimLinkTransmit(Integer linknumber, Bool listening, Bit#(32) value);
     action
        bsimLinkTransmit32(linknumber, listening, value);
     endaction
     endfunction
  endinstance
  instance SelectLinkWidth#(64);
     function ActionValue#(Bit#(64)) bsimLinkReceive(Integer linknumber, Bool listening);
     actionvalue
        let v <- bsimLinkReceive64(linknumber, listening);
        return v;
     endactionvalue
     endfunction
     function Action bsimLinkTransmit(Integer linknumber, Bool listening, Bit#(64) value);
     action
        bsimLinkTransmit64(linknumber, listening, value);
     endaction
     endfunction
  endinstance
  
  module mkSimLink#(Integer linknumber)(SimLink#(dataWidth)) provisos (SelectLinkWidth#(dataWidth));
     FIFOF#(Bit#(dataWidth)) rxFifo <- mkFIFOF();
     FIFOF#(Bit#(dataWidth)) txFifo <- mkFIFOF();
     Reg#(Bool) opened    <- mkReg(False);
  