Module type Make.Fixed
fixed point API
module B : sig ... end
val mk : Hardcaml__.Import.int -> B.t -> t
create a fixed point value.
mk f x
will havef
fractional bits.width x - f
will be the number of integer bits
val width_int : t -> Hardcaml__.Import.int
number of integer bits
val width_frac : t -> Hardcaml__.Import.int
number of fractional bits
val to_float : t -> Hardcaml__.Import.float
convert fixed point value to a float
val select_int : t -> Hardcaml__.Import.int -> 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 -> Hardcaml__.Import.int -> 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 -> Hardcaml__.Import.int -> Hardcaml__.Import.int -> t
resizes a fixed type using select_int and select_frac
val norm : t Hardcaml__.Import.list -> t Hardcaml__.Import.list
find largest integer and fractional parts in each fixed value, and resize all elements to that size
val const : Hardcaml__.Import.int -> Hardcaml__.Import.int -> Hardcaml__.Import.float -> t
create a fixed value with the given number of integer and fractional bits from the floating point value
val mux : B.t -> t Hardcaml__.Import.list -> t
multiplexor
val resize : t -> Hardcaml__.Import.int -> Hardcaml__.Import.int -> t
resize x i f
will resize the integer part to havei
bits, and fractional part to havef
bits. Rounding and overflow control is applied