Hardcaml.ConstantSourceRepresentation of variable width Constants and conversion to/from OCaml types.
create n create a n bit constant, initialized to hold all 0s.
Bit width of constant
Convert a constant to a string of '1' and '0' chars.
Same as to_binary_string but adds '_'s every chars
Convert constant to an int. Bits above Int.num_bits are dropped.
Convert constant to an int32. Bits above Int32.num_bits are dropped.
Convert constant to an int64. Bits above Int64.num_bits are dropped.
Convert to array of int64s
Convert to a hex encoded string.
Convert a string containing '1' and '0' characters to a constant. Width is inferred from the strings length.
Same as of_binary_string but allow '_' chars
Create a constant from the given int value.
Create a constant from the given int32 value
Create a constant from the given int64 value
Create from an array of int64s
Convert from an arbitrary precision integer.
Create from a hex encoded string.
Utility conversion functions to/from hex chars
Create constant conversion functions from lists of some inner Bit.t type.
Return the underlying Bytes.t representation of the constant. We label as unsafe as the output bytes are not copied. Mutating them should be done with care.
Construct a constant from the given Bytes.t. We label as unsafe as the input bytes are not copied. Mutating them should be done with care.
The length of the given Bytes.t must be rounded up to 64 bits and be the correct size of fit width bits or an exception is raised.