package hardcaml

  1. Overview
  2. Docs
Legend:
Library
Module
Module type
Parameter
Class
Class type

Parameters

module S : Spec

Signature

type t
val mk : Base.Int.t -> B.t -> t

create a fixed point value. mk f x will have f fractional bits. width x - f will be the number of integer bits

val int : t -> B.t

return the integer part of the value

val frac : t -> B.t

return the fractional part of the value

val signal : t -> B.t

return the underlying bits

val width_int : t -> Base.Int.t

number of integer bits

val width_frac : t -> Base.Int.t

number of fractional bits

val to_float : t -> Base.Float.t

convert fixed point value to a float

val select_int : t -> Base.Int.t -> B.t

select_int f x extracts the integer part, and resizes it to x bits. Bits are dropped from the msb down, if required.

val select_frac : t -> Base.Int.t -> B.t

select_frac f x extracts the fractional part, and resizes it to x bits. Bits are dropped from the lsb up, if required.

val select : t -> Base.Int.t -> Base.Int.t -> t

resizes a fixed type using select_int and select_frac

val norm : t Base.List.t -> t Base.List.t

find largest integer and fractional parts in each fixed value, and resize all elements to that size

val norm2 : t -> t -> t * t

same as norm, but for 2 values

val const : Base.Int.t -> Base.Int.t -> Base.Float.t -> t

create a fixed value with the given number of integer and fractional bits from the floating point value

val (+:) : t -> t -> t

adition

val (-:) : t -> t -> t

subtraction

val (*:) : t -> t -> t

multiplication

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

equality

val (<>:) : t -> t -> B.t

inequality

val (<:) : t -> t -> B.t

less than

val (<=:) : t -> t -> B.t

less than or equal to

val (>:) : t -> t -> B.t

greater than

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

greater than or equal to

val mux : B.t -> t Base.List.t -> t

multiplexor

val resize : t -> Base.Int.t -> Base.Int.t -> t

resize x i f will resize the integer part to have i bits, and fractional part to have f bits. Rounding and overflow control is applied

OCaml

Innovation. Community. Security.