diff options
author | Wade Fife <wade.fife@ettus.com> | 2022-01-25 16:13:36 -0600 |
---|---|---|
committer | Aaron Rossetto <aaron.rossetto@ni.com> | 2022-06-10 13:24:04 -0500 |
commit | cee4c3dd08c785fbbcce6fe4d2f58cc57fca0486 (patch) | |
tree | e5dd9b545289d622310043616794dc418f6de899 /host/python | |
parent | 3fb4e7b844ad313ae88bd1a02f2c7734f5f115a6 (diff) | |
download | uhd-cee4c3dd08c785fbbcce6fe4d2f58cc57fca0486.tar.gz uhd-cee4c3dd08c785fbbcce6fe4d2f58cc57fca0486.tar.bz2 uhd-cee4c3dd08c785fbbcce6fe4d2f58cc57fca0486.zip |
python: Check rfnoc_version in rfnoc_image_builder
Diffstat (limited to 'host/python')
-rw-r--r-- | host/python/uhd/imgbuilder/image_builder.py | 26 | ||||
-rw-r--r-- | host/python/uhd/imgbuilder/templates/rfnoc_image_core.v.mako | 3 |
2 files changed, 28 insertions, 1 deletions
diff --git a/host/python/uhd/imgbuilder/image_builder.py b/host/python/uhd/imgbuilder/image_builder.py index 67ceb6fa9..169b36b7e 100644 --- a/host/python/uhd/imgbuilder/image_builder.py +++ b/host/python/uhd/imgbuilder/image_builder.py @@ -32,6 +32,9 @@ RFNOC_CORE_DIR = os.path.join('rfnoc', 'core') # Path to the system's bash executable BASH_EXECUTABLE = '/bin/bash' # FIXME this should come from somewhere +# Supported protocol version +RFNOC_PROTO_VERSION = "1.0" + # Map device names to the corresponding directory under usrp3/top DEVICE_DIR_MAP = { 'x300': 'x300', @@ -262,6 +265,29 @@ class ImageBuilderConfig: failure = None if not any([bool(sep["ctrl"]) for sep in self.stream_endpoints.values()]): failure = "At least one streaming endpoint needs to have ctrl enabled" + # Check RFNoC protocol version. Use latest if it was not specified. + requested_version = ( + self.rfnoc_version + if hasattr(self, "rfnoc_version") + else RFNOC_PROTO_VERSION + ) + [requsted_major, requested_minor, *_] = requested_version.split('.') + [supported_major, supported_minor, *_] = RFNOC_PROTO_VERSION.split('.') + if requsted_major != supported_major or requested_minor > supported_minor: + failure = ( + "Requested RFNoC protocol version (rfnoc_version) " + + requested_version + + " is ahead of latest version " + + RFNOC_PROTO_VERSION + ) + elif requested_version != RFNOC_PROTO_VERSION: + logging.warning( + "Generating code for latest RFNoC protocol version " + + RFNOC_PROTO_VERSION + + " instead of requested " + + requested_version + ) + self.rfnoc_version = RFNOC_PROTO_VERSION if failure: logging.error(failure) raise ValueError(failure) diff --git a/host/python/uhd/imgbuilder/templates/rfnoc_image_core.v.mako b/host/python/uhd/imgbuilder/templates/rfnoc_image_core.v.mako index b27e21fc4..0443cbfdf 100644 --- a/host/python/uhd/imgbuilder/templates/rfnoc_image_core.v.mako +++ b/host/python/uhd/imgbuilder/templates/rfnoc_image_core.v.mako @@ -1,5 +1,6 @@ <% import datetime + [protover_major, protover_minor, *_] = config.rfnoc_version.split('.') %>// // Copyright ${datetime.datetime.now().year} ${config.copyright} // @@ -30,7 +31,7 @@ module rfnoc_image_core #( parameter CHDR_W = ${config.chdr_width}, parameter MTU = 10, - parameter [15:0] PROTOVER = {8'd1, 8'd0}, + parameter [15:0] PROTOVER = {8'd${protover_major}, 8'd${protover_minor}}, parameter RADIO_NIPC = 1 ) ( // Clocks |