Custom Op - fpgadataflow.hls

HLS Custom Op Nodes

finn.custom_op.fpgadataflow.addstreams_hls

class finn.custom_op.fpgadataflow.hls.addstreams_hls.AddStreams_hls(onnx_node, **kwargs)

Bases: AddStreams, HLSBackend

Class that corresponds to finn-hlslib AddStreams_Batch function.

blackboxfunction()

Function to generate a blackbock function in c++ from which an IP block will be generated, is member function of HLSBackend class but has to be filled by every node.

defines(var)

Function to set the define commands for c++ code that has to be generated for cppsim or rtlsim, is member function of HLSBackend class but has to be filled by every node.

var: makes it possible to reuse the function for different c++ code generation. I.e. if set to “ipgen” in MatrixVectorActivation additional PRAGMA defines are added.

docompute()

Function to generate the commands for the computational part of the c++ code, is member function of HLSBackend class but has to be filled by every node.

execute_node(context, graph)

Execute this CustomOp instance, given the execution context and ONNX graph.

get_nodeattr_types()

Returns a dict of permitted attributes for node, where: ret_dict[attribute_name] = (dtype, require, default_value, <allowed_values>) - dtype indicates which member of the ONNX AttributeProto will be utilized - require indicates whether this attribute is required - default_val indicates the default value that will be used if the attribute is not set - <allowed_values> (if specified) indicates that this attribute can only be set to one of the values in the set <allowed_values>. If not specified, all values permitted by dtype are allowed.

global_includes()

Function to set the global includes for c++ code that has to be generated for cppsim or rtlsim, is member function of HLSBackend class but has to be filled by every node.

pragmas()

Function to generate the pragma commands in c++, might need to be overwritten depending on custom op.

read_npy_data()

Function to generate the commands for reading data from .npy file in c++, might need to be overwritten depending on custom op.

strm_decl()

Function to generate the commands for the stream declaration in c++, is member function of HLSBackend class but might need to be filled by node.

verify_node()

Verifies that all attributes the node needs are there and that particular attributes are set correctly. Also checks if the number of inputs is equal to the expected number.

finn.custom_op.fpgadataflow.channelwise_op_hls

class finn.custom_op.fpgadataflow.hls.channelwise_op_hls.ChannelwiseOp_hls(onnx_node, **kwargs)

Bases: ChannelwiseOp, HLSBackend

Class that corresponds to finn-hls Thresholding_Batch function. It can implement a variety of channel-wise parametrized operations, including Add, Mul and multi-thresholding.

blackboxfunction()

Function to generate a blackbock function in c++ from which an IP block will be generated, is member function of HLSBackend class but has to be filled by every node.

bram_estimation()

Calculates BRAM cost if resource set to BRAM

dataoutstrm()

Function to generate the commands for reading out data from c++ and convert into npy format, is member function of HLSBackend class might need to be filled by node.

defines(var)

Function to set the define commands for c++ code that has to be generated for cppsim or rtlsim, is member function of HLSBackend class but has to be filled by every node.

var: makes it possible to reuse the function for different c++ code generation. I.e. if set to “ipgen” in MatrixVectorActivation additional PRAGMA defines are added.

docompute()

Function to generate the commands for the computational part of the c++ code, is member function of HLSBackend class but has to be filled by every node.

execute_node(context, graph)

Execute this CustomOp instance, given the execution context and ONNX graph.

generate_params(model, path)

Function to generate parameters (i.e. weights and thresholds), is member function of HWCustomOp class but has to be filled by every node that needs to generate parameters.

get_hls_compatible_parameter_tensor(orig_param_vector)

Convert the original numpy weight matrix orig_weight_matrix into a form suitable for passing to the hlslib call: * ensure chn % PE == 0 * interleave rows between PEs * reshape into (PE, TMEM) and return

get_nodeattr_types()

Returns a dict of permitted attributes for node, where: ret_dict[attribute_name] = (dtype, require, default_value, <allowed_values>) - dtype indicates which member of the ONNX AttributeProto will be utilized - require indicates whether this attribute is required - default_val indicates the default value that will be used if the attribute is not set - <allowed_values> (if specified) indicates that this attribute can only be set to one of the values in the set <allowed_values>. If not specified, all values permitted by dtype are allowed.

get_template_param_values()

Returns the template parameter values according to input, output and weight data types.

global_includes()

Function to set the global includes for c++ code that has to be generated for cppsim or rtlsim, is member function of HLSBackend class but has to be filled by every node.

lut_estimation()

Calculates LUT cost, taking memory resource type into account

pragmas()

Function to generate the pragma commands in c++, might need to be overwritten depending on custom op.

read_npy_data()

Function to generate the commands for reading data from .npy file in c++, might need to be overwritten depending on custom op.

verify_node()

Verifies that all attributes the node needs are there and that particular attributes are set correctly. Also checks if the number of inputs is equal to the expected number.

finn.custom_op.fpgadataflow.checksum_hls

class finn.custom_op.fpgadataflow.hls.checksum_hls.CheckSum_hls(onnx_node, **kwargs)

Bases: HWCustomOp, HLSBackend

Class that corresponds to custom_hls checksum function.

blackboxfunction()

Function to generate a blackbock function in c++ from which an IP block will be generated, is member function of HLSBackend class but has to be filled by every node.

dataoutstrm()

Function to generate the commands for reading out data from c++ and convert into npy format, is member function of HLSBackend class might need to be filled by node.

defines(var)

Function to set the define commands for c++ code that has to be generated for cppsim or rtlsim, is member function of HLSBackend class but has to be filled by every node.

var: makes it possible to reuse the function for different c++ code generation. I.e. if set to “ipgen” in MatrixVectorActivation additional PRAGMA defines are added.

docompute()

Function to generate the commands for the computational part of the c++ code, is member function of HLSBackend class but has to be filled by every node.

execute_node(context, graph)

Execute this CustomOp instance, given the execution context and ONNX graph.

get_ap_int_max_w()

Return the maximum width of any ap_int used in this module. Used to set the AP_INT_MAX_W definition for HLS.

get_folded_input_shape(ind=0)

Returns folded input shape (according to synapse folding), if implemented.

get_folded_output_shape(ind=0)

Returns folded output shape (according to neuron folding), if implemented.

get_input_datatype(ind=0)

Returns FINN DataType of input.

get_instream_width(ind=0)

Returns input stream width, if implemented.

get_nodeattr_types()

