anchor.diff:  		 Bool)) rState_S8 <- mkReg(unpack(0));
      Reg#(Bool) rValid_S8 <- mkReg(False);
   
  +   // check operands, compute exponent for multiply
  +   rule s1_stage;
  +      begin
  +	 Tuple3#(Maybe#(FloatingPoint#(e,m)),FloatingPoint#(e,m),FloatingPoint#(e,m)) req = unpack(0);
  +	 let valid = False;
  +	 if (fOperand_S0.notEmpty()) begin
  +	    req = fOperand_S0.first();
  +	    fOperand_S0.deq();
  +	    valid = True;
  +	 end
  +	 match { .mopA, .opB, .opC } = req;
  +
  +	 CommonState#(e,m) s = CommonState {
  +	    res: tagged Invalid,
  +	    exc: defaultValue,
  +	    rmode: rmode
  +	    };
  +
  +	 Bool acc = False;
  +	 FloatingPoint#(e,m) opA = 0;
  +
  +	 if (mopA matches tagged Valid .opA_) begin
  +	    opA = opA_;
  +	    acc = True;
  +	 end
  +
  +	 Int#(ebits) expB = isSubNormal(opB) ? fromInteger(minexp(opB)) : signExtend(unpack(unbias(opB)));
  +	 Int#(ebits) expC = isSubNormal(opC) ? fromInteger(minexp(opC)) : signExtend(unpack(unbias(opC)));
  +
  +	 Bit#(mbits) sfdB = { getHiddenBit(opB), opB.sfd };
  +	 Bit#(mbits) sfdC = { getHiddenBit(opC), opC.sfd };
  +
  +	 Bool sgnBC = opB.sign != opC.sign;
  +	 Bool infBC = isInfinity(opB) || isInfinity(opC);
  +	 Bool zeroBC = isZero(opB) || isZero(opC);
  +	 Int#(ebits) expBC = expB + expC;
  +
  +	 if (isSNaN(opA)) begin
  +	    s.res = tagged Valid nanQuiet(opA);
  +	    s.exc.invalid_op = True;
  +	 end
  +	 else if (isSNaN(opB)) begin
  +	    s.res = tagged Valid nanQuiet(opB);
  +	    s.exc.invalid_op = True;
  +	 end
  +	 else if (isSNaN(opC)) begin
  +	    s.res = tagged Valid nanQuiet(opC);
  +	    s.exc.invalid_op = True;
  +	 end
  +	 else if (isQNaN(opA)) begin
  +	    s.res = tagged Valid opA;
  +	 end
  +	 else if (isQNaN(opB)) begin
  +	    s.res = tagged Valid opB;
  +	 end
  +	 else if (isQNaN(opC)) begin
  +	    s.res = tagged Valid opC;
  +	 end
  +	 else if ((isInfinity(opB) && isZero(opC)) || (isZero(opB) && isInfinity(opC)) || (isInfinity(opA) && infBC && (opA.sign != sgnBC))) begin
  +	    // product of zero and infinity or addition of opposite sign infinity
  +	    s.res = tagged Valid qnan();
  +	    s.exc.invalid_op = True;
  +	 end
  +	 else if (isInfinity(opA)) begin
  +	    s.res = tagged Valid opA;
  +	 end
  +	 else if (infBC) begin
  +	    s.res = tagged Valid infinity(sgnBC);
  +	 end
  +	 else if (isZero(opA) && zeroBC && (opA.sign == sgnBC)) begin
  +	    s.res = tagged Valid opA;
  +	 end
  +
  +	 
  +	 rState_S1 <= tuple7(s,
  +			     acc,
  +			     opA,
  +			     sgnBC,
  +			     expBC,
  +			     sfdB,
  +			     sfdC);
  +	 rValid_S1 <= valid;
  +      end
  +   //endrule
  +
  +   // start multiply
  +      //rule s2_stage if (fResult_S9.notFull());
  +      begin
  +	 match { .s, .acc, .opA, .sgnBC, .expBC, .sfdB, .sfdC } = rState_S1;
  +	 let valid = rValid_S1;
  +
  +	 UInt#(mbits) sfdClsb = extend(unpack(sfdC[15:0]));
  +	 UInt#(TSub#(mbits,16)) sfdCmsb = unpack(sfdC[valueOf(mbits)-1:16]);
  +	 rProd_S2lsb <= extend(unpack(sfdB))*extend(sfdClsb);
  +	 rProd_S2msb <= extend(unpack(sfdB))*extend(sfdCmsb);
  +	 
  +	 rState_S2 <= tuple5(s,
  +			     acc,
  +			     opA,
  +			     sgnBC,
  +			     expBC);
  +	 rValid_S2 <= valid;
  +      end
  +   //endrule
  +
  +   //   add partial multiplies
  +      //rule s3_stage if (fResult_S9.notFull());
  +      begin
  +	 match { .s, .acc, .opA, .sgnBC, .expBC } = rState_S2;
  +	 let valid = rValid_S2;
  +
  +	 UInt#(mmbits) sfdBC = rProd_S2lsb + (rProd_S2msb << 16);
  +	 rProd_S3 <= sfdBC;
  +
  +	 rState_S3 <= tuple5(s,
  +			     acc,
  +			     opA,
  +			     sgnBC,
  +			     expBC);
  +	 rValid_S3 <= valid;
  +      end
  +   //endrule
  +
  +   // normalize multiplication result
  +      //rule s4_stage if (fResult_S9.notFull());
  +      begin
  +	 match { .s, .acc, .opA, .sgnBC, .expBC } <- toGet(rState_S3).get;
  +	 let valid = rValid_S3;
  +
  +	 let sfdBC = pack(rProd_S3);
  +	 
  +	 FloatingPoint#(e,m) bc = defaultValue;
  +	 Bit#(2) guardBC = ?;
  +
  +	 if (s.res matches tagged Invalid) begin
  +	    if (expBC > fromInteger(maxexp(bc))) begin
  +	       bc.sign = sgnBC;
  +	       bc.exp = maxBound - 1;
  +	       bc.sfd = maxBound;
  +	       guardBC = '1;
  +
  +	       s.exc.overflow = True;
  +	       s.exc.inexact = True;
  +	    end
  +	    else if (expBC < (fromInteger(minexp_subnormal(bc))-2)) begin
  +	       bc.sign = sgnBC;
  +	       bc.exp = 0;
  +	       bc.sfd = 0;
  +	       guardBC = 0;
  +
  +	       if (|sfdBC == 1) begin
  +		  guardBC = 1;
  +		  s.exc.underflow = True;
  +		  s.exc.inexact = True;
  +	       end
  +	    end
  +	    else begin
  +	       let shift = fromInteger(minexp(bc)) - expBC;
  +	       if (shift > 0) begin
  +		  // subnormal
  +		  Bit#(1) sfdlsb = |(sfdBC << (fromInteger(valueOf(mmbits)) - shift));
  +
  +		  sfdBC = sfdBC >> shift;
  +		  sfdBC[0] = sfdBC[0] | sfdlsb;
  +
  +		  bc.exp = 0;
  +	       end
  +	       else begin
  +		  bc.exp = cExtend(expBC + fromInteger(bias(bc)));
  +	       end
  +
  +	       bc.sign = sgnBC;
  +	       let y = normalize(bc, sfdBC);
  +	       bc = tpl_1(y);
  +	       guardBC = tpl_2(y);
  +	       s.exc = s.exc | tpl_3(y);
  +	    end
  +	 end
  +
  +	 rState_S4 <= tuple5(s,
  +			     acc,
  +			     opA,
  +			     bc,
  +			     guardBC);
  +	 rValid_S4 <= valid;
  +      end
  +   //endrule
  +
  +   // calculate shift and sign for add
  +      //rule s5_stage if (fResult_S9.notFull());
  +      begin
  +	 match { .s, .acc, .opA, .opBC, .guardBC } = rState_S4;
  +	 let valid = rValid_S4;
  +
  +	 Int#(ebits) expA = isSubNormal(opA) ? fromInteger(minexp(opA)) : signExtend(unpack(unbias(opA)));
  +	 Int#(ebits) expBC = isSubNormal(opBC) ? fromInteger(minexp(opBC)) : signExtend(unpack(unbias(opBC)));
  +
  +	 Bit#(m5bits) sfdA = {1'b0, getHiddenBit(opA), opA.sfd, 3'b0};
  +	 Bit#(m5bits) sfdBC = {1'b0, getHiddenBit(opBC), opBC.sfd, guardBC, 1'b0};
  +
  +	 Bool sub = opA.sign != opBC.sign;
  +
  +	 Int#(ebits) exp = ?;
  +	 Int#(ebits) shift = ?;
  +	 Bit#(m5bits) x = ?;
  +	 Bit#(m5bits) y = ?;
  +	 Bool sgn = ?;
  +
  +	 if ((!acc) || (expBC > expA) || ((expBC == expA) && (sfdBC > sfdA))) begin
  +	    exp = expBC;
  +	    shift = expBC - expA;
  +	    x = sfdBC;
  +	    y = sfdA;
  +	    sgn = opBC.sign;
  +	 end
  +	 else begin
  +	    exp = expA;
  +	    shift = expA - expBC;
  +	    x = sfdA;
  +	    y = sfdBC;
  +	    sgn = opA.sign;
  +	 end
  +
  +	 rState_S5 <= tuple8(s,
  +			     acc,
  +			     sub,
  +			     sgn,
  +			     exp,
  +			     shift,
  +			     x,
  +			     y);
  +	 rValid_S5 <= valid;
  +      end
  +   //endrule
  +
  +   // shift second add operand
  +   //rule s6_stage if (fResult_S9.notFull());
  +      begin
  +	 match { .s, .acc, .sub, .sgn, .exp, .shift, .x, .y } = rState_S5;
  +	 let valid = rValid_S5;
  +
  +	 if (s.res matches tagged Invalid) begin
  +	    if (shift < fromInteger(valueOf(m5bits))) begin
  +	       Bit#(m5bits) guard;
  +
  +	       guard = y << (fromInteger(valueOf(m5bits)) - shift);
  +	       y = y >> shift;
  +	       y[0] = y[0] | (|guard);
  +	    end
  +	    else if (|y == 1) begin
  +	       y = 1;
  +	    end
  +	 end
  +
  +	 rState_S6 <= tuple7(s,
  +			     acc,
  +			     sub,
  +			     sgn,
  +			     exp,
  +			     x,
  +			     y);
  +	 rValid_S6 <= valid;
  +      end
  +   //endrule
  +
  +   // add/subtract sfd
  +   //rule s7_stage if (fResult_S9.notFull());
  +      begin
  +	 match { .s, .acc, .sub, .sgn, .exp, .x, .y } = rState_S6;
  +	 let valid = rValid_S6;
  +
  +	 let sum = x + y;
  +	 let diff = x - y;
  +
  +	 rState_S7 <= tuple7(s,
  +			     acc,
  +			     sub,
  +			     sgn,
  +			     exp,
  +			     sum,
  +			     diff);
  +	 rValid_S7 <= valid;
  +      end
  +   //endrule
  +
      // normalize addition result
  -   rule s8_stage;
  -      match { .s, .acc, .sub, .sgn, .exp, .sum, .diff } = rState_S7;
  -      let valid = rValid_S7;
  -
  -      FloatingPoint#(e,m) out = defaultValue;
  -      Bit#(2) guard = 0;
  -
  -      if (s.res matches tagged Invalid) begin
  -	 Bit#(m5bits) sfd;
  -
  -	 sfd = sub ? diff : sum;
  -
  -	 out.sign = sgn;
  -	 out.exp = cExtend(exp + fromInteger(bias(out)));
  -
  -	 let y = normalize(out, sfd);
  -	 out = tpl_1(y);
  -	 guard = tpl_2(y);
  -	 s.exc = s.exc | tpl_3(y);
  -      end
  -
  -      rState_S8 <= tuple5(s,
  -			  acc,
  -			  out,
  -			  guard,
  -			  sub);
  -      rValid_S8 <= valid;
  -   endrule
  -
  -   FIFO#(Bool) tokenFifo <- mkSizedFIFO(9);
  -   FIFO#(Tuple2#(FloatingPoint#(e,m),Exception)) fResult_S9 <- mkSizedFIFO(9);
  +   //rule s8_stage if (fResult_S9.notFull());
  +      begin
  +	 match { .s, .acc, .sub, .sgn, .exp, .sum, .diff } = rState_S7;
  +	 let valid = rValid_S7;
  +
  +	 FloatingPoint#(e,m) out = defaultValue;
  +	 Bit#(2) guard = 0;
  +
  +	 if (s.res matches tagged Invalid) begin
  +	    Bit#(m5bits) sfd;
  +
  +	    sfd = sub ? diff : sum;
  +
  +	    out.sign = sgn;
  +	    out.exp = cExtend(exp + fromInteger(bias(out)));
  +
  +	    let y = normalize(out, sfd);
  +	    out = tpl_1(y);
  +	    guard = tpl_2(y);
  +	    s.exc = s.exc | tpl_3(y);
  +	 end
  +
  +	 rState_S8 <= tuple5(s,
  +			     acc,
  +			     out,
  +			     guard,
  +			     sub);
  +	 rValid_S8 <= valid;
  +      end
  +   //endrule
   
      // round result
  -   rule s9_stage;
  -      match { .s, .acc, .out, .guard, .sub } = rState_S8;
  -      let valid = rValid_S8;
  -
  -      if (s.res matches tagged Valid .x) begin
  -	 out = x;
  -      end
  -      else begin
  -	 let y = round(rmode, out, guard);
  -	 out = tpl_1(y);
  -	 s.exc = s.exc | tpl_2(y);
  -
  -	 // adjust sign for exact zero result
  -	 if (acc && isZero(out) && !s.exc.inexact && sub) begin
  -	    out.sign = (rmode == Rnd_Minus_Inf);
  -	 end
  -      end
  -
  -      if (valid)
  -	 fResult_S9.enq(tuple2(out,s.exc));
  +   //rule s9_stage if (fResult_S9.notFull());
  +      begin
  +	 match { .s, .acc, .out, .guard, .sub } = rState_S8;
  +	 let valid = rValid_S8;
  +
  +	 if (s.res matches tagged Valid .x) begin
  +	    out = x;
  +	 end
  +	 else begin
  +	    let y = round(rmode, out, guard);
  +	    out = tpl_1(y);
  +	    s.exc = s.exc | tpl_2(y);
  +
  +	    // adjust sign for exact zero result
  +	    if (acc && isZero(out) && !s.exc.inexact && sub) begin
  +	       out.sign = (rmode == Rnd_Minus_Inf);
  +	    end
  +	 end
  +
  +	 if (valid)
  +	    fResult_S9.enq(tuple2(out,s.exc));
  +      end
      endrule
   
      interface Put request;
      method Action put(Tuple3#(Maybe#(FloatingPoint#(e,m)),FloatingPoint#(e,m),FloatingPoint#(e,m)) req);
  -      wValid_S0 <= True;
  -      wOperand_S0 <= req;
  -      tokenFifo.enq(True);
  +      fOperand_S0.enq(req);
      endmethod
      endinterface
      interface Get response;
         method ActionValue#(Tuple2#(FloatingPoint#(e,m),Exception)) get();
  -	 tokenFifo.deq();
  -	 fResult_S9.deq();
  -	 return fResult_S9.first();
  +	 let resp <- toGet(fResult_S9).get();
  +	 return resp;
         endmethod
      endinterface
   endmodule
  
positive.code: 		 Bit#(2))) rState_S4 <- mkReg(unpack(0));
     Reg#(Bool) rValid_S4 <- mkReg(False);
  
     // normalize multiplication result
     rule s4_stage;
        match { .s, .acc, .opA, .sgnBC, .expBC } <- toGet(rState_S3).get;
        let valid = rValid_S3;
  
        let sfdBC = pack(rProd_S3);
        
        FloatingPoint#(e,m) bc = defaultValue;
        Bit#(2) guardBC = ?;
  
        if (s.res matches tagged Invalid) begin
  	 if (expBC > fromInteger(maxexp(bc))) begin
  	    bc.sign = sgnBC;
  	    bc.exp = maxBound - 1;
  	    bc.sfd = maxBound;
  	    guardBC = '1;
  
  	    s.exc.overflow = True;
  	    s.exc.inexact = True;
  	 end
  	 else if (expBC < (fromInteger(minexp_subnormal(bc))-2)) begin
  	    bc.sign = sgnBC;
  	    bc.exp = 0;
  	    bc.sfd = 0;
  	    guardBC = 0;
  
  	    if (|sfdBC == 1) begin
  	       guardBC = 1;
  	       s.exc.underflow = True;
  	       s.exc.inexact = True;
  	    end
  	 end
  	 else begin
  	    let shift = fromInteger(minexp(bc)) - expBC;
  	    if (shift > 0) begin
  	       // subnormal
  	       Bit#(1) sfdlsb = |(sfdBC << (fromInteger(valueOf(mmbits)) - shift));
  
  	       sfdBC = sfdBC >> shift;
  	       sfdBC[0] = sfdBC[0] | sfdlsb;
  
  	       bc.exp = 0;
  	    end
  	    else begin
  	       bc.exp = cExtend(expBC + fromInteger(bias(bc)));
  	    end
  
  	    bc.sign = sgnBC;
  	    let y = normalize(bc, sfdBC);
  	    bc = tpl_1(y);
  	    guardBC = tpl_2(y);
  	    s.exc = s.exc | tpl_3(y);
  	 end
        end
  
        rState_S4 <= tuple5(s,
  			  acc,
  			  opA,
  			  bc,
  			  guardBC);
        rValid_S4 <= valid;
     endrule
  
     Reg#(Tuple8#(CommonState#(e,m),
  		Bool,
  		Bool,
  
negative.code:    Reg#(Bool) rValid_S2 <- mkReg(False);
     Reg#(UInt#(mmbits)) rProd_S2lsb <- mkReg(0);
     Reg#(UInt#(mmbits)) rProd_S2msb <- mkReg(0);
  
     Reg#(Tuple5#(CommonState#(e,m),
        Bool,
  