aboutsummaryrefslogtreecommitdiffstats
path: root/host/python
diff options
context:
space:
mode:
authorWade Fife <wade.fife@ettus.com>2020-12-02 17:15:33 -0600
committermichael-west <michael.west@ettus.com>2021-06-02 22:00:40 -0700
commit4ac80a4312221825787095dfc58c19b15f7d8d60 (patch)
tree688b5b1da6430c5281cd45d309becd71706cb496 /host/python
parentfcb44a0618d9e60e58362bb3e813f3e18b209aab (diff)
downloaduhd-4ac80a4312221825787095dfc58c19b15f7d8d60.tar.gz
uhd-4ac80a4312221825787095dfc58c19b15f7d8d60.tar.bz2
uhd-4ac80a4312221825787095dfc58c19b15f7d8d60.zip
rfnoc: Add image_core_name option to rfnoc_image_builder
This change adds the ability to specify in the YAML description for your RFNoC image what the rfnoc_image_core should be named. This allows you to have multiple RFNoC image cores generated for the same target.
Diffstat (limited to 'host/python')
-rwxr-xr-xhost/python/uhd/imgbuilder/image_builder.py18
-rw-r--r--host/python/uhd/imgbuilder/templates/rfnoc_image_core.v.mako8
2 files changed, 16 insertions, 10 deletions
diff --git a/host/python/uhd/imgbuilder/image_builder.py b/host/python/uhd/imgbuilder/image_builder.py
index 1276ab693..84fc79798 100755
--- a/host/python/uhd/imgbuilder/image_builder.py
+++ b/host/python/uhd/imgbuilder/image_builder.py
@@ -829,31 +829,31 @@ def get_core_config_path(config_path):
"""
return os.path.join(config_path, RFNOC_CORE_DIR)
-def generate_image_core_path(output_path, device, source):
+def generate_image_core_path(output_path, name, source):
"""
Creates the path where the image core file gets to be stored.
output_path: If not None, this is returned
- device: Device type string, used to generate default file name
+ name: Device name string, used to generate default file name
source: Otherwise, this path is returned, combined with a default file name
"""
if output_path is not None:
return os.path.splitext(output_path)[0] + '.v'
source = os.path.split(os.path.abspath(os.path.normpath(source)))[0]
- return os.path.join(source, "{}_rfnoc_image_core.v".format(device))
+ return os.path.join(source, "{}_rfnoc_image_core.v".format(name))
-def generate_image_core_header_path(output_path, device, source):
+def generate_image_core_header_path(output_path, name, source):
"""
Creates the path where the image core header file will be stored.
output_path: If not None, this is returned
- device: Device type string, used to generate default file name
+ name: Device name string, used to generate default file name
source: Otherwise, this path is returned, combined with a default file name
"""
if output_path is not None:
return os.path.splitext(output_path)[0] + '.vh'
source = os.path.split(os.path.abspath(os.path.normpath(source)))[0]
- return os.path.join(source, "{}_rfnoc_image_core.vh".format(device))
+ return os.path.join(source, "{}_rfnoc_image_core.vh".format(name))
def generate_edge_file_path(output_path, device, source):
"""
@@ -889,13 +889,13 @@ def build_image(config, fpga_path, config_path, device, **args):
logging.info("Selected device %s", device)
image_core_path = \
generate_image_core_path(
- args.get('output_path'), device, args.get('source'))
+ args.get('output_path'), args.get('image_core_name'), args.get('source'))
image_core_header_path = \
generate_image_core_header_path(
- args.get('output_path'), device, args.get('source'))
+ args.get('output_path'), args.get('image_core_name'), args.get('source'))
edge_file = \
generate_edge_file_path(
- args.get('router_hex_path'), device, args.get('source'))
+ args.get('router_hex_path'), args.get('image_core_name'), args.get('source'))
logging.debug("Image core output file: %s", image_core_path)
logging.debug("Image core header output file: %s", image_core_header_path)
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 549a469ee..a5a019e16 100644
--- a/host/python/uhd/imgbuilder/templates/rfnoc_image_core.v.mako
+++ b/host/python/uhd/imgbuilder/templates/rfnoc_image_core.v.mako
@@ -26,7 +26,13 @@
`default_nettype none
-`include "${config.device.type}_rfnoc_image_core.vh"
+<%
+ if hasattr(config, 'image_core_name'):
+ image_core_name = config.image_core_name
+ else:
+ image_core_name = config.device.type
+%>\
+`include "${image_core_name}_rfnoc_image_core.vh"
module rfnoc_image_core #(