XiBIF Base Classes

class XibifProject(project_folder: XibifPath = XibifPath('.'))

Class representing a XiBIF project, responsible for managing the project configuration and providing methods to read and write the configuration to a file.

property board: XilinxBoard

Get the target FPGA board from the project configuration.

Returns:

XilinxBoard – The target FPGA board from the project configuration.

property checksum: XibifChecksum

Calculate and return the checksum of the current project configuration.

Returns:

XibifChecksum – The checksum of the current project configuration.

property checksum_saved: XibifChecksum

Get the checksum of the project configuration as saved in the project file.

Returns:

XibifChecksum – The checksum of the project configuration as saved in the project file.

load_config() None

Load the project configuration from a JSON file at the specified project path.

property name: str

Get the name of the project from the project configuration.

Returns:

str – The name of the project from the project configuration.

property path: XibifPath

Get the path to the project configuration file.

Returns:

XibifPath – The path to the project configuration file.

property register: XibifRegister

Get the register configuration from the project configuration.

Returns:

XibifRegister – The register configuration from the project configuration.

property settings: XibifSettings

Get the settings from the project configuration.

Returns:

XibifSettings – The settings from the project configuration.

property tooling: XibifTooling

Get the tooling configuration from the project configuration.

Returns:

XibifTooling – The tooling configuration from the project configuration.

property uuid: XibifUUID

Get the UUID of the project from the project configuration.

Returns:

XibifUUID – The UUID of the project from the project configuration.

property version: XibifVersion

Get the version of the xibif tool from the project configuration.

Returns:

XibifVersion – The version of the xibif tool from the project configuration.

property vitis_path_check: XibifPath

Get the path to check for the Vitis project folder.

Returns:

XibifPath – The path to check for the Vitis project folder.

write_config() None

Write the current project configuration to a JSON file at the specified project path.

class XibifDefaults

Class to hold default values for various parameters used in XiBIF.

APP_NAME: ClassVar[str] = 'xibif'
BACKUP_FOLDER: ClassVar[XibifPath] = XibifPath('backup')
BLOCKDESIGN_NAME: ClassVar[str] = 'xibif_bd'
CONSTRAINT_FOLDER: ClassVar[XibifPath] = XibifPath('hw/constraints')
GIT_FOLDER: ClassVar[XibifPath] = XibifPath('.')
HDL_SRC_FOLDER: ClassVar[XibifPath] = XibifPath('hw/src')
HDL_TB_FOLDER: ClassVar[XibifPath] = XibifPath('hw/tb')
HW_FOLDER: ClassVar[XibifPath] = XibifPath('hw')
IMPLEMENTATION_NAME: ClassVar[str] = ''
OPENLOGIC_FOLDER: ClassVar[XibifPath] = XibifPath('hw/open-logic')
PLATFORM_NAME: ClassVar[str] = 'xibif_platform'
PROJECT_NAME: ClassVar[str] = '.xibif'
PROJECT_PATH: ClassVar[XibifPath] = XibifPath('.')
REGEX_PATH_VALIDATION: ClassVar[str] = '^[a-zA-Z0-9_\\\\\\/\\-\\.:]+$'
REGEX_PROJECT_NAME_VALIDATION: ClassVar[str] = '^[\\w\\-]+$'
REGEX_REGISTER_VALIDATION: ClassVar[str] = '^[a-zA-Z][a-zA-Z0-9_]*$'
REGISTER_USER_CFG: ClassVar[XibifPath] = XibifPath('hw/regs/config-regs')
REG_FOLDER: ClassVar[XibifPath] = XibifPath('hw/regs')
REPORT_FOLDER: ClassVar[XibifPath] = XibifPath('reports')
RESULTS_FOLDER: ClassVar[XibifPath] = XibifPath('hw/results')
SIGASI_FOLDER: ClassVar[XibifPath] = XibifPath('.')
SIMULATION_COVERAGE_FOLDER: ClassVar[XibifPath] = XibifPath('hw/results/coverage')
SIMULATION_HISTORY_FOLDER: ClassVar[XibifPath] = XibifPath('hw/results/test_history')
SIMULATION_LIBRARY_FOLDER: ClassVar[XibifPath] = XibifPath('hw/results/libraries')
SIMULATION_RUN_SCRIPT: ClassVar[XibifPath] = XibifPath('hw/tb/run.py')
SIMULATION_VUNIT_OUTPUT_FOLDER: ClassVar[XibifPath] = XibifPath('hw/results/vunit_out')
SIMULATION_XML_FILE: ClassVar[XibifPath] = XibifPath('hw/results/test_output.xml')
SW_FOLDER: ClassVar[XibifPath] = XibifPath('sw')
SYNTHESIS_NAME: ClassVar[str] = ''
VITIS_FOLDER: ClassVar[XibifPath] = XibifPath('hw/vitis')
VIVADO_FOLDER: ClassVar[XibifPath] = XibifPath('hw/vivado')
classmethod openlogic_import_script_path(openlogic_folder: XibifPath = XibifPath('hw/open-logic')) XibifPath