Returns a dict of permitted attributes for node, where: ret_dict[attribute_name] = (dtype, require, default_value, <allowed_values>) - dtype indicates which member of the ONNX AttributeProto will be utilized - require indicates whether this attribute is required - default_val indicates the default value that will be used if the attribute is not set - <allowed_values> (if specified) indicates that this attribute can only be set to one of the values in the set <allowed_values>. If not specified, all values permitted by dtype are allowed.

get_normal_input_shape(ind=0)

Returns normal input shape if implemented.

get_normal_output_shape(ind=0)

Returns folded output shape if implemented.

get_number_output_values()

Function to get the number of expected output values, is member function of HWCustomOp class but has to be filled by every node.

get_output_datatype(ind=0)

Returns FINN DataType of output.

get_outstream_width(ind=0)

Returns output stream width, if implemented.

get_verilog_top_module_intf_names()

Return a dict of names of input and output interfaces. The keys reflect the protocols each interface implements: ‘clk’, ‘rst’, ‘m_axis’, ‘s_axis’, ‘aximm’, ‘axilite’. Values are lists of tuples (axis, aximm) or names (axilite): ‘axis’ tuples correspond to the list of node inputs in order, each tuple is (interface_name, interface_width_bits). axilite always assumed to be 32 bits and is not tuple (name only). Each block must have at most one aximm and one axilite.

global_includes()

Function to set the global includes for c++ code that has to be generated for cppsim or rtlsim, is member function of HLSBackend class but has to be filled by every node.

infer_node_datatype(model)

Set the DataType annotations corresponding to the outputs of this node.

make_shape_compatible_op(model)

Returns a standard ONNX op which is compatible with this CustomOp for performing shape inference.

npy_to_dynamic_output(context)

Reads the output from an output.npy file generated from cppsim and places its content into the context dictionary.

pragmas()

Function to generate the pragma commands in c++, might need to be overwritten depending on custom op.

read_npy_data()

Function to generate the commands for reading data from .npy file in c++, might need to be overwritten depending on custom op.

strm_decl()

Function to generate the commands for the stream declaration in c++, is member function of HLSBackend class but might need to be filled by node.

verify_node()

Verifies that all attributes the node needs are there and that particular attributes are set correctly. Also checks if the number of inputs is equal to the expected number.

finn.custom_op.fpgadataflow.concat_hls

class finn.custom_op.fpgadataflow.hls.concat_hls.StreamingConcat_hls(onnx_node, **kwargs)

Bases: StreamingConcat, HLSBackend

Streaming concatenation node with dynamically generated HLS. Only supports concatenating along the last axis.

blackboxfunction()

Function to generate a blackbock function in c++ from which an IP block will be generated, is member function of HLSBackend class but has to be filled by every node.

defines(var)

Function to set the define commands for c++ code that has to be generated for cppsim or rtlsim, is member function of HLSBackend class but has to be filled by every node.

var: makes it possible to reuse the function for different c++ code generation. I.e. if set to “ipgen” in MatrixVectorActivation additional PRAGMA defines are added.

docompute()

Function to generate the commands for the computational part of the c++ code, is member function of HLSBackend class but has to be filled by every node.

execute_node(context, graph)

Execute this CustomOp instance, given the execution context and ONNX graph.

generate_params(model, path)

Function to generate parameters (i.e. weights and thresholds), is member function of HWCustomOp class but has to be filled by every node that needs to generate parameters.

get_nodeattr_types()

Returns a dict of permitted attributes for node, where: ret_dict[attribute_name] = (dtype, require, default_value, <allowed_values>) - dtype indicates which member of the ONNX AttributeProto will be utilized - require indicates whether this attribute is required - default_val indicates the default value that will be used if the attribute is not set - <allowed_values> (if specified) indicates that this attribute can only be set to one of the values in the set <allowed_values>. If not specified, all values permitted by dtype are allowed.

global_includes()

Function to set the global includes for c++ code that has to be generated for cppsim or rtlsim, is member function of HLSBackend class but has to be filled by every node.

pragmas()

Function to generate the pragma commands in c++, might need to be overwritten depending on custom op.

read_npy_data()

Function to generate the commands for reading data from .npy file in c++, might need to be overwritten depending on custom op.

strm_decl()

Function to generate the commands for the stream declaration in c++, is member function of HLSBackend class but might need to be filled by node.

finn.custom_op.fpgadataflow.convolutioninputgenerator_hls

class finn.custom_op.fpgadataflow.hls.convolutioninputgenerator_hls.ConvolutionInputGenerator_hls(onnx_node, **kwargs)

Bases: ConvolutionInputGenerator, HLSBackend

Class that corresponds to one of the 1D finn-hlslib ConvolutionInputGenerator (sliding window) function variants. Depending on the combination of attributes (e.g. depthwise or not, whether dilation is 0) a different variant will be picked for the actual HLS implementation.

blackboxfunction()

Function to generate a blackbock function in c++ from which an IP block will be generated, is member function of HLSBackend class but has to be filled by every node.

bram_estimation()

Function for BRAM resource estimation, is member function of HWCustomOp class but has to be filled by every node

dataoutstrm()

Function to generate the commands for reading out data from c++ and convert into npy format, is member function of HLSBackend class might need to be filled by node.

defines(var)

Function to set the define commands for c++ code that has to be generated for cppsim or rtlsim, is member function of HLSBackend class but has to be filled by every node.

var: makes it possible to reuse the function for different c++ code generation. I.e. if set to “ipgen” in MatrixVectorActivation additional PRAGMA defines are added.

docompute()

Function to generate the commands for the computational part of the c++ code, is member function of HLSBackend class but has to be filled by every node.

execute_node(context, graph)

Execute this CustomOp instance, given the execution context and ONNX graph.

get_exp_cycles()

Function for estimation of expected cycles for set folding, is member function of HWCustomOp class but has to be filled by every node

get_nodeattr_types()

Returns a dict of permitted attributes for node, where: ret_dict[attribute_name] = (dtype, require, default_value, <allowed_values>) - dtype indicates which member of the ONNX AttributeProto will be utilized - require indicates whether this attribute is required - default_val indicates the default value that will be used if the attribute is not set - <allowed_values> (if specified) indicates that this attribute can only be set to one of the values in the set <allowed_values>. If not specified, all values permitted by dtype are allowed.

get_swu_variant()
global_includes()

Function to set the global includes for c++ code that has to be generated for cppsim or rtlsim, is member function of HLSBackend class but has to be filled by every node.

lut_estimation()

Function for LUT resource estimation, is member function of HWCustomOp class but has to be filled by every node

