package hardcaml-llvmsim

  1. Overview
  2. Docs
HardCaml simulation backend using LLVM

Install

Dune Dependency

Authors

Maintainers

Sources

v0.3.0.tar.gz
sha256=fe4c0a858925a5dd2fd1a95f471cc7eb60d6111f0edb325e086a3524b891ea12
md5=a0edaf14196ab2cf0e78b5745874c084

README.md.html

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
OCaml

Innovation. Community. Security.