Hello,
You might be interested in the evaluation core of VSyml [1], which is
not Mathematica-based.
The module DesignEval rewrites and evaluates function trees whose
types are defined in the module DesignTypes. However, this project
aims at symbolically simulate VHDL code, (by mixing immediate values
and variables - denoted at symbols - in expression trees) and
therefore it might be a little bit oversized for your needs. The
boolean rewrite rules are quite efficient although the arithmetic
rewriting rules might need some rework for corner cases.
Here is an example of how to invoke the evaluator:
(* make all && cd build/byte && ocaml *)
#load "nums.cma";;
#load "Resources.cmo";;
#load "OCamlUtils.cmo";;
#load "DesignTypes.cmo";;
#load "DesignStandardTypes.cmo";;
#load "DesignUtils.cmo";;
#load "DesignAttributes.cmo";;
#load "DesignLogic.cmo";;
#load "DesignSolver.cmo";;
#load "DesignEval.cmo";;
open DesignStandardTypes;; (* for boolean type definition *)
open DesignTypes;; (* for formula types *)
open DesignEval;; (* for evaluator definitions *)
let a_symbol = FormulaSymbol {symboltype=vhdl_boolean_type;symbolname="a"};;
let b_symbol = FormulaSymbol {symboltype=vhdl_boolean_type;symbolname="b"};;
let or_formula = FormulaAssociativeOperator (OperatorAssociativeOr,
[a_symbol;b_symbol]);;
let formula = FormulaAssociativeOperator
(OperatorAssociativeAnd,[a_symbol;or_formula]);;
designeval_formula formula default_struct_context default_eval_context;;
--> returns a_symbol
The syntax is /a little bit/ verbose, but that's required to evaluate
complex VHDL expression. It supports associative and/unary
and/or/nand/nor/xor/xnor/unary -/-/+/*/// and many others...
Best Regards,
- Florent Ouchet
[1] http://users-tima.imag.fr/vds/ouchet/vsyml.html
--
Florent Ouchet
PhD Student, CIS/VDS Groups
TIMA Laboratory, Grenoble, France
_______________________________________________
Caml-list mailing list. Subscription management:
http://yquem.inria.fr/cgi-bin/mailman/listinfo/caml-list
Archives: http://caml.inria.fr
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
Bug reports: http://caml.inria.fr/bin/caml-bugs