anchor.diff:        return isValid(x) ? x : y;
      endfunction
      
  +   let next_resp_read_idx = fold(yyy, zipWith(xxx, genVector, map(get_resp_read,ifcs)));
  +
  +`ifdef MULTIPLE_WRITES
      function Maybe#(Bit#(TLog#(numIfcs))) zzz(Bit#(_c) r, Integer x, FIFOF#(Bit#(_c)) y);
         return y.notEmpty ? (y.first == r ? tagged Valid fromInteger(x) : tagged Invalid) : tagged Invalid; 
      endfunction
      
  -   let next_resp_read_idx = fold(yyy, zipWith(xxx, genVector, map(get_resp_read,ifcs)));
      let next_resp_b_idx    = fold(yyy, zipWith(xxx, genVector, map(get_resp_b,   ifcs)));
  -   
  +
      function Bit#(TLog#(numIfcs)) write_idx(Bit#(_c) r);
         return fromMaybe(?, fold(yyy, zipWith(zzz(r), genVector, req_aw_fifos)));
      endfunction
  -
  +`endif
  +   
      interface Put req_aw;
         method Action put(Axi3WriteRequest#(_a,_c) req);
   	 Bit#(TLog#(numIfcs)) wsv = truncate(psel(req.address));
   	 if (wsv > fromInteger(valueOf(numInputs)))
   	    wsv = fromInteger(valueOf(numInputs));
   	 ifcs[wsv].req_aw.put(req);
  +`ifdef MULTIPLE_WRITES
  +	 req_aw_fifos[wsv].enq(req.id);
  +`else
  +	 ws <= wsv;
  +	 req_aw_fifo.enq(?);
  +`endif
   	 if (wsv > 0)
   	    dir.writeEvent <= ?;
  -	 req_aw_fifos[wsv].enq(req.id);
         endmethod
      endinterface
      interface Put resp_write;
         method Action put(Axi3WriteData#(_b,_c) wdata);
  +`ifdef MULTIPLE_WRITES
   	 ifcs[write_idx(wdata.id)].resp_write.put(wdata);
  +`else
  +	 ifcs[ws].resp_write.put(wdata);
  +`endif
         endmethod
      endinterface
      interface GetF resp_b;
  +`ifdef MULTIPLE_WRITES
         method ActionValue#(Axi3WriteResponse#(_c)) get() if (next_resp_b_idx matches tagged Valid .idx);
   	 let rv <- ifcs[idx].resp_b.get();
   	 req_aw_fifos[idx].deq;
   	 return rv;
         endmethod
  +`else
  +      method ActionValue#(Axi3WriteResponse#(_c)) get();
  +	 let rv <- ifcs[ws].resp_b.get();
  +	 req_aw_fifo.deq;
  +	 return rv;
  +      endmethod
  +`endif
  +`ifdef MULTIPLE_WRITES
         method Bool notEmpty();
   	 return isValid(next_resp_b_idx);
         endmethod
  +`else
  +      method Bool notEmpty;
  +         return ifcs[ws].resp_b.notEmpty;
  +      endmethod
  +`endif   
      endinterface
      interface Put req_ar;
         method Action put(Axi3ReadRequest#(_a,_c) req);
  
positive.code: import Vector::*;
  import GetPut::*;
  import FIFOF::*;
  import GetPutF::*;
  
  import AxiMasterSlave::*;
  
negative.code:    
     Axi3Slave#(_a,_b,_c) out_of_range <- mkAxi3SlaveOutOfRange;
     Vector#(numIfcs, Axi3Slave#(_a,_b,_c)) ifcs = append(cons(dir.portalIfc.ctrl,map(getCtrl, portals)),cons(out_of_range, nil));
  
  `ifdef MULTIPLE_WRITES
     Vector#(numIfcs,FIFOF#(Bit#(_c))) req_aw_fifos <- replicateM(mkSizedFIFOF(1));
  `else
     FIFO#(void) req_aw_fifo <- mkPipelineFIFO;
     Reg#(Bit#(TLog#(numIfcs))) ws <- mkReg(0);
  `endif   
  
     let port_sel_low = valueOf(aw);
     let port_sel_high = valueOf(TAdd#(3,aw));
  
  