Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion examples/pyxsim/example_pyxsim.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
# Copyright 2025-2026 XMOS LIMITED.
# This Software is subject to the terms of the XMOS Public Licence: Version 1.
import os
from pathlib import Path

import Pyxsim
Expand All @@ -20,7 +21,11 @@ def run(self) -> None:


def main() -> None:
xe = Path(__file__).parent / "bin" / "example_pyxsim.xe"
XE_OVERRIDE = os.environ.get("XE_FILE_OVERRIDE")
if XE_OVERRIDE:
xe = Path(XE_OVERRIDE)
else:
xe = Path(__file__).parent / "bin" / "example_pyxsim.xe"
assert xe.exists()

Pyxsim.run_with_pyxsim(
Expand Down
11 changes: 10 additions & 1 deletion lib/python/Pyxsim/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
from . import pyxsim
from Pyxsim.xe import Xe
from Pyxsim.pyxsim import Xsi
from Pyxsim.pyxsim import XsiRemote


# This function is called automatically by the runners
Expand Down Expand Up @@ -195,7 +196,12 @@ def run_on_simulator(*args, **kwargs):


def do_run_pyxsim(xe, simargs, appargs, simthreads, plugins=None):
xsi = pyxsim.Xsi(xe_path=xe, simargs=simargs, appargs=appargs)
# Get XSI_ENDPOINT environment variable if set, otherwise use local
xsi_endpoint = os.environ.get("XSI_ENDPOINT")
if xsi_endpoint:
xsi = pyxsim.XsiRemote(xsi_endpoint, xe_path=xe, simargs=simargs, appargs=appargs)
else:
xsi = pyxsim.Xsi(xe_path=xe, simargs=simargs, appargs=appargs)
for x in simthreads:
xsi.register_simthread(x)
if plugins:
Expand Down Expand Up @@ -257,6 +263,9 @@ def run_with_pyxsim(

simargs += ["--vcd-tracing", vcd_args]

if os.environ.get("XSI_ENDPOINT"):
timeout = None # Don't timeout when running on remote server

p = ctx.Process(
target=do_run_pyxsim, args=(xe_path, simargs, appargs, simthreads, plugins)
)
Expand Down
Loading