uram_estimation()

Function for UltraRAM resource estimation, is member function of HWCustomOp class but has to be filled by every node

use_parallel_window_output()

finn.custom_op.fpgadataflow.downsampler_hls

class finn.custom_op.fpgadataflow.hls.downsampler_hls.DownSampler_hls(onnx_node, **kwargs)

Bases: DownSampler, HLSBackend

Corresponds to finn-hlslib ConvolutionInputGenerator_*_kernel1 function. Basically performs a down sampling of the image removing rows and columns.

blackboxfunction()

Function to generate a blackbock function in c++ from which an IP block will be generated, is member function of HLSBackend class but has to be filled by every node.

defines(var)

Function to set the define commands for c++ code that has to be generated for cppsim or rtlsim, is member function of HLSBackend class but has to be filled by every node.

var: makes it possible to reuse the function for different c++ code generation. I.e. if set to “ipgen” in MatrixVectorActivation additional PRAGMA defines are added.

docompute()

Function to generate the commands for the computational part of the c++ code, is member function of HLSBackend class but has to be filled by every node.

execute_node(context, graph)

Execute this CustomOp instance, given the execution context and ONNX graph.

get_nodeattr_types()

Returns a dict of permitted attributes for node, where: ret_dict[attribute_name] = (dtype, require, default_value, <allowed_values>) - dtype indicates which member of the ONNX AttributeProto will be utilized - require indicates whether this attribute is required - default_val indicates the default value that will be used if the attribute is not set - <allowed_values> (if specified) indicates that this attribute can only be set to one of the values in the set <allowed_values>. If not specified, all values permitted by dtype are allowed.

global_includes()

Function to set the global includes for c++ code that has to be generated for cppsim or rtlsim, is member function of HLSBackend class but has to be filled by every node.

finn.custom_op.fpgadataflow.duplicatestreams_hls

class finn.custom_op.fpgadataflow.hls.duplicatestreams_hls.DuplicateStreams_hls(onnx_node, **kwargs)

Bases: DuplicateStreams, HLSBackend

Class that corresponds to finn-hlslib function of the same name.

blackboxfunction()

Function to generate a blackbock function in c++ from which an IP block will be generated, is member function of HLSBackend class but has to be filled by every node.

dataoutstrm()

Function to generate the commands for reading out data from c++ and convert into npy format, is member function of HLSBackend class might need to be filled by node.

defines(var)

Function to set the define commands for c++ code that has to be generated for cppsim or rtlsim, is member function of HLSBackend class but has to be filled by every node.

var: makes it possible to reuse the function for different c++ code generation. I.e. if set to “ipgen” in MatrixVectorActivation additional PRAGMA defines are added.

docompute()

Function to generate the commands for the computational part of the c++ code, is member function of HLSBackend class but has to be filled by every node.

execute_node(context, graph)

Execute this CustomOp instance, given the execution context and ONNX graph.

generate_params(model, path)

Function to generate parameters (i.e. weights and thresholds), is member function of HWCustomOp class but has to be filled by every node that needs to generate parameters.

get_nodeattr_types()

Returns a dict of permitted attributes for node, where: ret_dict[attribute_name] = (dtype, require, default_value, <allowed_values>) - dtype indicates which member of the ONNX AttributeProto will be utilized - require indicates whether this attribute is required - default_val indicates the default value that will be used if the attribute is not set - <allowed_values> (if specified) indicates that this attribute can only be set to one of the values in the set <allowed_values>. If not specified, all values permitted by dtype are allowed.

global_includes()

Function to set the global includes for c++ code that has to be generated for cppsim or rtlsim, is member function of HLSBackend class but has to be filled by every node.

pragmas()

Function to generate the pragma commands in c++, might need to be overwritten depending on custom op.

strm_decl()

Function to generate the commands for the stream declaration in c++, is member function of HLSBackend class but might need to be filled by node.

verify_node()

Verifies that all attributes the node needs are there and that particular attributes are set correctly. Also checks if the number of inputs is equal to the expected number.

finn.custom_op.fpgadataflow.fmpadding_hls

class finn.custom_op.fpgadataflow.hls.fmpadding_hls.FMPadding_hls(onnx_node, **kwargs)

Bases: FMPadding, HLSBackend

Corresponds to finn-hlslib FMPadding_Batch function. Pads input image by given amount.

blackboxfunction()

Function to generate a blackbock function in c++ from which an IP block will be generated, is member function of HLSBackend class but has to be filled by every node.

defines(var)

Function to set the define commands for c++ code that has to be generated for cppsim or rtlsim, is member function of HLSBackend class but has to be filled by every node.

var: makes it possible to reuse the function for different c++ code generation. I.e. if set to “ipgen” in MatrixVectorActivation additional PRAGMA defines are added.

docompute()

Function to generate the commands for the computational part of the c++ code, is member function of HLSBackend class but has to be filled by every node.

execute_node(context, graph)

Execute this CustomOp instance, given the execution context and ONNX graph.

get_nodeattr_types()

Returns a dict of permitted attributes for node, where: ret_dict[attribute_name] = (dtype, require, default_value, <allowed_values>) - dtype indicates which member of the ONNX AttributeProto will be utilized - require indicates whether this attribute is required - default_val indicates the default value that will be used if the attribute is not set - <allowed_values> (if specified) indicates that this attribute can only be set to one of the values in the set <allowed_values>. If not specified, all values permitted by dtype are allowed.

global_includes()

Function to set the global includes for c++ code that has to be generated for cppsim or rtlsim, is member function of HLSBackend class but has to be filled by every node.

finn.custom_op.fpgadataflow.fmpadding_pixel_hls

class finn.custom_op.fpgadataflow.hls.fmpadding_pixel_hls.FMPadding_Pixel_hls(onnx_node, **kwargs)

Bases: FMPadding_Pixel, HLSBackend

blackboxfunction()

Function to generate a blackbock function in c++ from which an IP block will be generated, is member function of HLSBackend class but has to be filled by every node.

defines(var)

Function to set the define commands for c++ code that has to be generated for cppsim or rtlsim, is member function of HLSBackend class but has to be filled by every node.

var: makes it possible to reuse the function for different c++ code generation. I.e. if set to “ipgen” in MatrixVectorActivation additional PRAGMA defines are added.

docompute()

Function to generate the commands for the computational part of the c++ code, is member function of HLSBackend class but has to be filled by every node.

execute_node(context, graph)

Execute this CustomOp instance, given the execution context and ONNX graph.

get_nodeattr_types()

