1.1.3.1.1.1.2. test_automation.targets.fpga.fpga_controller
1.1.3.1.1.1.2.1. Attributes
1.1.3.1.1.1.2.2. Classes
Structured configuration for an FPGA platform session. |
|
FPGA controller implementing the Device interface. |
1.1.3.1.1.1.2.3. Functions
|
Create an FPGAController instance from a YAML configuration file. |
1.1.3.1.1.1.2.4. Module Contents
- class test_automation.targets.fpga.fpga_controller.FPGAPlatformConfig[source]
Structured configuration for an FPGA platform session.
- Parameters:
platform_name – Logical platform name used for log directory naming.
host – Remote hostname or IP address of the FPGA host.
username – SSH username.
password – Optional SSH password for password or interactive auth.
port – SSH port.
connect_timeout_s – SSH connection/auth timeout in seconds.
ready_timeout_s – Timeout (seconds) for readiness checks.
login_timeout_s – Timeout (seconds) for UART login detection and establishing a shell prompt.
hpc_env_setup – Sequence of shell commands used to set up environment before launching the remote boot command.
remote_cmd – Remote command used to start FPGA boot/run.
remote_payload_path – Optional remote path to upload/extract a payload archive into.
local_payload_path – Optional local archive path to upload to the remote host.
log_dir – Optional override base directory for logs.
log_prefix – Optional override prefix for log directory naming.
- class test_automation.targets.fpga.fpga_controller.FPGAController(cfg)[source]
Bases:
test_automation.utils.device.DeviceFPGA controller implementing the Device interface.
This controller manages the lifecycle of a remote FPGA session over SSH. It is responsible for connecting to the FPGA host, optionally uploading required binaries, launching the configured remote command, monitoring system readiness, handling automated UART login, and exposing runtime state and logs to the test framework.
- Parameters:
cfg (FPGAPlatformConfig)
- init()[source]
Establish an SSH connection to the FPGA host.
- Returns:
None- Raises:
RuntimeError – If SSH connectivity/authentication fails.
- Return type:
None
- start()[source]
Start the FPGA boot workflow and login as root.
This method: - Launches the command in the background on the remote host - Waits for a login prompt on the UART - Sends the root login - Marks the controller as running
- Returns:
None- Raises:
RuntimeError – If not connected or login UART cannot be established.
TimeoutError – If login prompt or shell prompt is not detected within configured timeout.
- Return type:
None
- stop()[source]
Stop the FPGA run and collect logs.
This method attempts to wait briefly for remote command to exit, then downloads the current RUN_DIR logs into:
<CWD>/logs/<platform>_<timestamp>/remote_run_logs/
Finally, it disconnects the SSH session regardless of outcome.
- Returns:
None- Return type:
None
- reset()[source]
Reset the FPGA by stopping and restarting the controller.
This is equivalent to calling
stop(),init(), andstart()in sequence.
- Returns:
None- Return type:
None
- wait_ready(timeout_s=None)[source]
Wait until the FPGA run directory is created.
This method blocks until remote command creates the RUN_DIR on the remote host, indicating that the FPGA boot has progressed far enough to be considered ready.
- Parameters:
timeout_s (Optional[int]) – Maximum time to wait in seconds. If
None, a default timeout is used.- Returns:
None- Return type:
None
- is_running()[source]
Check whether the FPGA controller is currently running.
- Returns:
Trueif the controller is running,Falseotherwise.- Return type:
bool
- get_ports()[source]
Return exposed service ports for the FPGA. FPGA platforms do not currently expose network service ports.
- Returns:
An empty mapping.
- Return type:
Dict[str, int]
- log_path()[source]
Return the primary local boot log path.
- Returns:
Path to the boot log file, or a fallback logs directory if unavailable.
- Return type:
pathlib.Path
- get_run_dir()[source]
Return the remote run directory.
- Returns:
Path to the RUN_DIR on the remote host, or
Noneif unavailable.- Return type:
Optional[str]
- test_automation.targets.fpga.fpga_controller.load_fpga_controller_from_yaml(yaml_path, platform_name, host=None)[source]
Create an FPGAController instance from a YAML configuration file.
- Parameters:
yaml_path (pathlib.Path) – Path to the YAML configuration file.
platform_name (str) – Name of the platform entry to load.
host (Optional[str]) – Optional override host name/IP. If not provided, the YAML platform object’s
hostattribute is used.
- Returns:
Constructed FPGAController instance.
- Raises:
ValueError – If host cannot be resolved.
- Return type: