hardcaml

RTL Hardware Design in OCaml
Legend:
Library
Module
Module type
Parameter
Class
Class type
Library hardcaml
Module Hardcaml . Always
module Variable : sig ... end

The type of variables in guarded assignments. Variables may be asychronous wires, or synchronous regs. The current value of the variable may be accessed through the value field below.

type t = private
| Assign of Variable.t * Signal.t
| If of Signal.t * t Base.list * t Base.list
| Switch of Signal.t * (Signal.t * t Base.list) Base.list
val sexp_of_t : t -> Sexplib0.Sexp.t
type always = t
type 'a case = 'a * t Base.list
type 'a cases = 'a case Base.list
val if_ : Signal.t -> t Base.list -> t Base.list -> t

if statement

val elif : Signal.t -> t Base.list -> t Base.list -> t Base.list

else if branch

val when_ : Signal.t -> t Base.list -> t

if sel then ... else

val unless : Signal.t -> t Base.list -> t

if sel then else ...

val switch : Signal.t -> Signal.t cases -> t

switch statement

val proc : t Base.list -> t

Allows sequences of expressions to be inserted into the code; a syntactic nicety.

val (<--) : Variable.t -> Signal.t -> t

assignment

val (<--.) : Variable.t -> Base.int -> t

assignment with an integer constant - width is inferred

module State_machine : sig ... end
val compile : t Base.list -> Base.unit

compile to structural code