From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Original-To: caml-list@yquem.inria.fr Delivered-To: caml-list@yquem.inria.fr Received: from mail4-relais-sop.national.inria.fr (mail4-relais-sop.national.inria.fr [192.134.164.105]) by yquem.inria.fr (Postfix) with ESMTP id 891B6BC57 for ; Tue, 7 Sep 2010 11:02:45 +0200 (CEST) X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AkkBACuchUyBWB4FmWdsb2JhbACTR40/AQEBAQEICwoHESK+RYU9BA X-IronPort-AV: E=Sophos;i="4.56,327,1280700000"; d="scan'208";a="68993095" Received: from mx1.imag.fr (HELO shiva.imag.fr) ([129.88.30.5]) by mail4-smtp-sop.national.inria.fr with ESMTP; 07 Sep 2010 11:02:45 +0200 Received: from trottinette.imag.fr (trottinette.imag.fr [129.88.34.202]) by shiva.imag.fr (8.13.8/8.13.8) with ESMTP id o878oT7f028502 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO) for ; Tue, 7 Sep 2010 10:50:29 +0200 Received: from trottinette.imag.fr (localhost.imag.fr [127.0.0.1]) by trottinette.imag.fr (8.13.8/8.13.8/ImagV2.1.feuille) with ESMTP id o8792m2I014520 for ; Tue, 7 Sep 2010 11:02:48 +0200 Received: (from apache@localhost) by trottinette.imag.fr (8.13.8/8.13.8/Submit) id o8792moN014519 for caml-list@yquem.inria.fr; Tue, 7 Sep 2010 11:02:48 +0200 X-Authentication-Warning: trottinette.imag.fr: apache set sender to florent.ouchet@imag.fr using -f Received: from 29-39.80-90.static-ip.oleane.fr (29-39.80-90.static-ip.oleane.fr [90.80.39.29]) by webmail.imag.fr (Horde Framework) with HTTP; Tue, 07 Sep 2010 11:02:48 +0200 Message-ID: <20100907110248.20693ho3t9uc5uwo@webmail.imag.fr> Date: Tue, 07 Sep 2010 11:02:48 +0200 From: Florent Ouchet To: caml-list@yquem.inria.fr Subject: Re: [Caml-list] interfacing Ocaml with Mathematica References: <4C811912.8000106@cs.bham.ac.uk> In-Reply-To: <4C811912.8000106@cs.bham.ac.uk> MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; DelSp="Yes"; format="flowed" Content-Disposition: inline Content-Transfer-Encoding: 7bit User-Agent: Internet Messaging Program (IMP) H3 (4.3.6) X-MI2S-Agent: webmail 3.3.6 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.0.1 (shiva.imag.fr [129.88.30.5]); Tue, 07 Sep 2010 10:50:29 +0200 (CEST) X-IMAG-MailScanner-Information: Please contact MI2S MIM for more information X-MailScanner-ID: o878oT7f028502 X-IMAG-MailScanner: Found to be clean X-IMAG-MailScanner-SpamCheck: X-IMAG-MailScanner-From: florent.ouchet@imag.fr MailScanner-NULL-Check: 1284454233.39299@yP6H1GHo90J1PMGdC8uevA X-Spam: no; 0.00; interfacing:01 ocaml:01 rewrites:01 simulate:01 rewriting:01 rework:01 byte:01 ocaml:01 cmo:01 cmo:01 struct:01 syntax:01 verbose:01 associative:01 tima:01 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