Return the OpenLogic Vivado import script path.

Parameters:

openlogic_folder (XibifPath, optional) – The folder where the OpenLogic repository is located. Defaults to OPENLOGIC_FOLDER.

Returns:

XibifPath – The path to the OpenLogic Vivado import script.

classmethod register_stream_header_path(app_name: str = 'xibif', vitis_folder: XibifPath = XibifPath('hw/vitis')) XibifPath

Return the generated stream register C header path.

Parameters:
  • app_name (str, optional) – The name of the application. Defaults to APP_NAME.

  • vitis_folder (XibifPath, optional) – The folder where Vitis projects are stored. Defaults to VITIS_FOLDER.

Returns:

XibifPath – The path to the generated stream register C header file in the Vitis app source folder.

classmethod register_stream_package_path(tb_folder: XibifPath = XibifPath('hw/tb')) XibifPath

Return the generated stream testbench package path.

Parameters:

tb_folder (XibifPath, optional) – The folder where testbench files are stored. Defaults to HDL_TB_FOLDER.

Returns:

XibifPath – The path to the generated stream testbench package VHDL file.

classmethod register_stream_vhdl_path(src_folder: XibifPath = XibifPath('hw/src')) XibifPath

Return the generated stream register VHDL path.

Parameters:

src_folder (XibifPath, optional) – The folder where VHDL source files are stored. Defaults to HDL_SRC_FOLDER.

Returns:

XibifPath – The path to the generated stream register VHDL file.

classmethod register_user_header_path(app_name: str = 'xibif', vitis_folder: XibifPath = XibifPath('hw/vitis')) XibifPath

Return the generated user register C header path.

Parameters:
  • app_name (str, optional) – The name of the application. Defaults to APP_NAME.

  • vitis_folder (XibifPath, optional) – The folder where Vitis projects are stored. Defaults to VITIS_FOLDER.

Returns:

XibifPath – The path to the generated user register C header file in the Vitis app source folder.

classmethod register_user_vhdl_path(src_folder: XibifPath = XibifPath('hw/src')) XibifPath

Return the generated user register VHDL path.

Parameters:

src_folder (XibifPath, optional) – The folder where VHDL source files are stored. Defaults to HDL_SRC_FOLDER.

Returns:

XibifPath – The path to the generated user register VHDL file.

classmethod vitis_app_elf_path(app_name: str = 'xibif', results_folder: XibifPath = XibifPath('hw/results')) XibifPath

Return the exported application ELF path (<app>.elf).

Parameters:
  • app_name (str, optional) – The name of the application. Defaults to APP_NAME.

  • results_folder (XibifPath, optional) – The folder where the build results are located. Defaults to RESULTS_FOLDER.

Returns:

XibifPath – The path to the exported application ELF file (<app>.elf).

classmethod vitis_bootfile_path(results_folder: XibifPath = XibifPath('hw/results')) XibifPath

Return the generated BOOT file path (BOOT.BIN).

Parameters:

results_folder (XibifPath, optional) – The folder where the build results are located. Defaults to RESULTS_FOLDER.

Returns:

XibifPath – The path to the generated BOOT file (BOOT.BIN).

classmethod vitis_fsbl_path(results_folder: XibifPath = XibifPath('hw/results')) XibifPath

Return the exported FSBL path (fsbl.elf).

Parameters:

results_folder (XibifPath, optional) – The folder where the build results are located. Defaults to RESULTS_FOLDER.

Returns:

XibifPath – The path to the exported FSBL ELF file (fsbl.elf).

classmethod vitis_lockfile_path(vitis_folder: XibifPath = XibifPath('hw/vitis')) XibifPath