Returns a dict of permitted attributes for node, where: ret_dict[attribute_name] = (dtype, require, default_value, <allowed_values>) - dtype indicates which member of the ONNX AttributeProto will be utilized - require indicates whether this attribute is required - default_val indicates the default value that will be used if the attribute is not set - <allowed_values> (if specified) indicates that this attribute can only be set to one of the values in the set <allowed_values>. If not specified, all values permitted by dtype are allowed.

global_includes()

Function to set the global includes for c++ code that has to be generated for cppsim or rtlsim, is member function of HLSBackend class but has to be filled by every node.

finn.custom_op.fpgadataflow.globalaccpool_hls

class finn.custom_op.fpgadataflow.hls.globalaccpool_hls.GlobalAccPool_hls(onnx_node, **kwargs)

Bases: GlobalAccPool, HLSBackend

Class that corresponds to finn-hlslib AccPool_Batch function.

blackboxfunction()

Function to generate a blackbock function in c++ from which an IP block will be generated, is member function of HLSBackend class but has to be filled by every node.

defines(var)

Function to set the define commands for c++ code that has to be generated for cppsim or rtlsim, is member function of HLSBackend class but has to be filled by every node.

var: makes it possible to reuse the function for different c++ code generation. I.e. if set to “ipgen” in MatrixVectorActivation additional PRAGMA defines are added.

docompute()

Function to generate the commands for the computational part of the c++ code, is member function of HLSBackend class but has to be filled by every node.

execute_node(context, graph)

Execute this CustomOp instance, given the execution context and ONNX graph.

get_nodeattr_types()

Returns a dict of permitted attributes for node, where: ret_dict[attribute_name] = (dtype, require, default_value, <allowed_values>) - dtype indicates which member of the ONNX AttributeProto will be utilized - require indicates whether this attribute is required - default_val indicates the default value that will be used if the attribute is not set - <allowed_values> (if specified) indicates that this attribute can only be set to one of the values in the set <allowed_values>. If not specified, all values permitted by dtype are allowed.

global_includes()

Function to set the global includes for c++ code that has to be generated for cppsim or rtlsim, is member function of HLSBackend class but has to be filled by every node.

verify_node()

Verifies that all attributes the node needs are there and that particular attributes are set correctly. Also checks if the number of inputs is equal to the expected number.

finn.custom_op.fpgadataflow.iodma_hls

class finn.custom_op.fpgadataflow.hls.iodma_hls.IODMA_hls(onnx_node, **kwargs)

Bases: HWCustomOp, HLSBackend

Class that corresponds to finn-hlslib DMA function(s).

blackboxfunction()

Function to generate a blackbock function in c++ from which an IP block will be generated, is member function of HLSBackend class but has to be filled by every node.

defines(var)

Function to set the define commands for c++ code that has to be generated for cppsim or rtlsim, is member function of HLSBackend class but has to be filled by every node.

var: makes it possible to reuse the function for different c++ code generation. I.e. if set to “ipgen” in MatrixVectorActivation additional PRAGMA defines are added.

docompute()

Function to generate the commands for the computational part of the c++ code, is member function of HLSBackend class but has to be filled by every node.

execute_node(context, graph)

Execute this CustomOp instance, given the execution context and ONNX graph.

get_ap_int_max_w()

Return the maximum width of any ap_int used in this module.

get_folded_input_shape(ind=0)

Returns folded input shape (according to synapse folding), if implemented.

get_folded_output_shape(ind=0)

Returns folded output shape (according to neuron folding), if implemented.

get_input_datatype(ind=0)

Returns FINN DataType of input.

get_instream_width(ind=0)

Returns input stream width, if implemented.

get_nodeattr_types()

Returns a dict of permitted attributes for node, where: ret_dict[attribute_name] = (dtype, require, default_value, <allowed_values>) - dtype indicates which member of the ONNX AttributeProto will be utilized - require indicates whether this attribute is required - default_val indicates the default value that will be used if the attribute is not set - <allowed_values> (if specified) indicates that this attribute can only be set to one of the values in the set <allowed_values>. If not specified, all values permitted by dtype are allowed.

get_normal_input_shape(ind=0)

Returns normal input shape if implemented.

get_normal_output_shape(ind=0)

Returns folded output shape if implemented.

get_number_output_values()

Function to get the number of expected output values, is member function of HWCustomOp class but has to be filled by every node.

get_output_datatype(ind=0)

Returns FINN DataType of output. (Same as input datatype)

get_outstream_width(ind=0)

Returns output stream width, if implemented.

get_verilog_top_module_intf_names()

Return a dict of names of input and output interfaces. The keys reflect the protocols each interface implements: ‘clk’, ‘rst’, ‘m_axis’, ‘s_axis’, ‘aximm’, ‘axilite’. Values are lists of tuples (axis, aximm) or names (axilite): ‘axis’ tuples correspond to the list of node inputs in order, each tuple is (interface_name, interface_width_bits). axilite always assumed to be 32 bits and is not tuple (name only). Each block must have at most one aximm and one axilite.

global_includes()

Function to set the global includes for c++ code that has to be generated for cppsim or rtlsim, is member function of HLSBackend class but has to be filled by every node.

infer_node_datatype(model)

Set the DataType annotations corresponding to the outputs of this node.

make_shape_compatible_op(model)

Returns a standard ONNX op which is compatible with this CustomOp for performing shape inference.

pragmas()

Function to generate the pragma commands in c++, might need to be overwritten depending on custom op.

verify_node()

Verifies that all attributes the node needs are there and that particular attributes are set correctly. Also checks if the number of inputs is equal to the expected number.

finn.custom_op.fpgadataflow.labelselect_hls

class finn.custom_op.fpgadataflow.hls.labelselect_hls.LabelSelect_hls(onnx_node, **kwargs)

Bases: LabelSelect, HLSBackend

Class that corresponds to finn-hlslib LabelSelect_Batch function.

blackboxfunction()

Function to generate a blackbock function in c++ from which an IP block will be generated, is member function of HLSBackend class but has to be filled by every node.

defines(var)

Function to set the define commands for c++ code that has to be generated for cppsim or rtlsim, is member function of HLSBackend class but has to be filled by every node.

var: makes it possible to reuse the function for different c++ code generation. I.e. if set to “ipgen” in MatrixVectorActivation additional PRAGMA defines are added.

docompute()

Function to generate the commands for the computational part of the c++ code, is member function of HLSBackend class but has to be filled by every node.

execute_node(context, graph)

Execute this CustomOp instance, given the execution context and ONNX graph.

