hdl_registers.generator.python package

Submodules

hdl_registers.generator.python.pickle module

class hdl_registers.generator.python.pickle.PythonPickleGenerator(register_list: RegisterList, output_folder: Path)

Bases: RegisterCodeGenerator

Generate a Python pickle of the RegisterList object, along with a Python module to re-create the pickle in a simple way.

See the Python code generator article for usage details.

COMMENT_START: str = '#'
SHORT_DESCRIPTION = 'Python pickle'
__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.

create(**kwargs: Any) Path

Create the binary pickle also, apart from the class file.

Note that this is a little bit hacky, preferably each generator should produce only one file.

get_code(**kwargs: Any) str

Save register list object to binary file (pickle) and create a python class that recreates it.

property output_file: Path

Result will be placed in this file.

property should_create: bool

Since this generator creates two files, where on is binary, it is impossible to do the version/hash check. Hence, set it to “always create”. The mechanism “create if needed” should not be used for this generator anyway, since this generator is not designed to run in real-time like e.g. the VHDL generator.

hdl_registers.generator.python.reserved_keywords module