Beispiel #1
0
        /// <summary>
        /// Add controller code for output/memory variable 'var'
        /// </summary>
        /// <param name="ctx"></param>
        /// <param name="solver"></param>
        /// <param name="variable"></param>
        protected override void AddController(Microsoft.Z3.Context ctx, Microsoft.Z3.Solver solver, string varName)
        {
            FixedPointNumber     var    = discreteVariablesByName[varName];
            FixedPointNumber     expr   = assigns[varName];
            BoolExprWithOverflow assert = ctx.MkFPEq(var, expr);

            solver.Assert(assert.bv);
        }
Beispiel #2
0
        static public FixedPointNumber MkFPITE(this Context ctx, BoolExprWithOverflow test, FixedPointNumber A, FixedPointNumber B)
        {
            Contract.Requires(A != null);
            Contract.Requires(B != null);
            Contract.Requires(A.bits == B.bits);
            Contract.Requires(A.decimals == B.decimals);
            var overflow = ctx.MkOr(test.overflow, A.overflow, B.overflow);

            return(new FixedPointNumber(A.bits, A.decimals, (BitVecExpr)ctx.MkITE(test.bv, A.bv, B.bv), overflow, String.Format("ITE({0},{1},{2})", test.Expr, A.Expr, B.Expr)));
        }