get_nodeattr_types()

Returns a dict of permitted attributes for node, where: ret_dict[attribute_name] = (dtype, require, default_value, <allowed_values>) - dtype indicates which member of the ONNX AttributeProto will be utilized - require indicates whether this attribute is required - default_val indicates the default value that will be used if the attribute is not set - <allowed_values> (if specified) indicates that this attribute can only be set to one of the values in the set <allowed_values>. If not specified, all values permitted by dtype are allowed.

global_includes()

Function to set the global includes for c++ code that has to be generated for cppsim or rtlsim, is member function of HLSBackend class but has to be filled by every node.

read_npy_data()

Function to generate the commands for reading data from .npy file in c++, might need to be overwritten depending on custom op.

verify_node()

Verifies that all attributes the node needs are there and that particular attributes are set correctly. Also checks if the number of inputs is equal to the expected number.

finn.custom_op.fpgadataflow.lookup_hls

class finn.custom_op.fpgadataflow.hls.lookup_hls.Lookup_hls(onnx_node, **kwargs)

Bases: Lookup, HLSBackend

Streaming elementwise HLS lookup, mapping indices to values.

blackboxfunction()

Function to generate a blackbock function in c++ from which an IP block will be generated, is member function of HLSBackend class but has to be filled by every node.

dataoutstrm()

Function to generate the commands for reading out data from c++ and convert into npy format, is member function of HLSBackend class might need to be filled by node.

defines(var)

Function to set the define commands for c++ code that has to be generated for cppsim or rtlsim, is member function of HLSBackend class but has to be filled by every node.

var: makes it possible to reuse the function for different c++ code generation. I.e. if set to “ipgen” in MatrixVectorActivation additional PRAGMA defines are added.

docompute()

Function to generate the commands for the computational part of the c++ code, is member function of HLSBackend class but has to be filled by every node.

execute_node(context, graph)

Execute this CustomOp instance, given the execution context and ONNX graph.

generate_params(model, path)

Function to generate parameters (i.e. weights and thresholds), is member function of HWCustomOp class but has to be filled by every node that needs to generate parameters.

get_ap_int_max_w()

Return the maximum width of any ap_int used in this module. Used to set the AP_INT_MAX_W definition for HLS.

get_nodeattr_types()

Returns a dict of permitted attributes for node, where: ret_dict[attribute_name] = (dtype, require, default_value, <allowed_values>) - dtype indicates which member of the ONNX AttributeProto will be utilized - require indicates whether this attribute is required - default_val indicates the default value that will be used if the attribute is not set - <allowed_values> (if specified) indicates that this attribute can only be set to one of the values in the set <allowed_values>. If not specified, all values permitted by dtype are allowed.

global_includes()

Function to set the global includes for c++ code that has to be generated for cppsim or rtlsim, is member function of HLSBackend class but has to be filled by every node.

pragmas()

Function to generate the pragma commands in c++, might need to be overwritten depending on custom op.

read_npy_data()

Function to generate the commands for reading data from .npy file in c++, might need to be overwritten depending on custom op.

finn.custom_op.fpgadataflow.matrixvectoractivation_hls

class finn.custom_op.fpgadataflow.hls.matrixvectoractivation_hls.MVAU_hls(onnx_node, **kwargs)

Bases: MVAU, HLSBackend

Corresponds to finn-hlslib MatrixVectorActivation_Batch function.

blackboxfunction()

Function to generate a blackbock function in c++ from which an IP block will be generated, is member function of HLSBackend class but has to be filled by every node.

dataoutstrm()

Function to generate the commands for reading out data from c++ and convert into npy format, is member function of HLSBackend class might need to be filled by node.

defines(var)

Function to set the define commands for c++ code that has to be generated for cppsim or rtlsim, is member function of HLSBackend class but has to be filled by every node.

var: makes it possible to reuse the function for different c++ code generation. I.e. if set to “ipgen” in MatrixVectorActivation additional PRAGMA defines are added.

docompute()

Function to generate the commands for the computational part of the c++ code, is member function of HLSBackend class but has to be filled by every node.

dsp_estimation()

Function for DSP resource estimation, is member function of HWCustomOp class but has to be filled by every node

execute_node(context, graph)

Execute this CustomOp instance, given the execution context and ONNX graph.

get_ap_int_max_w()

Return the maximum width of any ap_int used in this module. Used to set the AP_INT_MAX_W definition for HLS.

get_nodeattr_types()

Returns a dict of permitted attributes for node, where: ret_dict[attribute_name] = (dtype, require, default_value, <allowed_values>) - dtype indicates which member of the ONNX AttributeProto will be utilized - require indicates whether this attribute is required - default_val indicates the default value that will be used if the attribute is not set - <allowed_values> (if specified) indicates that this attribute can only be set to one of the values in the set <allowed_values>. If not specified, all values permitted by dtype are allowed.

get_template_param_values()

Returns the template parameter values according to input, output and weight data types.

global_includes()

Function to set the global includes for c++ code that has to be generated for cppsim or rtlsim, is member function of HLSBackend class but has to be filled by every node.

instantiate_ip(cmd)
lut_estimation()

Calculates resource estimations for LUTs based on: - FINN-R: An End-to-End Deep-Learning Framework for Fast Exploration of Quantized Neural Networks - M. Blott, T. B. Preusser, N. J. Fraser, G. Gambardella, K. O’Brien, Y. Umuroglu, M. Leeser and K. Vissers - 12. Sep 2018

pragmas()

Function to generate the pragma commands in c++, might need to be overwritten depending on custom op.

read_npy_data()

Function to generate the commands for reading data from .npy file in c++, might need to be overwritten depending on custom op.

save_as_npy()

Function to generate the commands for saving data in .npy file in c++

strm_decl()

Function to generate the commands for the stream declaration in c++, is member function of HLSBackend class but might need to be filled by node.

finn.custom_op.fpgadataflow.pool_hls

class finn.custom_op.fpgadataflow.hls.pool_hls.Pool_hls(onnx_node, **kwargs)

Bases: Pool, HLSBackend

Class that corresponds to finn-hlslib Pool_batch function. Requires ConvolutionInputGenerator(depthwise == 1) to format its input

Input shape (BatchSize,OutImgDim,OutImgDim,TotalKernelSize*Channels) Output shape (BatchSize,OutImgDim,OutImgDim,Channels)

Notes:

  • The input shape was chosen to be compatible with im2col (only true when there is not folding).

  • The actual data layout produced by the hlslib kernels is different for depthwise ops.

    • depthwise SWG: (1, OFMDim, OFMDim, IFMChannels/PE, K, K, PE)

