build.plat: avoid type confusion in _check_feature.
authorwhitequark <whitequark@whitequark.org>
Thu, 15 Oct 2020 08:54:48 +0000 (08:54 +0000)
committerwhitequark <whitequark@whitequark.org>
Thu, 15 Oct 2020 08:56:09 +0000 (08:56 +0000)
Before this commit, `_check_feature(valid_xdrs=0)` would mean that
XDR buffers are not supported. Only `_check_feature(valid_xdrs=())`
was intended to be an indicator of that.

nmigen/build/plat.py

index 63842499e09118b1ed85b2af8083c86a2de28a00..31c9704ccb8d346e8bbde98f2fe77822793d8aa0 100644 (file)
@@ -177,7 +177,7 @@ class Platform(ResourceManager, metaclass=ABCMeta):
                                   .format(type(self).__name__))
 
     def _check_feature(self, feature, pin, attrs, valid_xdrs, valid_attrs):
-        if not valid_xdrs:
+        if len(valid_xdrs) == 0:
             raise NotImplementedError("Platform '{}' does not support {}"
                                       .format(type(self).__name__, feature))
         elif pin.xdr not in valid_xdrs: