caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: Florent Ouchet <florent.ouchet@imag.fr>
To: caml-list@yquem.inria.fr
Subject: Re: [Caml-list] interfacing Ocaml with Mathematica
Date: Tue, 07 Sep 2010 11:02:48 +0200	[thread overview]
Message-ID: <20100907110248.20693ho3t9uc5uwo@webmail.imag.fr> (raw)
In-Reply-To: <4C811912.8000106@cs.bham.ac.uk>

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


  parent reply	other threads:[~2010-09-07  9:02 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-09-03 15:49 zaid al-zobaidi
2010-09-07  4:36 ` [Caml-list] " Basile Starynkevitch
2010-09-07  9:02 ` Florent Ouchet [this message]
2010-09-10 12:54 ` Frederic Chyzak

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20100907110248.20693ho3t9uc5uwo@webmail.imag.fr \
    --to=florent.ouchet@imag.fr \
    --cc=caml-list@yquem.inria.fr \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).