hardcaml-examples provides a small framework for creating HardCaml based cores and six example designs. The framework code provides the general plumbing required to create a console based application with features including code generation, simulation, and waveform viewing. A recent update extends the framework so that cores can be run on a webpage.
WebApp Examples
- Sorting networks
- Linear feedback shift registers
- Wallace and Dadda tree multipliers
- Prefix networks
- ROM-accumulator
- CORDIC
Plugging a design into the framework
A design compatible with the framework should implement the signature given in
HardCamlFramework.Framework.Design
.
A console application can be created as follows
The application should be linked with the hardcaml-framework.console
ocamlfind
library. The following generic options will be available
option | description |
---|---|
-vlog |
generate verilog netlist |
-vhdl |
generate vhdl netlist |
-csim |
generate C simulation model |
-tb | run testbench |
-llvm | use LLVM backend to run testbench |
-vpi | use Icarus Verilog to run testbench |
-checktb | compare ocaml simulation with LLVM/VPI backend |
-interactive | interactive text driven testbench mode |
-vcd |
generate VCD file |
-waveterm | integrated waveform viewer |
-gtkwave | gtkwave waveform viewer |
The remaining options will configure design and testbench parameters.
Webapps
A web based application is created by building two bytecode applications
(linked with hardcaml-framework.js
) and compiling them with js_of_ocaml.
user interface (ie mydesign.js)
webworker (mydesign_ww.js)
To include the application in a html page load the user interface in a script
tag and include a div with id hardcaml-framework-webapp
and a data attribute
called data-hcww
which points to the webworker javascript file. The webapp will
create itself within the div.