hdl_registers.constant package

Submodules

hdl_registers.constant.bit_vector_constant module

class hdl_registers.constant.bit_vector_constant.BitVectorConstant(name: str, value: str, description: str | None = None)

Bases: Constant

__init__(name: str, value: str, description: str | None = None)
Parameters:
  • name – The name of the constant.

  • value – The constant value. Must start with “0b” or “0x”. Must only contain legal binary or hexadecimal characters. Underscore may be used as a separator.

  • description – Textual description for the constant.

allowed_binary_characters = '01_'
allowed_hexadecimal_characters = '0123456789abcdefABCDEF_'
property is_hexadecimal_not_binary: bool

Getter for is_hexadecimal_not_binary.

property prefix: str

Getter for prefix.

separator_character = '_'
property value: str

Getter for value.

property value_without_separator: str

Getter for value, without any separator characters.

property width: int

The number of bits this vector constant occupies.

class hdl_registers.constant.bit_vector_constant.UnsignedVector

Bases: str

Represent a value that is of type unsigned vector (as opposed to a register constant of the same type, which would use the UnsignedVectorConstant class).

class hdl_registers.constant.bit_vector_constant.UnsignedVectorConstant(name: str, value: str, description: str | None = None)

Bases: BitVectorConstant

Represent a register constant that is of type unsigned vector (as opposed to a plain value of the same type in Python, which would use the UnsignedVector class).

hdl_registers.constant.boolean_constant module

class hdl_registers.constant.boolean_constant.BooleanConstant(name: str, value: bool, description: str | None = None)

Bases: Constant

__init__(name: str, value: bool, description: str | None = None)
Parameters:
  • name – The name of the constant.

  • value – The constant value.

  • description – Textual description for the constant.

property value: bool

Getter for value.

hdl_registers.constant.constant module

class hdl_registers.constant.constant.Constant

Bases: ABC

Meta class for all register constants (integer, boolean, …). Lists a few properties that must be available.

description: str
name: str
abstract property value: Any

The value of the constant. Return type depends on the subclass.

hdl_registers.constant.float_constant module

class hdl_registers.constant.float_constant.FloatConstant(name: str, value: float, description: str | None = None)

Bases: Constant

Represent a floating-point constant.

Note

The value is stored with its native representation, which is a Python float if a decimal value is provided. The Python float type is a double-precision value, so the precision in Python matches the precision in C/C++/VHDL generators.

__init__(name: str, value: float, description: str | None = None)
Parameters:
  • name – The name of the constant.

  • value – The constant value.

  • description – Textual description for the constant.

property value: float

Getter for value.

hdl_registers.constant.integer_constant module

class hdl_registers.constant.integer_constant.IntegerConstant(name: str, value: int, description: str | None = None)

Bases: Constant

__init__(name: str, value: int, description: str | None = None)
Parameters:
  • name – The name of the constant.

  • value – The constant value.

  • description – Textual description for the constant.

property value: int

Getter for value.

hdl_registers.constant.string_constant module

class hdl_registers.constant.string_constant.StringConstant(name: str, value: str, description: str | None = None)

Bases: Constant

__init__(name: str, value: str, description: str | None = None)
Parameters:
  • name – The name of the constant.

  • value – The constant value.

  • description – Textual description for the constant.

property value: str

Getter for value.