Channels can be folded using PE (SIMD from the input perspective)

blackboxfunction()

Function to generate a blackbock function in c++ from which an IP block will be generated, is member function of HLSBackend class but has to be filled by every node.

dataoutstrm()

Function to generate the commands for reading out data from c++ and convert into npy format, is member function of HLSBackend class might need to be filled by node.

defines(var)

Function to set the define commands for c++ code that has to be generated for cppsim or rtlsim, is member function of HLSBackend class but has to be filled by every node.

var: makes it possible to reuse the function for different c++ code generation. I.e. if set to “ipgen” in MatrixVectorActivation additional PRAGMA defines are added.

docompute()

Function to generate the commands for the computational part of the c++ code, is member function of HLSBackend class but has to be filled by every node.

execute_node(context, graph)

Execute this CustomOp instance, given the execution context and ONNX graph.

get_nodeattr_types()

Returns a dict of permitted attributes for node, where: ret_dict[attribute_name] = (dtype, require, default_value, <allowed_values>) - dtype indicates which member of the ONNX AttributeProto will be utilized - require indicates whether this attribute is required - default_val indicates the default value that will be used if the attribute is not set - <allowed_values> (if specified) indicates that this attribute can only be set to one of the values in the set <allowed_values>. If not specified, all values permitted by dtype are allowed.

global_includes()

Function to set the global includes for c++ code that has to be generated for cppsim or rtlsim, is member function of HLSBackend class but has to be filled by every node.

read_npy_data()

Function to generate the commands for reading data from .npy file in c++, might need to be overwritten depending on custom op.

finn.custom_op.fpgadataflow.streamingdatawidthconverter_hls

class finn.custom_op.fpgadataflow.hls.streamingdatawidthconverter_hls.StreamingDataWidthConverter_hls(onnx_node, **kwargs)

Bases: StreamingDataWidthConverter, HLSBackend

Class that corresponds to finn-hlslib StreamingDataWidthConverter_Batch function.

blackboxfunction()

Function to generate a blackbock function in c++ from which an IP block will be generated, is member function of HLSBackend class but has to be filled by every node.

defines(var)

Function to set the define commands for c++ code that has to be generated for cppsim or rtlsim, is member function of HLSBackend class but has to be filled by every node.

var: makes it possible to reuse the function for different c++ code generation. I.e. if set to “ipgen” in MatrixVectorActivation additional PRAGMA defines are added.

docompute()

Function to generate the commands for the computational part of the c++ code, is member function of HLSBackend class but has to be filled by every node.

execute_node(context, graph)

Execute this CustomOp instance, given the execution context and ONNX graph.

get_nodeattr_types()

Returns a dict of permitted attributes for node, where: ret_dict[attribute_name] = (dtype, require, default_value, <allowed_values>) - dtype indicates which member of the ONNX AttributeProto will be utilized - require indicates whether this attribute is required - default_val indicates the default value that will be used if the attribute is not set - <allowed_values> (if specified) indicates that this attribute can only be set to one of the values in the set <allowed_values>. If not specified, all values permitted by dtype are allowed.

global_includes()

Function to set the global includes for c++ code that has to be generated for cppsim or rtlsim, is member function of HLSBackend class but has to be filled by every node.

pragmas()

Function to generate the pragma commands in c++, might need to be overwritten depending on custom op.

strm_decl()

Function to generate the commands for the stream declaration in c++, is member function of HLSBackend class but might need to be filled by node.

finn.custom_op.fpgadataflow.streamingeltwise_hls

class finn.custom_op.fpgadataflow.hls.streamingeltwise_hls.StreamingEltwise_hls(onnx_node, **kwargs)

Bases: StreamingEltwise, HLSBackend

Class that corresponds to finn-hlslib StreamingEltwise function.

blackboxfunction()

Function to generate a blackbock function in c++ from which an IP block will be generated, is member function of HLSBackend class but has to be filled by every node.

defines(var)

Function to set the define commands for c++ code that has to be generated for cppsim or rtlsim, is member function of HLSBackend class but has to be filled by every node.

var: makes it possible to reuse the function for different c++ code generation. I.e. if set to “ipgen” in MatrixVectorActivation additional PRAGMA defines are added.

docompute()

Function to generate the commands for the computational part of the c++ code, is member function of HLSBackend class but has to be filled by every node.

execute_node(context, graph)

Execute this CustomOp instance, given the execution context and ONNX graph.

get_nodeattr_types()

Returns a dict of permitted attributes for node, where: ret_dict[attribute_name] = (dtype, require, default_value, <allowed_values>) - dtype indicates which member of the ONNX AttributeProto will be utilized - require indicates whether this attribute is required - default_val indicates the default value that will be used if the attribute is not set - <allowed_values> (if specified) indicates that this attribute can only be set to one of the values in the set <allowed_values>. If not specified, all values permitted by dtype are allowed.

global_includes()

Function to set the global includes for c++ code that has to be generated for cppsim or rtlsim, is member function of HLSBackend class but has to be filled by every node.

pragmas()

Function to generate the pragma commands in c++, might need to be overwritten depending on custom op.

read_npy_data()

Function to generate the commands for reading data from .npy file in c++, might need to be overwritten depending on custom op.

strm_decl()

Function to generate the commands for the stream declaration in c++, is member function of HLSBackend class but might need to be filled by node.

verify_node()

Verifies that all attributes the node needs are there and that particular attributes are set correctly. Also checks if the number of inputs is equal to the expected number.

finn.custom_op.fpgadataflow.streamingmaxpool_hls

class finn.custom_op.fpgadataflow.hls.streamingmaxpool_hls.StreamingMaxPool_hls(onnx_node, **kwargs)

Bases: StreamingMaxPool, HLSBackend

Class that corresponds to finn-hlslib StreamingMaxPool_batch function.

blackboxfunction()

Function to generate a blackbock function in c++ from which an IP block will be generated, is member function of HLSBackend class but has to be filled by every node.

defines(var)

Function to set the define commands for c++ code that has to be generated for cppsim or rtlsim, is member function of HLSBackend class but has to be filled by every node.

var: makes it possible to reuse the function for different c++ code generation. I.e. if set to “ipgen” in MatrixVectorActivation additional PRAGMA defines are added.

docompute()

Function to generate the commands for the computational part of the c++ code, is member function of HLSBackend class but has to be filled by every node.

execute_node(context, graph)

