From 73911aca191d18c0a5ddb946ec618fc91b85f3f1 Mon Sep 17 00:00:00 2001 From: Wade Fife Date: Wed, 16 Oct 2019 16:42:41 -0500 Subject: 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 --- .../utils/rfnoc_blocktool/templates/functions.mako | 31 ++++++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100644 host/utils/rfnoc_blocktool/templates/functions.mako (limited to 'host/utils/rfnoc_blocktool/templates/functions.mako') 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 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 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')}\ + -- cgit v1.2.3