function myhdlsetup(model)
% HDLSETUP(MODEL) Set Simulink model parameters for HDL code generation.
%
%   hdlsetup('model') changes the parameters of the Simulink model specified by
%   the 'model' argument to values that are commonly used for HDL code
%   generation. The specified model should be open in Simulink before you invoke
%   the hdlsetup command. The hdlsetup command uses the Simulink set_param
%   function to set up models for HDL code generation quickly and
%   consistently. The model parameters settings provided by hdlsetup are
%   intended as useful defaults, but they may not be appropriate for all your
%   applications.
%
%   See also CHECKHDL, MAKEHDL, MAKEHDLTB.

%   Copyright 2005-2011 The MathWorks, Inc.
%     

if nargin < 1
    error(message('hdlcommon:hdlcommon:hdldeprecation'));
end

if ~ischar(model)
    warning(message('hdlcommon:hdlcommon:hdlsetup'));
    return
end

% Model Parameters
set_param(model, ...
    'SingleTaskRateTransMsg','error', ...
    'MultiTaskRateTransMsg', 'error', ...
    'SolverMode',            'SingleTasking', ...
    'FixedStep',             'auto', ...
    'AlgebraicLoopMsg',      'error', ...
    'InvariantConstants',    'on',...
    'SignalLogging',         'on',...
    'SampleTimeColors',      'on',...
    'ShowLineDimensions',    'on',...
    'ShowLineWidths',        'on',...
    'ShowPortDataTypes',     'on',...
    'BlockReductionOpt',     'off',...
    'ConditionallyExecuteInputs','off',...
    'InlineParams',          'on',...
    'ProdHWDeviceType',          'ASIC/FPGA->ASIC/FPGA',...
    'StrictBusMsg',              'ErrorLevel1',...
    'SignalLoggingSaveFormat',   'Dataset');

% following config parameters are disabled.
%     'Solver',                'fixedstepdiscrete', ...
%     'SaveTime',              'off', ...
%     'SaveOutput',            'off', ...
%     'DataTypeOverride',      'ForceOff',...

% Following model parameters are enabled.
set_param(model, 'ShowLineDimensions', 'on')
set_param(model, 'ShowPortDataTypes', 'on')
set_param(model, 'SampleTimeColors', 'on')
set_param(model, 'WideLines', 'on')

% Customization for HDL properties should be done to be efficient.
hdlset_param(model, ...
    'TargetLanguage', 'Verilog',...
    'GenerateValidationMode', 'on',...
    'Traceability' ,'on',...
    'ResourceReport', 'on',...
    'OptimizationReport' ,'on',...
    'HDLGenerateWebview', 'on',...
    'ResetType' ,'sync',...
    'HierarchicalDistPipelining', 'on',...
    'MinimizeClockEnables', 'on',...
	'MaskParameterAsGeneric','on',...
	'MinimizeIntermediateSignals','on',...
    'GenerateCosimModel', 'ModelSim',...
    'UseFileIOInTestBench' ,'on',...
    'AdaptivePipelining', 'off',...
    'ClockRatePipelining', 'off',...
    'ShareAdders', 'on',...
    'EnableTestpoints', 'on')
%   'Solver', 'fixedstepdiscrete', ...

% Attach HDL Coder specific settings and implementation bindings to this
% model
attachhdlcconfig(model);

% [EOF]