Execute this CustomOp instance, given the execution context and ONNX graph.

get_nodeattr_types()

Returns a dict of permitted attributes for node, where: ret_dict[attribute_name] = (dtype, require, default_value, <allowed_values>) - dtype indicates which member of the ONNX AttributeProto will be utilized - require indicates whether this attribute is required - default_val indicates the default value that will be used if the attribute is not set - <allowed_values> (if specified) indicates that this attribute can only be set to one of the values in the set <allowed_values>. If not specified, all values permitted by dtype are allowed.

global_includes()

Function to set the global includes for c++ code that has to be generated for cppsim or rtlsim, is member function of HLSBackend class but has to be filled by every node.

verify_node()

Verifies that all attributes the node needs are there and that particular attributes are set correctly. Also checks if the number of inputs is equal to the expected number.

finn.custom_op.fpgadataflow.thresholding_hls

class finn.custom_op.fpgadataflow.hls.thresholding_hls.Thresholding_hls(onnx_node, **kwargs)

Bases: Thresholding, HLSBackend

Class that corresponds to finn-hls Thresholding_Batch function.

blackboxfunction()

Function to generate a blackbock function in c++ from which an IP block will be generated, is member function of HLSBackend class but has to be filled by every node.

bram_estimation()

Calculates BRAM cost if resource set to BRAM

code_generation_ipi()

Constructs and returns the TCL for node instantiation in Vivado IPI.

dataoutstrm()

Function to generate the commands for reading out data from c++ and convert into npy format, is member function of HLSBackend class might need to be filled by node.

defines(var)

Function to set the define commands for c++ code that has to be generated for cppsim or rtlsim, is member function of HLSBackend class but has to be filled by every node.

var: makes it possible to reuse the function for different c++ code generation. I.e. if set to “ipgen” in MatrixVectorActivation additional PRAGMA defines are added.

derive_characteristic_fxns(period)

Return the unconstrained characteristic functions for this node.

docompute()

Function to generate the commands for the computational part of the c++ code, is member function of HLSBackend class but has to be filled by every node.

execute_node(context, graph)

Execute this CustomOp instance, given the execution context and ONNX graph.

generate_params(model, path)

Function to generate parameters (i.e. weights and thresholds), is member function of HWCustomOp class but has to be filled by every node that needs to generate parameters.

get_ap_int_max_w()

Return the maximum width of any ap_int used in this module. Used to set the AP_INT_MAX_W definition for HLS.

get_nodeattr_types()

Returns a dict of permitted attributes for node, where: ret_dict[attribute_name] = (dtype, require, default_value, <allowed_values>) - dtype indicates which member of the ONNX AttributeProto will be utilized - require indicates whether this attribute is required - default_val indicates the default value that will be used if the attribute is not set - <allowed_values> (if specified) indicates that this attribute can only be set to one of the values in the set <allowed_values>. If not specified, all values permitted by dtype are allowed.

get_op_and_param_counts()

Return a dictionary with number of ops needed per inference for this layer as well as parameter count (weights, thresholds, etc.). Entries should be in the format: {op_<optype> : <count>, param_<paramtype>: <count>}.

get_template_param_values()

Returns the template parameter values according to input, output and weight data types.

get_verilog_top_module_intf_names()

Return a dict of names of input and output interfaces. The keys reflect the protocols each interface implements: ‘clk’, ‘rst’, ‘m_axis’, ‘s_axis’, ‘aximm’, ‘axilite’. Values are lists of tuples (axis, aximm) or names (axilite): ‘axis’ tuples correspond to the list of node inputs in order, each tuple is (interface_name, interface_width_bits). axilite always assumed to be 32 bits and is not tuple (name only). Each block must have at most one aximm and one axilite.

get_weightstream_width()

Returns weight stream width. Used only in internal_decoupled mode.

get_weightstream_width_padded()

Returns weight stream width padded to a multiple of 8. This is required by the AXI Stream spec. Used in internal_decoupled mode.

global_includes()

Function to set the global includes for c++ code that has to be generated for cppsim or rtlsim, is member function of HLSBackend class but has to be filled by every node.

ipgen_extra_directives()

Return a list of extra tcl directives for HLS synthesis.

lut_estimation()

Calculates LUT cost, taking memory resource type into account

make_weight_file(weights, weight_file_mode, weight_file_name)

Produce a file containing given weights (thresholds) in appropriate format for this layer. This file can be used for either synthesis or run-time reconfig of weights.

Arguments:

  • weights : numpy array with weights to be put into the file

  • weight_file_mode : one of {hls_header, decoupled_verilog_dat, decoupled_runtime}

  • weight_file_name : filename for the weight file to be generated

pragmas()

Function to generate the pragma commands in c++, might need to be overwritten depending on custom op.

read_npy_data()

Function to generate the commands for reading data from .npy file in c++, might need to be overwritten depending on custom op.

strm_decl()

Function to generate the commands for the stream declaration in c++, is member function of HLSBackend class but might need to be filled by node.

finn.custom_op.fpgadataflow.tlastmarker_hls

class finn.custom_op.fpgadataflow.hls.tlastmarker_hls.TLastMarker_hls(onnx_node, **kwargs)

Bases: HWCustomOp, HLSBackend

Node that adds/removes AXI stream TLAST signals where needed. Its behavior is transparent in node-by-node execution, only visible in IP-stitched rtlsim or actual hardware. This node may be needed at the end of the network to signal a DMA write (needed by the FINN PYNQ shell) or at the beginning to remove the end-of-burst from DMA read.

blackboxfunction()

Function to generate a blackbock function in c++ from which an IP block will be generated, is member function of HLSBackend class but has to be filled by every node.

dataoutstrm()

Function to generate the commands for reading out data from c++ and convert into npy format, is member function of HLSBackend class might need to be filled by node.

defines(var)

Function to set the define commands for c++ code that has to be generated for cppsim or rtlsim, is member function of HLSBackend class but has to be filled by every node.

var: makes it possible to reuse the function for different c++ code generation. I.e. if set to “ipgen” in MatrixVectorActivation additional PRAGMA defines are added.

docompute()

Function to generate the commands for the computational part of the c++ code, is member function of HLSBackend class but has to be filled by every node.

execute_node(context, graph)

Execute this CustomOp instance, given the execution context and ONNX graph.

get_folded_input_shape(ind=0)

Returns folded input shape (according to synapse folding), if implemented.

get_folded_output_shape(ind=0)

Returns folded output shape (according to neuron folding), if implemented.

get_instream_width(ind=0)

