Hypex.Register behaviour (Hypex v2.1.0)
View SourceThis module defines the behaviour required by all internal Hypex registers.
There are no requirements for the underlying storage of a register, only that it conforms to this behaviour and provides a correct implementation.
Summary
Callbacks
Retrieve a specific bit from a register.
Initialize an empty 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
Callbacks
Retrieve a specific bit from a register.
@callback init(width :: number()) :: register :: Register.t()
Initialize an empty register of a given width.
The width parameter supplied here will have been pre-validated by the main
Hypex interface. Calls to init/1 should always return a fresh register.
@callback merge(left :: Register.t(), right :: Register.t()) :: Register.t()
Merge together two registers of the same width and type.
@callback put( register :: Register.t(), index :: number(), width :: number(), value :: number() ) :: register :: Register.t()
Set a specific bit in a register.
@callback reduce(register :: Register.t(), width :: number(), acc :: any(), (number(), any() -> any())) :: acc :: any()
Run a reduction over the inner bits of a register.