Hypex.Register.Tuple (Hypex v2.1.0)

View Source

A Hypex.Register implementation using a Tuple.

Tuples offer quick access and are useful for read-heavy use cases. Due to creation of a new tuple on write, not recommended for frequent writes due to memory churn.

Recommended for read-heavy use cases with widths generally up to 12.

Summary

Functions

Retrieve a specific bit from a register.

Initialize an empty array register of a given width.

Merge together two registers of the same width and type.

Set a specific bit in a register.

Run a reduction over the inner bits of a register.

Types

t()

@type t() :: map()

Functions

get(register, index, width)

@spec get(t(), index :: number(), width :: number()) :: result :: number()

Retrieve a specific bit from a register.

init(width)

@spec init(width :: number()) :: t()

Initialize an empty array register of a given width.

merge(left, right)

@spec merge(t(), t()) :: t()

Merge together two registers of the same width and type.

put(register, index, width, value)

@spec put(t(), index :: number(), width :: number(), value :: number()) :: t()

Set a specific bit in a register.

reduce(register, width, acc, fun)

@spec reduce(t(), width :: number(), accumulator :: any(), (number(), any() -> any())) ::
  accumulator :: any()

Run a reduction over the inner bits of a register.