hdl_registers.parser package
Submodules
hdl_registers.parser.json module
- hdl_registers.parser.json.from_json(name: str, json_file: Path, default_registers: list[Register] | None = None) RegisterList
Parse a JSON file with register data.
- Parameters:
name – The name of the register list.
json_file – The JSON file path.
default_registers – List of default registers.
- Returns:
The resulting register list.
hdl_registers.parser.parser module
- class hdl_registers.parser.parser.RegisterParser(name: str, source_definition_file: Path, default_registers: list[Register] | None = None)
Bases:
object
- __init__(name: str, source_definition_file: Path, default_registers: list[Register] | None = None)
- Parameters:
name – The name of the register list.
source_definition_file – The source file that defined this register list. Will be displayed in generated source code and documentation for traceability.
default_registers – List of default registers. Note that this list with
Register
objects will be deep copied, so you can use the same list many times without worrying about mutability.
- default_register_array_items = {'array_length', 'description', 'type'}
- default_register_items = {'description', 'mode', 'type'}
- parse(register_data: dict[str, Any]) RegisterList
Parse the register data.
- Parameters:
register_data – Register data as a dictionary.
- Returns:
The resulting register list.
- recognized_bit_items = {'default_value', 'description', 'type'}
- recognized_bit_vector_items = {'default_value', 'description', 'type', 'width'}
- recognized_constant_items = {'data_type', 'description', 'type', 'value'}
- recognized_enumeration_items = {'default_value', 'description', 'element', 'type'}
- recognized_integer_items = {'default_value', 'description', 'max_value', 'min_value', 'type'}
- required_bit_vector_items = ['width']
- required_constant_items = ['value']
- required_enumeration_items = ['element']
- required_integer_items = ['max_value']
- required_register_array_items = ['array_length']
hdl_registers.parser.toml module
- hdl_registers.parser.toml.from_toml(name: str, toml_file: Path, default_registers: list[Register] | None = None) RegisterList
Parse a TOML file with register data.
- Parameters:
name – The name of the register list.
toml_file – The TOML file path.
default_registers – List of default registers.
- Returns:
The resulting register list.
hdl_registers.parser.yaml module
- hdl_registers.parser.yaml.from_yaml(name: str, yaml_file: Path, default_registers: list[Register] | None = None) RegisterList
Parse a YAML file with register data.
- Parameters:
name – The name of the register list.
yaml_file – The YAML file path.
default_registers – List of default registers.
- Returns:
The resulting register list.