Return the Vitis workspace lockfile path (.lock).

Parameters:

vitis_folder (XibifPath, optional) – The folder where Vitis projects are stored. Defaults to VITIS_FOLDER.

Returns:

XibifPath – The path to the Vitis workspace lockfile (.lock).

classmethod vitis_settings_header_path(app_name: str = 'xibif', vitis_folder: XibifPath = XibifPath('hw/vitis')) XibifPath

Return the XiBIF settings header path in the Vitis app source folder.

Parameters:
  • app_name (str, optional) – The name of the application. Defaults to APP_NAME.

  • vitis_folder (XibifPath, optional) – The folder where Vitis projects are stored. Defaults to VITIS_FOLDER.

Returns:

XibifPath – The path to the generated XiBIF settings header file in the Vitis app source folder.

classmethod vitis_src_folder_path(app_name: str = 'xibif', vitis_folder: XibifPath = XibifPath('hw/vitis')) XibifPath

Return the Vitis application source folder path.

Parameters:
  • app_name (str, optional) – The name of the application. Defaults to APP_NAME.

  • vitis_folder (XibifPath, optional) – The folder where Vitis projects are stored. Defaults to VITIS_FOLDER.

Returns:

XibifPath – The path to the Vitis application source folder.

classmethod vitis_temp_project_path(project_name: str, vitis_folder: XibifPath = XibifPath('hw/vitis')) XibifPath

Return the temporary Vitis project path (<project>.temp).

Parameters:
  • project_name (str) – The name of the project.

  • vitis_folder (XibifPath, optional) – The folder where Vitis projects are stored. Defaults to VITIS_FOLDER.

Returns:

XibifPath – The path to the temporary Vitis project file (<project>.temp).

classmethod vivado_bitstream_path(project_name: str, results_folder: XibifPath = XibifPath('hw/results')) XibifPath

Return the bitstream path (<project>.bit).

Parameters:
  • project_name (str) – The name of the project.

  • results_folder (XibifPath, optional) – The folder where the build results are located. Defaults to RESULTS_FOLDER.

Returns:

XibifPath – The path to the generated bitstream file (.bit).

classmethod vivado_checkpoint_path(checkpoint_name: str, results_folder: XibifPath = XibifPath('hw/results')) XibifPath

Return the checkpoint path (<name>.dcp).

Parameters:
  • checkpoint_name (str) – The name of the checkpoint.

  • results_folder (XibifPath, optional) – The folder where the build results are located. Defaults to RESULTS_FOLDER.

Returns:

XibifPath – The path to the checkpoint file (.dcp).

classmethod vivado_hardware_path(project_name: str, results_folder: XibifPath = XibifPath('hw/results')) XibifPath

Return the hardware export path (<project>.xsa).

Parameters:
  • project_name (str) – The name of the project.

  • results_folder (XibifPath, optional) – The folder where the build results are located. Defaults to RESULTS_FOLDER.

Returns:

XibifPath – The path to the exported hardware file (.xsa).

classmethod vivado_ltx_path(project_name: str, results_folder: XibifPath = XibifPath('hw/results')) XibifPath

Return the probes file path (<project>.ltx).

Parameters:
  • project_name (str) – The name of the project.

  • results_folder (XibifPath, optional) – The folder where the build results are located. Defaults to RESULTS_FOLDER.

Returns:

XibifPath – The path to the generated probes file (.ltx).

classmethod vivado_project_path(project_name: str, vivado_folder: XibifPath = XibifPath('hw/vivado')) XibifPath

Return the Vivado project path (<project>.xpr).

Parameters:
  • project_name (str) – The name of the project.

  • vivado_folder (XibifPath, optional) – The folder where Vivado projects are stored. Defaults to VIVADO_FOLDER.

Returns:

XibifPath – The path to the Vivado project file (.xpr).

XiBIF Types

class XibifPath(path: Path | str | XibifPath)

Custom Path class for XiBIF that extends pathlib.Path with additional functionality.

as_tcl() str

Convert the path to a string with forward slashes, and handle MSYS2/WSL-style paths on Windows.

Returns:

str – The path as a string with forward slashes, suitable for use in Tcl commands

as_windows() XibifPath

Convert a Unix-style path (/c/path) to a Windows-style path (C:/path).

Returns:

XibifPath – The converted Windows-style path.

classmethod cwd() XibifPath

Get the current working directory as a XibifPath.

Returns:

XibifPath – The current working directory.

classmethod deserialize(data: Any) Any

Deserialize the XibifPath from a string or dict.

Parameters:

data (any) – The data to deserialize, which can be a string or a dict.

Returns:

any – The deserialized data as a XibifPath object.

is_absolute() bool

Check if the path is absolute.

Returns:

bool – True if the path is absolute, False otherwise.

serialize() str

Serialize the XibifPath to a string.

Returns:

str – The string representation of the path, taking into account the root if set.

classmethod set_root(root: Path | str | XibifPath) None

Set the root path for all XibifPath instances.

Parameters:

root (Path | str | XibifPath) – The root path to set for all XibifPath instances.

stat() stat_result

Return the stat result of the resolved path.

Returns:

os.stat_result – The stat result of the resolved path.

class XibifVersion(major: Annotated[int, Field(ge=0, le=255)] = 0, minor: Annotated[int, Field(ge=0, le=255)] = 0, patch: Annotated[int, Field(ge=0, le=255)] = 0, revision: Annotated[int, Field(ge=0, le=255)] = 0)

Data class to hold version information for XiBIF.

class XibifUUID(uuid: Annotated[int, Field(ge=0, le=2**32 - 1)] = 0)

Data class to hold UUID information for XiBIF.

classmethod deserialize(data: Any) Any

Deserialize the UUID from an int or dict.

Parameters:

data (any) – The data to deserialize, which can be an int or a dict.

Returns:

any – The deserialized data as a dict with a ‘uuid’ key.

serialize() int

Serialize the UUID to an int.

Returns:

int – The UUID int.

class XibifChecksum(checksum: Annotated[str, Field(pattern='^[0-9a-fA-F]+$')] = '0')

Data class to hold checksum information for XiBIF.

classmethod deserialize(data: Any) Any

Deserialize the checksum from a string or dict. :param data: The data to deserialize, which can be a string or a dict. :type data: any

Returns:

any – The deserialized data as a dict with a ‘checksum’ key.

serialize() str

Serialize the checksum to a string.

Returns:

str – The checksum string.

class XibifDefaultsRegex

Class to hold default regular expressions for validation in XiBIF.

class XilinxToolPath(vivado: XibifPath | None = None, vitis: XibifPath | None = None, xsct: XibifPath | None = None, cs_server: XibifPath | None = None, hw_server: XibifPath | None = None, settings64_script: XibifPath | None = None)

Data class to store paths to Xilinx tools.

items() tuple[str, XibifPath | None]

Return an iterator of tool names and their corresponding paths.

Returns:

tuple[str, XibifPath | None] – An iterator of (tool_name, tool_path) pairs.

class XibifMessage(title: str, message: str | list[str])

Class to display a formatted warning message with ASCII art and prompt the user for confirmation.

ask(ask: str) bool

Display a formatted warning message with ASCII art and prompt the user for a yes/no answer.

Parameters:

ask (str) – The question to prompt the user with.

Returns:

bool – True if the user answered yes, False if no.

class XibifDefaultsMessages

Class to hold default messages for various prompts and warnings in XiBIF.

XiBIF Enums

class XilinxBoard(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)

Enumeration of supported FPGA boards for XiBIF projects.

class XilinxVersion(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)

Enumeration of supported Xilinx versions for XiBIF projects.

class VunitSimulator(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)

Enumeration of supported VUnit simulators for testbench generation.

class XibifStartTool(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)

Enumeration of supported tools to start when running the ‘start’ command.

XiBIF Exceptions

exception XibifError

Base exception for all xibif-related errors.

exception XibifEnvironmentError

Exception raised for missing tools or packages in the environment.

exception XibifInvalidPathError

Exception raised for invalid file paths.

exception XibifGeneratedFileError

Exception raised when a generated file is not found or cannot be accessed.

exception XibifRuntimeError

Exception raised for errors that occur during the execution of xibif operations.

exception XibifTimeoutError

Exception raised when an operation exceeds the specified timeout duration.

exception XibifRegisterError

Exception raised for errors related to register handling.

exception XibifValidationError

Exception raised for validation errors in the project configuration.

exception XibifChecksumError

Exception raised for checksum mismatches in the project configuration.