Returns input stream width, if implemented.

get_nodeattr_types()

Returns a dict of permitted attributes for node, where: ret_dict[attribute_name] = (dtype, require, default_value, <allowed_values>) - dtype indicates which member of the ONNX AttributeProto will be utilized - require indicates whether this attribute is required - default_val indicates the default value that will be used if the attribute is not set - <allowed_values> (if specified) indicates that this attribute can only be set to one of the values in the set <allowed_values>. If not specified, all values permitted by dtype are allowed.

get_number_output_values()

Function to get the number of expected output values, is member function of HWCustomOp class but has to be filled by every node.

get_outstream_width(ind=0)

Returns output stream width, if implemented.

get_verilog_top_module_intf_names()

Return a dict of names of input and output interfaces. The keys reflect the protocols each interface implements: ‘clk’, ‘rst’, ‘m_axis’, ‘s_axis’, ‘aximm’, ‘axilite’. Values are lists of tuples (axis, aximm) or names (axilite): ‘axis’ tuples correspond to the list of node inputs in order, each tuple is (interface_name, interface_width_bits). axilite always assumed to be 32 bits and is not tuple (name only). Each block must have at most one aximm and one axilite.

global_includes()

Function to set the global includes for c++ code that has to be generated for cppsim or rtlsim, is member function of HLSBackend class but has to be filled by every node.

infer_node_datatype(model)

Set the DataType annotations corresponding to the outputs of this node.

make_shape_compatible_op(model)

Returns a standard ONNX op which is compatible with this CustomOp for performing shape inference.

pragmas()

Function to generate the pragma commands in c++, might need to be overwritten depending on custom op.

read_npy_data()

Function to generate the commands for reading data from .npy file in c++, might need to be overwritten depending on custom op.

strm_decl()

Function to generate the commands for the stream declaration in c++, is member function of HLSBackend class but might need to be filled by node.

verify_node()

Verifies that all attributes the node needs are there and that particular attributes are set correctly. Also checks if the number of inputs is equal to the expected number.

finn.custom_op.fpgadataflow.upsampler_hls

class finn.custom_op.fpgadataflow.hls.upsampler_hls.UpsampleNearestNeighbour_hls(onnx_node, **kwargs)

Bases: UpsampleNearestNeighbour, HLSBackend

Corresponds to finn-hlslib UpsampleNearestNeighbour_Batch function. Upsampling is done with the Nearest Neighbour algorithm. The layer expects square feature maps for the in and output.

blackboxfunction()

Function to generate a blackbock function in c++ from which an IP block will be generated, is member function of HLSBackend class but has to be filled by every node.

defines(var)

Function to set the define commands for c++ code that has to be generated for cppsim or rtlsim, is member function of HLSBackend class but has to be filled by every node.

var: makes it possible to reuse the function for different c++ code generation. I.e. if set to “ipgen” in MatrixVectorActivation additional PRAGMA defines are added.

docompute()

Function to generate the commands for the computational part of the c++ code, is member function of HLSBackend class but has to be filled by every node.

execute_node(context, graph)

Execute this CustomOp instance, given the execution context and ONNX graph.

get_nodeattr_types()

Returns a dict of permitted attributes for node, where: ret_dict[attribute_name] = (dtype, require, default_value, <allowed_values>) - dtype indicates which member of the ONNX AttributeProto will be utilized - require indicates whether this attribute is required - default_val indicates the default value that will be used if the attribute is not set - <allowed_values> (if specified) indicates that this attribute can only be set to one of the values in the set <allowed_values>. If not specified, all values permitted by dtype are allowed.

global_includes()

Function to set the global includes for c++ code that has to be generated for cppsim or rtlsim, is member function of HLSBackend class but has to be filled by every node.

verify_node()

Verifies that all attributes the node needs are there and that particular attributes are set correctly. Also checks if the number of inputs is equal to the expected number.

finn.custom_op.fpgadataflow.vectorvectoractivation_hls

class finn.custom_op.fpgadataflow.hls.vectorvectoractivation_hls.VVAU_hls(onnx_node, **kwargs)

Bases: VVAU, HLSBackend

Corresponds to finn-hlslib Vector_Vector_Activate_Batch function

blackboxfunction()

Function to generate a blackbock function in c++ from which an IP block will be generated, is member function of HLSBackend class but has to be filled by every node.

dataoutstrm()

Function to generate the commands for reading out data from c++ and convert into npy format, is member function of HLSBackend class might need to be filled by node.

defines(var)

Function to set the define commands for c++ code that has to be generated for cppsim or rtlsim, is member function of HLSBackend class but has to be filled by every node.

var: makes it possible to reuse the function for different c++ code generation. I.e. if set to “ipgen” in MatrixVectorActivation additional PRAGMA defines are added.

docompute()

Function to generate the commands for the computational part of the c++ code, is member function of HLSBackend class but has to be filled by every node.

dsp_estimation()

Function for DSP resource estimation, is member function of HWCustomOp class but has to be filled by every node

execute_node(context, graph)

Execute this CustomOp instance, given the execution context and ONNX graph.

get_nodeattr_types()

Returns a dict of permitted attributes for node, where: ret_dict[attribute_name] = (dtype, require, default_value, <allowed_values>) - dtype indicates which member of the ONNX AttributeProto will be utilized - require indicates whether this attribute is required - default_val indicates the default value that will be used if the attribute is not set - <allowed_values> (if specified) indicates that this attribute can only be set to one of the values in the set <allowed_values>. If not specified, all values permitted by dtype are allowed.

get_template_param_values()

Returns the template parameter values according to input, output and weight data types.

global_includes()

Function to set the global includes for c++ code that has to be generated for cppsim or rtlsim, is member function of HLSBackend class but has to be filled by every node.

instantiate_ip(cmd)
lut_estimation()

Calculates resource estimations for LUTs based on: - FINN-R: An End-to-End Deep-Learning Framework for Fast Exploration of Quantized Neural Networks - M. Blott, T. B. Preusser, N. J. Fraser, G. Gambardella, K. O’Brien, Y. Umuroglu, M. Leeser and K. Vissers - 12. Sep 2018

pragmas()

Function to generate the pragma commands in c++, might need to be overwritten depending on custom op.

read_npy_data()

Function to generate the commands for reading data from .npy file in c++, might need to be overwritten depending on custom op.

save_as_npy()

Function to generate the commands for saving data in .npy file in c++

strm_decl()

Function to generate the commands for the stream declaration in c++, is member function of HLSBackend class but might need to be filled by node.