History log of /seL4-l4v-master/HOL4/examples/dev/vsynth.sml
Revision Date Author Comments
# 4888f523 15-Oct-2017 Michael Norrish <Michael.Norrish@nicta.com.au>

Remove eqtype declaration for term type


# 97475109 27-Jul-2012 Michael Norrish <michael.norrish@nicta.com.au>

Remove trailing whitespace in examples directory.


# 6acdb5d3 11-Jun-2012 Konrad Slind <konrad.slind@gmail.com>

Updating h/w synthesis stuff so that it works again.


# 4761143b 10-Aug-2009 Tjark Weber <Tjark.Weber@cl.cam.ac.uk>

Removed trailing whitespace from all .sml and .sig files.

This affects over 900 files and was done using emacs's delete-trailing-whitespace
function in batch mode. Building the system with Poly/ML and Moscow ML seems to
work, so I'm hoping these changes don't break anything. Please complain if
they do!


# 927035f4 12-May-2008 Anthony Fox <anthony.fox@cl.cam.ac.uk>

Updated Juliano's hardware compilation to work with wordsTheory. There are
now some nasty parser warnings with "===>", "<>" and possibly others.

The dev/booth example was/is broken (I haven't attempted to repair it).

Have updated dev/AES/word8 and Crypto/AES. Perhaps dev/AES should be removed?

The hardware compilation for Crypto/TEA and Crypto/RC6 are now broken.
Updating the Crypto examples should be straightforward. Once done I can
delete src/n_bit.


# 93dd4003 15-May-2006 Mike Gordon <mjcg@cl.cam.ac.uk>

Improve synthesis for conditionals.


# ff8cde34 28-Mar-2006 Juliano Iyoda <jmi27@cam.ac.uk>

Updated dest_word_type, is_word_type and var2size to accept wordsTheory


# f3dbf04d 14-Feb-2006 Juliano Iyoda <jmi27@cam.ac.uk>

Changed is_CONSTANT and dest_CONSTANT in vsynth.sml to deal with CONSTANT F and CONSTANT T (booth multiplier example)


# c6db42fa 14-Feb-2006 Mike Gordon <mjcg@cl.cam.ac.uk>

Fixed bug in printing of comments preceding existentially quantified
Dtypes in Verilog.


# 983728fe 13-Feb-2006 Mike Gordon <mjcg@cl.cam.ac.uk>

Changed name of Verilog module from DTYPE to dtype
(looks nicer) and fixed minor typos in generated comments.


# c6a4a25f 13-Feb-2006 Mike Gordon <mjcg@cl.cam.ac.uk>

Juliano's experiments show that Altera FPGAs initialise faster if Verilog is
generated with registers as instances of a separate module than if we generate
an inlined behavioral statement always @(posedge clk) q <= d driving
a register q initialised by reg q = 1.


# ae1771db 09-Feb-2006 Mike Gordon <mjcg@cl.cam.ac.uk>

Deleted code for generating separate modules for each component.


# b4b48c89 09-Feb-2006 Mike Gordon <mjcg@cl.cam.ac.uk>

For visual sanity checking have added printing of HOL source as a
comment in the Verilog, e.g.:

/*
COMB
(\((sw :bool),(in1 :word32),(in2 :word32)). (if sw then in1 else in2))
((v15 :num -> bool) <> (v12 :num -> word32) <> (v0 :num -> word32),
(v3 :num -> word32))
*/
assign v3 = v15 ? v12 : v0;

/*
?(v :word32).
DTYPE v ((clk :num -> bool),(v9 :num -> word32),(v30 :num -> word32))
*/
always @(posedge clk) v30 <= v9;

Note: only have one Dtype register now, defined by:

|- !v ck d q. DTYPE v (ck,d,q) = (q 0 = v) /\ Dtype (ck,d,q)

Sometimes the initial state doesn't matter for the HOL proofs (as in
example above), but the generated Verilog initialises all registers to 1.


# 41bcddef 09-Feb-2006 Mike Gordon <mjcg@cl.cam.ac.uk>

Initial (probably buggy) release of a new Verilog back end. This
generates "behavioral" rather than "structural" Verilog (i.e. the body
of a generated module consists of continuous assignments and always
statements rather than module instances). I haven't deleted the code
for generating separate module definitions and instances for
components (this is now obsolete and I'll delete it once the new
approach has been validated). There is now a single way of linking
combinational HOL code to Verilog:


