Skip to content

Commit

Permalink
Fix bug, return XrtDevice only for x86 machines (#1337)
Browse files Browse the repository at this point in the history
* Fix bug, assign XrtDevice only to x86 machines

* Create a generic CPU_ARCH_IS_x86 to support (unlikely) x86 with 32-bit instruction set
  • Loading branch information
mariodruiz committed Feb 23, 2022
1 parent ceba47e commit 0cdf6b9
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
7 changes: 4 additions & 3 deletions pynq/pl_server/xrt_device.py
@@ -1,4 +1,4 @@
# Copyright (c) 2019-2021, Xilinx, Inc.
# Copyright (c) 2019-2022, Xilinx, Inc.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
Expand Down Expand Up @@ -37,13 +37,14 @@
import weakref
import numpy as np
from pynq.buffer import PynqBuffer
from pynq.ps import CPU_ARCH_IS_x86
from .device import Device

from pynq._3rdparty import xrt
from pynq._3rdparty import ert

__author__ = "Peter Ogden"
__copyright__ = "Copyright 2019-2021, Xilinx"
__copyright__ = "Copyright 2019-2022, Xilinx"
__email__ = "pynq_support@xilinx.com"


Expand Down Expand Up @@ -314,7 +315,7 @@ def __repr__(self):
class XrtDevice(Device):
@classmethod
def _probe_(cls):
if not xrt.XRT_SUPPORTED:
if not xrt.XRT_SUPPORTED or not CPU_ARCH_IS_x86:
return []
num = xrt.xclProbe()
devices = [XrtDevice(i) for i in range(num)]
Expand Down
5 changes: 3 additions & 2 deletions pynq/ps.py
@@ -1,4 +1,4 @@
# Copyright (c) 2016, Xilinx, Inc.
# Copyright (c) 2016-2022, Xilinx, Inc.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
Expand Down Expand Up @@ -31,13 +31,14 @@
import warnings

__author__ = "Yun Rock Qu"
__copyright__ = "Copyright 2017, Xilinx"
__copyright__ = "Copyright 2017-2022, Xilinx"
__email__ = "pynq_support@xilinx.com"

ZYNQ_ARCH = "armv7l"
ZU_ARCH = "aarch64"
CPU_ARCH = os.uname().machine
CPU_ARCH_IS_SUPPORTED = CPU_ARCH in [ZYNQ_ARCH, ZU_ARCH]
CPU_ARCH_IS_x86 = "x86" in CPU_ARCH

DEFAULT_PL_CLK_MHZ = 100.0

Expand Down

0 comments on commit 0cdf6b9

Please sign in to comment.