package hardcaml

  1. Overview
  2. Docs
Legend:
Library
Module
Module type
Parameter
Class
Class type
type comb = Signal.t
type t = comb t
val sexp_of_t : comb t -> Sexplib0.Sexp.t
val assert_widths : comb t -> Base.unit

Raise if the widths of t do not match those specified in the interface.

val of_int : Base.int -> comb t

Each field is set to the constant integer value provided.

val const : Base.int -> comb t
  • deprecated [since 2019-11] interface const
val pack : ?rev:Base.bool -> comb t -> comb

Pack interface into a vector.

val unpack : ?rev:Base.bool -> comb -> comb t

Unpack interface from a vector.

val mux : comb -> comb t Base.list -> comb t

Multiplex a list of interfaces.

val mux2 : comb -> comb t -> comb t -> comb t
val concat : comb t Base.list -> comb t

Concatenate a list of interfaces.

val priority_select_with_default : ((comb, comb t) Comb.with_valid2 Base.list -> default:comb t -> comb t) Comb.optional_branching_factor
val widths : t -> Base.int t

Actual bit widths of each field.

val of_ints : Base.int t -> t

consts c sets each field to the integer value in c using the declared field bit width.

val consts : Base.int t -> t
  • deprecated [since 2019-11] interface consts
val wires : ?named:Base.bool -> ?from:t -> Base.unit -> t

Create a wire for each field. If named is true then wires are given the RTL field name. If from is provided the wire is attached to each given field in from.

val reg : ?enable:Signal.t -> Reg_spec.t -> t -> t

Defines a register over values in this interface. enable defaults to vdd.

val pipeline : ?attributes:Rtl_attribute.t Base.list -> ?enable:Signal.t -> n:Base.int -> Reg_spec.t -> t -> t

Defines a register pipeline over values in this interface. enable defaults to vdd and attributes defaults to an empty list.

val assign : t -> t -> Base.unit
val (<==) : t -> t -> Base.unit
val inputs : Base.unit -> t

inputs t is wires () ~named:true.

val outputs : t -> t

outputs t is wires () ~from:t ~named:true.

val apply_names : ?prefix:Base.string -> ?suffix:Base.string -> ?naming_op:(Signal.t -> Base.string -> Signal.t) -> t -> t

Apply name to field of the interface. Add prefix and suffix if specified.

val validate : t -> Base.unit

Checks the port widths of the signals in the interface. Raises if they mismatch.

val (==:) : t -> t -> Signal.t

Tests for equality between two enums. For writing conditional statements based on the value of the enum, consider using match_ below, or Of_always.match_ instead

val of_enum : Enum.t -> Signal.t outer

Create an Enum value from a statically known value.

val of_raw : Signal.t -> Signal.t outer

Creates a Enum value from a raw value. Note that this only performs a check widths, and does not generate circuitry to validate that the input is valid. See documentation on Enums for more information.

val match_ : ?default:Signal.t -> Signal.t outer -> (Enum.t * Signal.t) Base.list -> Signal.t

Multiplex on an enum value. If there are unhandled cases, a default needs to be specified.

val is : t -> Enum.t -> Signal.t

Convenient wrapper around eq x (of_enum Foo)

OCaml

Innovation. Community. Security.