(*****************************************************************************)
(* Library associating HOL terms with ML functions for generating *)
(* combinational Verilog. Typical example: *)
(* *)
(* add_vsynth *)
(* [(``\(in1,in2). in1 >> in2``, *)
(* (fn[i1,i2] => ("{{31{" ^ i1 ^ "[31]}}," ^ i1 ^ "} >> " ^i2))), *)
(* (``UNCURRY $>>``, *)
(* (fn[i1,i2] => ("{{31{" ^ i1 ^ "[31]}}," ^ i1 ^ "} >> " ^i2)))] *)
(* *)
(* which will cause both *)
(* *)
(* ``COMB (\(in1,in2). in1 >> in2) (x<>y, z)`` *)
(* *)
(* and *)
(* *)
(* ``COMB (UNCURRY $>>) (x<>y, z)`` *)
(* *)
(* to generate the Verilog statement *)
(* *)
(* assign z = {{31{x[31]}},x} >> y; *)
(*****************************************************************************)

AddBinop can now be defined by:

fun AddBinop (_:string, (hbinop,vbinop)) =
add_vsynth[(hbinop, fn[i1,i2] => (i1 ^ " " ^ vbinop ^ " " ^ i2))];

[Note that a module name isn't needed anymore.]


# d2d9be81 04-Feb-2006 Mike Gordon <mjcg@cl.cam.ac.uk>

Replace

initial q = x;

by

reg q = x;


# 2053bdae 04-Feb-2006 Mike Gordon <mjcg@cl.cam.ac.uk>

Commenting out some rewrites that were (apparently) generating:
CONSTANT (0w,1w,2w,3w)

(* COMB_CONSTANT_1,COMB_CONSTANT_2,COMB_CONSTANT_3, *)

This make break other things. Also various changes to enhance
COMB_SYNTH_CONV which I wrongly thought was the problem, but which
may also break synthesis.


# 86b52901 04-Feb-2006 Mike Gordon <mjcg@cl.cam.ac.uk>

Not sure what changed in compile.sml, but better diagnostics added to
vsynth.sml


# 378d1050 26-Jan-2006 Juliano Iyoda <jmi27@cam.ac.uk>

unimportant changes


# a01df5de 26-Jan-2006 Juliano Iyoda <jmi27@cam.ac.uk>

Added new compiler with whole program compaction optimisation


# 6a618bd4 12-Nov-2005 Konrad Slind <konrad.slind@gmail.com>

Have added an optimized version of MAKE_CIRCUIT, called
NEW_MAKE_CIRCUIT. It should be a drop-in replacement,
although the circuits it returns are not always alpha-convertible
with those of MAKE_CIRCUIT. Please try it out ... it's much
faster (6 secs vs 45 for final call to MAKE_CIRCUIT in
dev/FactScript.sml).


# 0076caa8 01-Aug-2005 Juliano Iyoda <jmi27@cam.ac.uk>

odules AND, OR, NOT and MUX are named devAND, devOR, devNOT and devMUX to avoid name clash with quartus compiler.


# e63dc3ee 07-Jul-2005 Konrad Slind <konrad.slind@gmail.com>

Optimizations to MAKE_NETLIST. It runs much faster on most examples
now. The optimizations should get moved to MAKE_CIRCUIT as well.


# 70372d5e 30-May-2005 Mike Gordon <mjcg@cl.cam.ac.uk>

Added cirDefine to generate circuits in one step. Tweaked examples.
Updated README.


# 66c59479 23-Apr-2005 Mike Gordon <mjcg@cl.cam.ac.uk>

Bugfix in generated Verilog ("!!" should be "||").


# 9bd3c640 20-Apr-2005 Mike Gordon <mjcg@cl.cam.ac.uk>

The conversion from HOL to Verilog now annotates the HDL with the HOL
source (for eyeball checking, since formal checking is
impossible). This makes the factorial example too big for the vlogger
demo software, so switched to iverilog in Fact.ml.


# 2e3a1bf2 20-Apr-2005 Mike Gordon <mjcg@cl.cam.ac.uk>

Lots of changes aimed at partially automating the adding of new HOL
and Verilog unary and binary operators to synthesis. Read about
AddUnop, AddBinop in README and see how they are used in Fact.ml and
Fact32/Fact32.ml


# 7babd9b8 16-Apr-2005 Mike Gordon <mjcg@cl.cam.ac.uk>

Minor bugfix in vsynth.sml + improved and additional examples.


# a56fa602 16-Apr-2005 Mike Gordon <mjcg@cl.cam.ac.uk>

Small modification to vsynth.sml (added global termToVerilogLib so
that the set of functions to print Verilog can be dynamically
extended).

Added to end of README some documentation of the (currently extremely
tedious) stuff needed to add a new combinational component to the
synthesis engine. Hope to automate this kind of extension in the
future.

Added Fact32/Xor32.ml to illustrate adding 32-bit XOR.


# 87132fce 07-Apr-2005 Mike Gordon <mjcg@cl.cam.ac.uk>

Various tweaks. Added a preliminary very version of the factorial
example that works with values of type ``:word32`` rather than with
``:num``. Needed some messy support for n-bit numerals (``0w``,
``1w``, ``2w``, ... etc).


# 632aa879 06-Apr-2005 Mike Gordon <mjcg@cl.cam.ac.uk>

Types ``:num`` are converted to Verilog wires or registers of width
[31:0], which is not in general valid. When such a conversion occurs,
a warning like:

Warning: type of inp is ``:num``, but is compiled to [31:0].

is printed. These warnings can be suppressed by evaluating:

numWarning := false;

(the ML reference numWarning has a default of true).


# 4a1d3860 06-Apr-2005 Mike Gordon <mjcg@cl.cam.ac.uk>

Added support for VeriLogger (http://www.syncad.com/vlg_form.htm, I
have an old free version). Added comments to Fact.ml example showing
how to change simulator.


# 68ec401a 05-Apr-2005 Mike Gordon <mjcg@cl.cam.ac.uk>

Added support for the Verilog simulator cver and waveform viewer
dinotrace. See README for instructions for installing them (extremely
easy). These are now the defaults, though it is easy to revert to
iverilog and/or gtkwave:

verilog_simulator := iverilog;
waveform_viewer := gtkwave;

(more details in README).

Also made a tweak to paper (not sure what).


# 43b3e740 05-Apr-2005 Mike Gordon <mjcg@cl.cam.ac.uk>

Improved testbench code generated by SIMULATE.

Improved waveform picture in paper.
Fact.ml generates waveform shown.


# f8a3d313 04-Apr-2005 Mike Gordon <mjcg@cl.cam.ac.uk>

Mainly a bugfix for a nested varstruct problem spotted by Konrad
whilst compiling AES.

Also, taking the opportunity to checkin Various other tweaks
(e.g. FlipFlopT/F renamed to DtypeT/F).


# 9f922048 03-Apr-2005 Mike Gordon <mjcg@cl.cam.ac.uk>

Verilog testbench tweak to ensure load driven T after done goes to T for
Factorial example. Will improve further shortly.


# 4369bd23 02-Apr-2005 Juliano Iyoda <jmi27@cam.ac.uk>

Fixed proof of liveness (REC_e_f_g) and updated figures


# 0972198e 29-Mar-2005 Mike Gordon <mjcg@cl.cam.ac.uk>

Minor updates to some comments and default simulation parameters.


# bddb6812 29-Mar-2005 Mike Gordon <mjcg@cl.cam.ac.uk>

Verilog bugfix from Juliano. Factorial example now works!


# ab2332a9 29-Mar-2005 Mike Gordon <mjcg@cl.cam.ac.uk>

Made all registers power up storing 0, except FlipFlopT which powers
up storing 1. This seems to get rid of the x-value problem (but still
not clear if the correct results are being computed)
----------------------------------------------------------------------
----------------------------------------------------------------------


# 93ac2dba 29-Mar-2005 Mike Gordon <mjcg@cl.cam.ac.uk>

Fixed a bug in RecConvert causing looping. Added a check to hwDefine
to print an error message if a recursive definition doesn't have a
measure.


# 6a6d56e8 29-Mar-2005 Mike Gordon <mjcg@cl.cam.ac.uk>

General tidy up, including replacing the odd and ad-hoc definition of
DEL by a more conventional one (and thereby eliminating the need for
REG and REGF). README file has been updated.

Some, but not all, of the "x" value simulation problems have now gone
away.


# 46a7aac9 28-Feb-2005 Mike Gordon <mjcg@cl.cam.ac.uk>

Added SIMULATE (see README) to run Icarus Verilog and then launch GTKWave
from HOL.


# c1c97295 20-Feb-2005 Mike Gordon <mjcg@cl.cam.ac.uk>

Added PRINT_NET_VERILOG and PRINT_NET_SIMULATE to generate
Verilog from unclocked netlists using DEL and DFF.


# 147a8532 18-Feb-2005 Mike Gordon <mjcg@cl.cam.ac.uk>

Corrected some typos and made FactScript.sml dump FACT.vl for testing.


# e2ab0866 19-Feb-2005 Mike Gordon <mjcg@cl.cam.ac.uk>

Simplified the API for generating Verilog and updated README (old
stuff still exists in vsynth.sml). Added Verilog support for =,+,-,<
(need a uniform way of doing this as currently one has to edit
compile.sml, compileScript.sml and vsynth.sml).


# 53b573cc 18-Feb-2005 Mike Gordon <mjcg@cl.cam.ac.uk>

Get printing to Verilog working again.


# 2da3c591 14-Feb-2005 Mike Gordon <mjcg@cl.cam.ac.uk>

First verion of MAKE_VERILOG. See README. Only tested on one example so far.
Has known bugs and is probably very flakey.