package hardcaml-llvmsim

  1. Overview
  2. Docs
HardCaml simulation backend using LLVM

Install

Dune Dependency

Authors

Maintainers

Sources

v0.3.0.tar.gz
md5=a0edaf14196ab2cf0e78b5745874c084

Description

Published: 06 Jan 2017

README

Overview

Compiles a circuit to a high speed, native code, cycle accurate simulation model using LLVM.

The simulation models may also be stored to a bitcode file and reloaded.

Usage

The built in ocaml simulator is constructed with;

module Bits = HardCaml.Bits.Comb.IntbitsList
module Sim = HardCaml.Cyclesim.Make(Bits)
let sim = Sim.make circuit

The LLVM based simulator is constructed with;

module Bits = HardCaml.Bits.Ext.Comb.IntbitsList
module Sim = HardCamlLlvmsim.Sim.Make(Bits)
let sim = Sim.make circuit

The resulting types of sim are the same so testbenchs remain the same.

The interface module (Bits) must come from HardCaml.Bits.Ext - these are a strict extension of HardCaml.Bits and are compatible so we can still combine simulators

module Bits = HardCaml.Bits.Ext.Comb.IntbitsList
module Sim1 = HardCaml.Cyclesim.Make(Bits)
module Sim2 = HardCamlLlvmsim.Sim.Make(Bits)
let sim1 = Sim1.make circuit
let sim2 = Sim2.make circuit
let sim = Sim1.combine sim1 sim2

This will run both simulators simultaneously and check that they match exactly.

An Interface based flow is also provided

module Design = struct
  module I = interface ... end
  module O = interface ... end
  let f i = ... logic ...
end

module D = HardcamlLlvmsim.Sim.Gen(Bits)(Design.I)(Design.O)
let circuit, sim, inports, outports = D.make "the_design" Design.f

Dependencies (8)

  1. llvm >= "3.8" & < "15"
  2. ctypes-foreign
  3. ctypes
  4. hardcaml >= "1.2.0" & < "2.0.0"
  5. topkg build
  6. ocamlbuild build
  7. ocamlfind build
  8. ocaml >= "4.02.0"

Dev Dependencies

None

Used by

None

Conflicts

None