%% Create Floating-Point Configuration with Native Floating Point and Generate Code
% This example shows how to create a floating-point target configuration
% with the native floating-point support in HDL Coder, and then generate code.
%% Create a Floating-Point Target Configuration
% To create a floating-point configuration, use 
% hdlcoder.createFloatingPointTargetConfig.
load_system('sfir_single');
fpconfig = hdlcoder.createFloatingPointTargetConfig('NATIVEFLOATINGPOINT')

%% Specify Custom Library Settings
% Optionally, to customize the floating-point configuration,
% specify custom library settings. 
fpconfig.LibrarySettings.HandleDenormals = 'off';
fpconfig.LibrarySettings.LatencyStrategy = 'MIN';
fpconfig.LibrarySettings.MantissaMultiplyStrategy = 'NoMultiplierFullAddShift';
fpconfig.LibrarySettings

%% View Latency of Native Floating Point Operators
% The IPConfig object displays the maximum amd minimum latency values of
% the floating-point operators.
fpconfig.IPConfig

%% Generate Code
makehdl('sfir_single/symmetric_fir','FloatingPointTargetConfiguration',fpconfig, ...
                    'TargetDirectory','C:/NativeFloatingPoint/hdlsrc')
                
%%
% The generated VHDL code is saved in the |hdlsrc| folder.



%% 
% Copyright 2012 The MathWorks, Inc.