::std::

Module conv

Expand

Conversions between types

This module implements various conversions between types in the language. Most conversions are done using to_xx or as_xx methods on the source types.

to_xx()

to_xx is used for conversions that preserve the underlying value. For example, casting an unsigned integer to a signed integer requires adding an additional bit to ensure the original value is still representable. Therefore uint::to_int outputs a value with one more bit than the input.

as_xx()

as_xx on the other hand is used to re-interpret the original bits as a value of the new type. uint::as_int when used on a value which does not fit in in an integer of the same size results in a negative number.

Functions

bits_to_int

Casts a an array of bool to a signed integer by reinterpreting its bits.

bits_to_uint

Casts an array of bool to an unsigned integer by reinterpreting its bits.

concat_arrays

Creates an array by concatenating the elements of two existing ones.

flip_array

Reverses the elements of an array.

int_to_bits

Casts a signed integer to an array of bool by reinterpreting its bits.

int_to_uint

Casts a signed integer to an unsigned integer by reinterpreting its bits.

tri_to_bool

Casts a tri to a bool by reinterpreting its bit.

uint_to_bits

Casts an unsigned integer to an array of bool by reinterpreting its bits.

uint_to_int

Casts an unsigned integer to a signed integer by reinterpreting its bits.

Entities

bool_to_clock

Casts a bool to a clock signal by reinterpreting its bit.

clock_to_bool

Casts a clock signal to a bool by reinterpreting its bit.