hdl_registers.generator.cpp package

Submodules

hdl_registers.generator.cpp.cpp_generator_common module

class hdl_registers.generator.cpp.cpp_generator_common.CppGeneratorCommon(register_list: RegisterList, output_folder: Path)

Bases: RegisterCodeGenerator

Class with common methods for generating C++ code.

COMMENT_START: str = '//'
__init__(register_list: RegisterList, output_folder: Path)
Parameters:
  • register_list – Registers and constants from this register list will be included in the generated artifacts.

  • output_folder – Result file will be placed in this folder.

hdl_registers.generator.cpp.header module

class hdl_registers.generator.cpp.header.CppHeaderGenerator(register_list: RegisterList, output_folder: Path)

Bases: CppGeneratorCommon

Generate a C++ class header. See the C++ code generator article for usage details.

The class header will contain:

  • for each register, signature of getter and setter methods for reading/writing the register as an uint.

  • for each field in each register, signature of getter and setter methods for reading/writing the field as its native type (enumeration, positive/negative int, etc.).

    • The setter will read-modify-write the register to update only the specified field, depending on the mode of the register.

DEFAULT_INDENTATION_LEVEL: int = 4
SHORT_DESCRIPTION = 'C++ header'
get_code(**kwargs: Any) str

Get a complete C++ class header with methods for accessing registers and fields.

property output_file: Path

Result will be placed in this file.

hdl_registers.generator.cpp.implementation module

class hdl_registers.generator.cpp.implementation.CppImplementationGenerator(register_list: RegisterList, output_folder: Path)

Bases: CppGeneratorCommon

Generate a C++ class implementation. See the C++ code generator article for usage details.

The class implementation will contain:

  • for each register, implementation of getter and setter methods for reading/writing the register as an uint.

  • for each field in each register, implementation of getter and setter methods for reading/writing the field as its native type (enumeration, positive/negative int, etc.).

    • The setter will read-modify-write the register to update only the specified field, depending on the mode of the register.

DEFAULT_INDENTATION_LEVEL: int = 4
SHORT_DESCRIPTION = 'C++ implementation'
get_code(**kwargs: Any) str

Get a complete C++ class implementation with all methods.

property output_file: Path

Result will be placed in this file.

hdl_registers.generator.cpp.interface module

class hdl_registers.generator.cpp.interface.CppInterfaceGenerator(register_list: RegisterList, output_folder: Path)

Bases: CppGeneratorCommon

Generate a C++ interface header, suitable for mocking in a unit test environment. See the C++ code generator article for usage details.

The interface header will contain:

  • Attribute constants for each register and field, such as width, default value, etc.

  • Enumeration types for all Enumeration fields.

  • Constant values for all register constants.

  • for each register, signature of getter and setter methods for reading/writing the register as an uint.

  • for each field in each register, signature of getter and setter methods for reading/writing the field as its native type (enumeration, positive/negative int, etc.).

    • The setter will read-modify-write the register to update only the specified field, depending on the mode of the register.

DEFAULT_INDENTATION_LEVEL: int = 4
SHORT_DESCRIPTION = 'C++ interface header'
get_code(**kwargs: Any) str

Get a complete C++ interface header with constants, types, attributes and methods for accessing registers and fields.

property output_file: Path

Result will be placed in this file.

hdl_registers.generator.cpp.reserved_keywords module