aboutsummaryrefslogtreecommitdiffstats
path: root/host/utils/rfnoc_blocktool/templates/functions.mako
diff options
context:
space:
mode:
authorWade Fife <wade.fife@ettus.com>2019-10-16 16:42:41 -0500
committerMartin Braun <martin.braun@ettus.com>2019-11-26 12:21:33 -0800
commit73911aca191d18c0a5ddb946ec618fc91b85f3f1 (patch)
tree2c2b2575fd3f26071064de8b7910f8824895f749 /host/utils/rfnoc_blocktool/templates/functions.mako
parent8fb790c8c310e2a711fe3da9fb587d6fbf99b230 (diff)
downloaduhd-73911aca191d18c0a5ddb946ec618fc91b85f3f1.tar.gz
uhd-73911aca191d18c0a5ddb946ec618fc91b85f3f1.tar.bz2
uhd-73911aca191d18c0a5ddb946ec618fc91b85f3f1.zip
utils: blocktool: Fix blocktool
- Fix mako paths to run from anywhere - Correct code errors and clean up generated code - Add support for port parameters - Add support for axis_data interface - Fix NoC shell reset handling - Replace Python functions with Verilog $clog2 - Allow input and output to share port name
Diffstat (limited to 'host/utils/rfnoc_blocktool/templates/functions.mako')
-rw-r--r--host/utils/rfnoc_blocktool/templates/functions.mako31
1 files changed, 31 insertions, 0 deletions
diff --git a/host/utils/rfnoc_blocktool/templates/functions.mako b/host/utils/rfnoc_blocktool/templates/functions.mako
new file mode 100644
index 000000000..b0e4506ec
--- /dev/null
+++ b/host/utils/rfnoc_blocktool/templates/functions.mako
@@ -0,0 +1,31 @@
+<%def name="num_ports_str(direction)">\
+<%
+ # Generate a string for the number of input or output CHDR ports. This takes
+ # into account any parameters that affect the number of ports. The direction
+ # argument should be the string 'inputs' or 'outputs'.
+ num_ports_cnt = 0
+ num_ports_str = ''
+ for port_name, port_info in config['data'][direction].items():
+ if 'num_ports' in port_info:
+ if str(port_info['num_ports']).isdecimal():
+ num_ports_cnt = num_ports_cnt + int(port_info['num_ports'])
+ else:
+ num_ports_str = num_ports_str + '+' + str(port_info['num_ports'])
+ else:
+ num_ports_cnt = num_ports_cnt + 1
+ num_ports_str = str(num_ports_cnt) + num_ports_str
+%>\
+${num_ports_str}\
+</%def>
+
+<%def name="num_ports_in_str()">\
+## Generate a string for the number of input CHDR ports. This takes into
+## account any parameters that affect the number of ports.
+${num_ports_str('inputs')}\
+</%def>
+
+<%def name="num_ports_out_str()">\
+## Generate a string for the number of output CHDR ports. This takes into
+## account any parameters that affect the number of ports.
+${num_ports_str('outputs')}\
+</%def>