anchor.diff:     rule duplicateSignal;
         let v = infifo.first;
         infifo.deq();
  -      mul[0].x.enq(v);
  -      mul[1].x.enq(v);
  +      mul[0].x.enq(v[0]);
  +      mul[1].x.enq(v[1]);
      endrule
      
      rule filter_phase;
  
positive.code:    endrule
  
     rule accumoutcombinein;
        let a0 <- accumout[0].get();
        let a1 <- accumout[1].get();
        ycombined.enq(a0 + a1);
     endrule
     
     rule combineoutloin;
        let yin <- ycombined.get();
        let loin <- dds.osc.get();
        lo.x.enq(yin);
        lo.a.enq(CoeffData{a: loin, filterPhase: 0});
     endrule
     
     rule loout;
        let y <- lo.y;
        outfifo.enq(y.y);
     endrule
     
     interface PipeIn rfreq = toPipeIn(infifo);
     
     method Action setCoeff(Bit#(10) addr, Bit#(32) value);
        int idx = addr[0];
        if (idx == 0)
  	 coeffRam0.portA.request.put(BRamRequest{write: True, responseOnWrite: False, address: addr[8:1], datain: unpack(pack(value))});
        else
  	 coeffRam1.portA.request.put(BRamRequest{write: True, responseOnWrite: False, address: addr[8:1], datain: unpack(pack(value))});
     endmethod
        
     interface PipeOut ifreq = toPipeOut(outfifo);
  
negative.code: interface ChannelSelect;
     interface PipeIn#(Vector#(2, Complex#(Signal))) rfreq;
     interface PipeOut#(Complex#(Signal)) ifreq;
     method Action setCoeff(Bit#(11) addr, Bit#(32) valre, Bit#(32) valim);
  endinterface
  
  
  module mkChannelSelect#(Bit#(10) decimation, DDS dds)(ChannelSelect)
     provisos(Bits#(CoeffData, a__),
  	    Bits#(ProductData, b__),
  	    Bits#(MulData, c__));
     BRAM_Configure cfg = defaultValue;
     cfg.memorySize = 1024;
     BRAM2Port#(Bit#(10), Complex#(FixedPoint#(2,23))) coeffRam0 <- 
         mkBRAM2Server(cfg);
     BRAM2Port#(Bit#(10), Complex#(FixedPoint#(2,23))) coeffRam1 <- 
         mkBRAM2Server(cfg);
     Reg#(Bit#(10)) filterPhase <- mkReg(?);
     FIFO#(Bit#(1)) delayFilterPhase <- mkSizedFIFO(3);  // length > bram read latency
     FIFOF#(Vector#(2, Complex#(Signal))) infifo <- mkFIFOF();
     FIFOF#(Complex#(Signal)) outfifo <- mkFIFOF();
     Vector#(2, FPCMult) mul <- replicateM(mkFPCMult());
  
     Vector#(2, Reg#(Complex#(Product))) accum <- replicateM(mkReg(?));
  