%% Estimate Resource Utilization for Custom Board and Reference Design
% Rapidly prototype the deployment of deep learning networks to your custom board by using the estimateResources function. Estimate the resource utilization of the deep learning processor configuration for your custom board. Optimize the integration of custom IP cores and reference design into your system by using the estimateResources function to estimate the resource utilization of your reference design. The synthesis tool that you use must be in the list of tools supported by the SynthesisTool property of the dlhdl.ProcessorConfig object. For a list of supported tools and device families, see SynthesisTool and SynthesisToolChipFamily.
% In this example, estimate the resource utilization for your custom board that has the Kintex® Ultrascale+™ chip family. Also estimate the resource utilization of the reference design for the Xilinx® Zynq® Ultrascale+™ MPSoC ZCU102 board.
%
%% Prerequisites
% Deep Learning HDL Toolbox™
% Deep Learning HDL Toolbox™ Support Package for Xilinx FPGA and SoC
% HDL Coder™
%
%% Estimate Resource Utilization for Kintex® Ultrascale+™ Board
% To estimate the resource utilization for your custom board that has a Kintex® Ultrascale+™ chip family , use the estimateResource function of the dlhdl.ProcessorConfig object.
% Add the dlhdl_device_registration.m file to the MATLAB® search path.
% Create a dlhdl.ProcessorConfig object.
% Update the SynthesisToolChipFamily and SynthesisToolDevicename properties of the dlhdl.ProcessorConfig object.
% Use the estimateResources function to retrieve the resource utilization for your custom board.
% Deep Learning HDL Toolbox™ does not support lookup table (LUT) estimation for custom boards.

hPC = dlhdl.ProcessorConfig;
hPC.SynthesisToolChipFamily = 'Kintex Ultrascale+';
hPC.SynthesisToolDeviceName = 'xcku11p-ffva1156-1-e';
hPC.estimateResources

%
%% Estimate Resource Utilization for Custom Reference Design
% Estimate the resource utilization for a reference design that you want to integrate into your system that has a Xilinx® Zynq® Ultrascale+™ MPSoC ZCU102 board. Use the estimateResource function with the IncludeReferenceDesign name-value argument. The estimateResources function uses the ResourcesUsed.LogicElements, ResourcesUsed.DSP, and ResourcesUsed.RAM information in the reference design plugin file to perform the resource estimation. To estimate resource utilization for your custom reference design, you must populate your reference design file with values for ResourcesUsed.LogicElements, ResourcesUsed.DSP, and ResourcesUsed.RAM. See ResourcesUsed. The reference design used in this code is located at $supportpackageinstallationfolder/Xilinx/boards/+DLZCU102/+matlab_libiio_3axi4_master_2019_1/plugin_rd.m.

hPC_referencedesign = dlhdl.ProcessorConfig;
hPC_referencedesign.estimateResources('IncludeReferenceDesign',true)

% The estimateResources function returns the resource utilization for the reference design and for the deep learning processor configuration.
%
%% Supporting Files
%% Device Registration File
% Use the dlhdl_device_registration.m file to register a custom device family. Estimate the resource utilization of the custom device by using the estimateResources function.

type dlhdl_device_registration.m

%
%
%
% Copyright 2020 The MathWorks, Inc.