Base Configuration Classes

Base classes for chip configuration management.

Base configuration class for TROPIC01 config objects

class tropicsquare.config.base.BaseConfig(value=0xFFFFFFFF)[source]

Bases: object

Base class for all configuration objects.

Configuration objects represent 32-bit hardware registers that control various aspects of TROPIC01 operation. Each config object provides bit-level access to individual configuration fields.

Default value is 0xFFFFFFFF (all bits set) to prevent accidental erasure of I-CONFIG memory, where bits can only be changed from 1 to 0 (irreversible operation).

Parameters:

value (int)

_value

32-bit integer holding the raw configuration value

__init__(value=0xFFFFFFFF)[source]

Initialize config object.

Parameters:

value (int) – 32-bit configuration value (default: 0xFFFFFFFF)

Return type:

None

classmethod from_bytes(data)[source]

Create config object from raw bytes.

Parameters:

data (bytes) – 4 bytes in big-endian format

Returns:

New config object instance

Raises:

ValueError – If data is not exactly 4 bytes

Return type:

BaseConfig

to_bytes()[source]

Convert config object to raw bytes.

Returns:

4 bytes in big-endian format

Return type:

bytes

to_dict()[source]

Export configuration fields as dictionary.

Returns:

Dictionary mapping field names to values

Return type:

dict

Raises:

NotImplementedError – Must be implemented by subclasses

__repr__()[source]

Machine-readable representation.

Return type:

str

__str__()[source]

Human-readable representation.

Default implementation shows class name and hex value. Subclasses should override for more detailed output.

Return type:

str

See Also