function paramsTab = getTabDialogSchema(this, ~, hdlcc)
%

%   Copyright 2016-2023 The MathWorks, Inc.

tag = [getWidgetTagPrefix(this),'TgtSettingsPanel_'];
src = hdlcc.getCLI;
cs = hdlcc.getSourceObject.getConfigSet;
enableWidget = strcmpi(cs.ReadOnly, 'off');

% Target
targetsg = renderTargetSettingsGrp(this, tag, src, enableWidget);
objsg = renderObjectivesGrp(tag, src, enableWidget);

% Optimization
optsgs = builtOptGrps(this, src, enableWidget);
mcpsg = renderMcpGrp(this, src, enableWidget);

% Build the tabs with the additional settings grouped into three tabs
paramsTab.Items = [{targetsg} {objsg} optsgs {mcpsg}];
paramsTab.Name = DAStudio.message('HDLShared:hdldialog:hdltgtoptTargetAndOptimizations');

numGrps = length(paramsTab.Items);
paramsTab.LayoutGrid = [numGrps+1 1];
paramsTab.RowStretch = [zeros(1, numGrps) 1];
paramsTab.ColStretch = 0;

%% CSHTAG
paramsTab.Tag = [getWidgetTagPrefix(this) 'TargetSettingsPanel'];
end

function objsg = renderObjectivesGrp(tag, src, enableWidget)

currRow = 1;

% Target Frequency
targetFrequencyOP = 'TargetFrequency';
targetFrequency_lbl.Type = 'text';
targetFrequency_lbl.Name = DAStudio.message('HDLShared:hdldialog:hdltgtoptTargetFrequency');
targetFrequency_lbl.RowSpan = [currRow currRow];
targetFrequency_lbl.ColSpan = [1 1];

% targetFrequency.Name = DAStudio.message('HDLShared:hdldialog:hdlglblsettingBalanceDelays');
targetFrequency.Type = 'edit';
targetFrequency.ObjectProperty = targetFrequencyOP;
targetFrequency.Source = src;
targetFrequency.Tag = [tag targetFrequencyOP];
targetFrequency_lbl.Buddy = targetFrequency.Tag;
targetFrequency.RowSpan = [currRow currRow];
targetFrequency.ColSpan = [2 2];
targetFrequency.Mode = true;
targetFrequency.Enabled = enableWidget;

%
% Clock Frequency group
%
objsg.Type = 'group';
objsg.Name = DAStudio.message('HDLShared:hdldialog:hdltgtoptObjectiveSettings');
objsg.Items = {targetFrequency_lbl, targetFrequency};
objsg.LayoutGrid = [1 2];
objsg.ColStretch = [0 1];
objsg.Tag = [tag, 'ObjectiveSettingsGroup'];
end

%--------------------------------------------------------------------------
function grps = builtOptGrps(~, hObjCLI, enableWidget)
% Widgets on the "General" tab 
tag = 'ConfigSet_HDLCoder_OptSettingsPanel_Optimization_';
currRow = 1;

% Delay balancing
balanceDelaysOP = 'BalanceDelays';
balanceDelays.Name = DAStudio.message('HDLShared:hdldialog:hdlglblsettingBalanceDelays');
balanceDelays.Type = 'checkbox';
balanceDelays.ObjectProperty = balanceDelaysOP;
balanceDelays.Source = hObjCLI;
balanceDelays.Tag = [tag balanceDelaysOP];
balanceDelays.RowSpan = [currRow currRow];
balanceDelays.ColSpan = [1 1];
balanceDelays.Mode = true;
balanceDelays.Enabled = enableWidget;
balanceDelays.Visible = false;

% Multiplier partitioning threshold
multiplierPartitioningThresholdOP = 'MultiplierPartitioningThreshold';
multiplierPartitioningThreshold_lbl.Type = 'text';
multiplierPartitioningThreshold_lbl.Name = DAStudio.message('HDLShared:hdldialog:hdlglblsettingsMultiplierPartitioningThreshold');
multiplierPartitioningThreshold_lbl.RowSpan = [currRow currRow];
multiplierPartitioningThreshold_lbl.ColSpan = [2 2];

multiplierPartitioningThreshold.Type = 'edit';
multiplierPartitioningThreshold.ObjectProperty = multiplierPartitioningThresholdOP;
multiplierPartitioningThreshold.Tag = [tag multiplierPartitioningThreshold.ObjectProperty];
multiplierPartitioningThreshold_lbl.Buddy = multiplierPartitioningThreshold.Tag;
multiplierPartitioningThreshold.RowSpan = [currRow currRow];
multiplierPartitioningThreshold.ColSpan = [3 3];
multiplierPartitioningThreshold.Source = hObjCLI;
multiplierPartitioningThreshold.Mode = true;
currRow = currRow+1;

% MapPipelineDelaysToRAM
mapPipelineDelaysToRAMOP = 'MapPipelineDelaysToRAM';
mapPipelineDelaysToRAM.Name = DAStudio.message('HDLShared:hdldialog:hdlglblsettingsMapPipelineDelaysToRAM');
mapPipelineDelaysToRAM.Type = 'checkbox';
mapPipelineDelaysToRAM.ObjectProperty = mapPipelineDelaysToRAMOP;
mapPipelineDelaysToRAM.Source = hObjCLI;
mapPipelineDelaysToRAM.Tag = [tag mapPipelineDelaysToRAMOP];
mapPipelineDelaysToRAM.RowSpan = [currRow currRow];
mapPipelineDelaysToRAM.ColSpan = [1 1];
mapPipelineDelaysToRAM.Mode = true;
mapPipelineDelaysToRAM.Enabled = enableWidget;

%Ram threshold
ramThresholdOP = 'RAMMappingThreshold';
ramThreshold_lbl.Type = 'text';
ramThreshold_lbl.Name = DAStudio.message('HDLShared:hdldialog:hdlglblsettingsRAMThreshold');
ramThreshold_lbl.RowSpan = [currRow currRow];
ramThreshold_lbl.ColSpan = [2 2];

ramThreshold.Type = 'edit';
ramThreshold.ObjectProperty = ramThresholdOP;
ramThreshold.Tag = [tag ramThreshold.ObjectProperty];
ramThreshold_lbl.Buddy = ramThreshold.Tag;
ramThreshold.RowSpan = [currRow currRow];
ramThreshold.ColSpan = [3 3];
ramThreshold.Source = hObjCLI;
ramThreshold.Mode = true;
ramThreshold.Enabled = enableWidget;
currRow = currRow+1;

% Transform Non Zero Initial Value Delay
transformNonZeroInitValDelayOP = 'TransformNonZeroInitValDelay';
transformNonZeroInitValDelay.Name = DAStudio.message('HDLShared:hdldialog:hdlglblsettingTransformNonZeroInitValDelay');
transformNonZeroInitValDelay.Type = 'checkbox';
transformNonZeroInitValDelay.ObjectProperty = transformNonZeroInitValDelayOP;
transformNonZeroInitValDelay.Source = hObjCLI;
transformNonZeroInitValDelay.Tag = [tag transformNonZeroInitValDelayOP];
transformNonZeroInitValDelay.RowSpan = [currRow currRow];
transformNonZeroInitValDelay.ColSpan = [1 1];
transformNonZeroInitValDelay.Mode = true;
transformNonZeroInitValDelay.Enabled = enableWidget;
currRow = currRow+1;

% Remove unused blocks - to remain hidden until g2223080 is fixed
%removeUnusedBlocksOP = 'DeleteUnusedBlocks';
%removeUnusedBlocks.Name = DAStudio.message('HDLShared:hdldialog:hdlglblsettingsDeleteUnusedBlocks');
%removeUnusedBlocks.Type = 'checkbox';
%removeUnusedBlocks.ObjectProperty = deleteunusedblocksOP;
%removeUnusedBlocks.Source = hObjCLI;
%removeUnusedBlocks.Tag = [tag removeUnusedBlocksOP];
%removeUnusedBlocks.RowSpan = [currRow currRow];
%removeUnusedBlocks.ColSpan = [1 1];
%removeUnusedBlocks.Mode = true;
%removeUnusedBlocks.Enabled = enableWidget;
%currRow = currRow+1;

% Remove unused ports
DeleteUnusedBlocksEnabled = strcmpi(hObjCLI.DeleteUnusedBlocks, 'on');

removeUnusedPortsOP = 'DeleteUnusedPorts';
removeUnusedPorts.Name = DAStudio.message('HDLShared:hdldialog:hdlglblsettingsDeleteUnusedPorts');
removeUnusedPorts.Type = 'checkbox';
removeUnusedPorts.ObjectProperty = removeUnusedPortsOP;
removeUnusedPorts.Source = hObjCLI;
removeUnusedPorts.Tag = [tag removeUnusedPortsOP];
removeUnusedPorts.RowSpan = [currRow currRow];
removeUnusedPorts.ColSpan = [1 1];
removeUnusedPorts.Mode = true;
removeUnusedPorts.Enabled = DeleteUnusedBlocksEnabled & enableWidget;
currRow = currRow+1;


% Transform delays with control logic
% transformDelaysWithControlLogicOP = 'TransformDelaysWithControlLogic';
% transformDelaysWithControlLogic.Name = DAStudio.message('HDLShared:hdldialog:hdlglblsettingTransformDelaysWithControlLogic');
% transformDelaysWithControlLogic.Type = 'checkbox';
% transformDelaysWithControlLogic.ObjectProperty = transformDelaysWithControlLogicOP;
% transformDelaysWithControlLogic.Source = hObjCLI;
% transformDelaysWithControlLogic.Tag = [tag transformDelaysWithControlLogicOP];
% transformDelaysWithControlLogic.RowSpan = [currRow currRow];
% transformDelaysWithControlLogic.ColSpan = [1 1];
% transformDelaysWithControlLogic.Mode = true;
% transformDelaysWithControlLogic.Enabled = enableWidget;
% currRow = currRow+1;

% Enable optimizations between MATLAB Function blocks and Simulink
optimBetweenMATLABAndSimulinkOP = 'OptimBetweenMATLABAndSimulink';
optimBetweenMATLABAndSimulink.Name = DAStudio.message('HDLShared:hdldialog:hdlglblsettingOptimBetweenMATLABAndSimulink');
optimBetweenMATLABAndSimulink.Type = 'checkbox';
optimBetweenMATLABAndSimulink.ObjectProperty = optimBetweenMATLABAndSimulinkOP;
optimBetweenMATLABAndSimulink.Source = hObjCLI;
optimBetweenMATLABAndSimulink.Tag = [tag optimBetweenMATLABAndSimulinkOP];
optimBetweenMATLABAndSimulink.RowSpan = [currRow currRow];
optimBetweenMATLABAndSimulink.ColSpan = [1 1];
optimBetweenMATLABAndSimulink.Mode = true;
optimBetweenMATLABAndSimulink.Enabled = enableWidget;
optimBetweenMATLABAndSimulink.Visible = false;
currRow = currRow+1;

% Remove redundant counters
removeRedundantCountersOP = 'RemoveRedundantCounters';
removeRedundantCounters.Name = DAStudio.message('HDLShared:hdldialog:hdlglblsettingsRemoveRedundantCounters');
removeRedundantCounters.Type = 'checkbox';
removeRedundantCounters.ObjectProperty = removeRedundantCountersOP;
removeRedundantCounters.Source = hObjCLI;
removeRedundantCounters.Tag = [tag removeRedundantCountersOP];
removeRedundantCounters.RowSpan = [currRow currRow];
removeRedundantCounters.ColSpan = [1 1];
removeRedundantCounters.Mode = true;
removeRedundantCounters.Enabled = enableWidget;
removeRedundantCounters.Visible = false;

currRow = 1;
% Hierarchical Dist Pipelining
hierDistPipeOP = 'HierarchicalDistPipelining';
hierDistPipe.Name = DAStudio.message('HDLShared:hdldialog:hdlglblsettingHierDistPipelining');
hierDistPipe.Type = 'checkbox';
hierDistPipe.ObjectProperty = hierDistPipeOP;
hierDistPipe.Source = hObjCLI;
hierDistPipe.Tag = [tag hierDistPipeOP];
hierDistPipe.RowSpan = [currRow currRow];
hierDistPipe.ColSpan = [1 1];
hierDistPipe.Mode = true;
hierDistPipe.Enabled = enableWidget;

% Dist Pipelining Priority
distPipePriority_cbOP = 'DistributedPipeliningPriority';
distPipePriority_lbl.Type = 'text';
distPipePriority_lbl.Name = DAStudio.message('HDLShared:hdldialog:hdlglblsettingsDistributedPipeliningPriority');
distPipePriority_lbl.RowSpan = [currRow currRow];
distPipePriority_lbl.ColSpan = [2 2];

distPipePriority_cb.Type = 'combobox';
distPipePriority_cb.ObjectProperty = distPipePriority_cbOP;
distPipePriority_cb.Tag = [tag distPipePriority_cb.ObjectProperty];
distPipePriority_lbl.Buddy = distPipePriority_cb.Tag;
distPipePriority_cb.RowSpan = [currRow currRow];
distPipePriority_cb.ColSpan = [3 3];
distPipePriority_cb.Source = hObjCLI;
distPipePriority_cb.Mode = true;
distPipePriority_cb.Enabled = enableWidget;
distPipePriority_cb.Entries = {'Numerical Integrity','Performance'};
currRow = currRow+1;

% Clock rate pipelining
clockRatePipeliningOP = 'ClockRatePipelining';
clockRatePipelining.Name = DAStudio.message('HDLShared:hdldialog:hdlglblsettingClockRatePipelining');
clockRatePipelining.Type = 'checkbox';
clockRatePipelining.ObjectProperty = clockRatePipeliningOP;
clockRatePipelining.Source = hObjCLI;
clockRatePipelining.Tag = [tag clockRatePipeliningOP];
clockRatePipelining.RowSpan = [currRow currRow];
clockRatePipelining.ColSpan = [1 1];
clockRatePipelining.Mode = true;
clockRatePipelining.Enabled = enableWidget;
currRow = currRow+1;

% Clock rate pipelining
aggressiveclockRatePipeliningOP = 'ClockRatePipelineOutputPorts';
aggressiveclockRatePipelining.Name = DAStudio.message('HDLShared:hdldialog:hdlglblsettingAggressiveClockRatePipelining');
aggressiveclockRatePipelining.Type = 'checkbox';
aggressiveclockRatePipelining.ObjectProperty = aggressiveclockRatePipeliningOP;
aggressiveclockRatePipelining.Source = hObjCLI;
aggressiveclockRatePipelining.Tag = [tag aggressiveclockRatePipeliningOP];
aggressiveclockRatePipelining.RowSpan = [currRow currRow];
aggressiveclockRatePipelining.ColSpan = [1 2];
aggressiveclockRatePipelining.Mode = true;
aggressiveclockRatePipelining.Enabled = enableWidget;
currRow = currRow+1;

if strcmpi(hObjCLI.ClockRatePipelining, 'off')
    aggressiveclockRatePipelining.Enabled = false;
end

% Preserve Design Delays
preserveDesignDelaysOP = 'PreserveDesignDelays';
preserveDesignDelays.Name = DAStudio.message('HDLShared:hdldialog:hdlglblsettingPreserveDesignDelays');
preserveDesignDelays.Type = 'checkbox';
preserveDesignDelays.ObjectProperty = preserveDesignDelaysOP;
preserveDesignDelays.Source = hObjCLI;
preserveDesignDelays.Tag = [tag preserveDesignDelaysOP];
preserveDesignDelays.RowSpan = [currRow currRow];
preserveDesignDelays.ColSpan = [1 1];
preserveDesignDelays.Mode = true;
preserveDesignDelays.Enabled = enableWidget;
currRow = currRow+1;

% Adaptive Pipelining
adaptivePipeliningOP = 'AdaptivePipelining';
adaptivePipelining.Name = DAStudio.message('HDLShared:hdldialog:hdlglblsettingAdaptivePipelining');
adaptivePipelining.Type = 'checkbox';
adaptivePipelining.ObjectProperty = adaptivePipeliningOP;
adaptivePipelining.Source = hObjCLI;
adaptivePipelining.Tag = [tag adaptivePipeliningOP];
adaptivePipelining.RowSpan = [currRow currRow];
adaptivePipelining.ColSpan = [1 1];
adaptivePipelining.Mode = true;
adaptivePipelining.Enabled = enableWidget;
currRow = currRow+1; 

currRow = 1;
% Enable adder sharing
shareAddersOP = 'ShareAdders';
shareAdders.Name = DAStudio.message('HDLShared:hdldialog:hdlglblsettingsShareAdders');
shareAdders.Type = 'checkbox';
shareAdders.ObjectProperty = shareAddersOP;
shareAdders.Source = hObjCLI;
shareAdders.Tag = [tag shareAddersOP];
shareAdders.RowSpan = [currRow currRow];
shareAdders.ColSpan = [1 1];
shareAdders.Mode = true;
shareAdders.Enabled = enableWidget;
shareAdders.DialogRefresh = true;

adderSharingEnabled = strncmpi('ON', hObjCLI.ShareAdders, length(hObjCLI.ShareAdders));

% Adder sharing threshold
AdderSharingMinimumBitwidthOP = 'AdderSharingMinimumBitwidth';
adderSharingMinimumBitwidth_lbl.Type = 'text';
adderSharingMinimumBitwidth_lbl.Name = DAStudio.message('HDLShared:hdldialog:hdlglblsettingsAdderSharingMinimumBitwidth');
adderSharingMinimumBitwidth_lbl.RowSpan = [currRow currRow];
adderSharingMinimumBitwidth_lbl.ColSpan = [2 2];
adderSharingMinimumBitwidth_lbl.DialogRefresh = true;

adderSharingMinimumBitwidth.Type = 'edit';
adderSharingMinimumBitwidth.ObjectProperty = AdderSharingMinimumBitwidthOP;
adderSharingMinimumBitwidth.Tag = [tag adderSharingMinimumBitwidth.ObjectProperty];
adderSharingMinimumBitwidth_lbl.Buddy = adderSharingMinimumBitwidth.Tag;
adderSharingMinimumBitwidth.RowSpan = [currRow currRow];
adderSharingMinimumBitwidth.ColSpan = [3 3];
adderSharingMinimumBitwidth.Source = hObjCLI;
adderSharingMinimumBitwidth.Mode = true;
adderSharingMinimumBitwidth.Enabled = enableWidget & adderSharingEnabled;
adderSharingMinimumBitwidth.DialogRefresh = true;
currRow = currRow+1;

% Enable multiplier sharing
shareMultipliersOP = 'ShareMultipliers';
shareMultipliers.Name = DAStudio.message('HDLShared:hdldialog:hdlglblsettingsShareMultipliers');
shareMultipliers.Type = 'checkbox';
shareMultipliers.ObjectProperty = shareMultipliersOP;
shareMultipliers.Source = hObjCLI;
shareMultipliers.Tag = [tag shareMultipliersOP];
shareMultipliers.RowSpan = [currRow currRow];
shareMultipliers.ColSpan = [1 1];
shareMultipliers.Mode = true;
shareMultipliers.Enabled = enableWidget;
shareMultipliers.DialogRefresh = true;

multiplierSharingEnabled = strncmpi('ON', hObjCLI.ShareMultipliers, length(hObjCLI.ShareMultipliers));

% Multiplier sharing threshold
MultiplierSharingMinimumBitwidthOP = 'MultiplierSharingMinimumBitwidth';
multiplierSharingMinimumBitwidth_lbl.Type = 'text';
multiplierSharingMinimumBitwidth_lbl.Name = DAStudio.message('HDLShared:hdldialog:hdlglblsettingsMultiplierSharingMinimumBitwidth');
multiplierSharingMinimumBitwidth_lbl.RowSpan = [currRow currRow];
multiplierSharingMinimumBitwidth_lbl.ColSpan = [2 2];

multiplierSharingMinimumBitwidth.Type = 'edit';
multiplierSharingMinimumBitwidth.ObjectProperty = MultiplierSharingMinimumBitwidthOP;
multiplierSharingMinimumBitwidth.Tag = [tag multiplierSharingMinimumBitwidth.ObjectProperty];
multiplierSharingMinimumBitwidth_lbl.Buddy = multiplierSharingMinimumBitwidth.Tag;
multiplierSharingMinimumBitwidth.RowSpan = [currRow currRow];
multiplierSharingMinimumBitwidth.ColSpan = [3 3];
multiplierSharingMinimumBitwidth.Source = hObjCLI;
multiplierSharingMinimumBitwidth.Mode = true;
multiplierSharingMinimumBitwidth.Enabled = enableWidget & multiplierSharingEnabled;
multiplierSharingMinimumBitwidth.DialogRefresh = true;
currRow = currRow+1;


% Multiplier sharing threshold
MultiplierPromotionThresholdOP = 'MultiplierPromotionThreshold';
multiplierPromotionThreshold_lbl.Type = 'text';
multiplierPromotionThreshold_lbl.Name = DAStudio.message('HDLShared:hdldialog:hdlglblsettingsMultiplierPromotionThreshold');
multiplierPromotionThreshold_lbl.RowSpan = [currRow currRow];
multiplierPromotionThreshold_lbl.ColSpan = [2 2];

multiplierPromotionThreshold.Type = 'edit';
multiplierPromotionThreshold.ObjectProperty = MultiplierPromotionThresholdOP;
multiplierPromotionThreshold.Tag = [tag multiplierPromotionThreshold.ObjectProperty];
multiplierPromotionThreshold_lbl.Buddy = multiplierPromotionThreshold.Tag;
multiplierPromotionThreshold.RowSpan = [currRow currRow];
multiplierPromotionThreshold.ColSpan = [3 3];
multiplierPromotionThreshold.Source = hObjCLI;
multiplierPromotionThreshold.Mode = true;
multiplierPromotionThreshold.Enabled = enableWidget & multiplierSharingEnabled;
multiplierPromotionThreshold.DialogRefresh = true;
currRow = currRow+1;


% Enable multiplyAdd sharing
shareMultiplyAddsOP = 'ShareMultiplyAdds';
shareMultiplyAdds.Name = DAStudio.message('HDLShared:hdldialog:hdlglblsettingsShareMultiplyAdds');
shareMultiplyAdds.Type = 'checkbox';
shareMultiplyAdds.ObjectProperty = shareMultiplyAddsOP;
shareMultiplyAdds.Source = hObjCLI;
shareMultiplyAdds.Tag = [tag shareMultiplyAddsOP];
shareMultiplyAdds.RowSpan = [currRow currRow];
shareMultiplyAdds.ColSpan = [1 1];
shareMultiplyAdds.Mode = true;
shareMultiplyAdds.Enabled = enableWidget;
shareMultiplyAdds.DialogRefresh = true;

multiplyAddSharingEnabled = strncmpi('ON', hObjCLI.ShareMultiplyAdds, length(hObjCLI.ShareMultiplyAdds));

% MultiplyAdd sharing threshold
MultiplyAddSharingMinimumBitwidthOP = 'MultiplyAddSharingMinimumBitwidth';
multiplyAddSharingMinimumBitwidth_lbl.Type = 'text';
multiplyAddSharingMinimumBitwidth_lbl.Name = DAStudio.message('HDLShared:hdldialog:hdlglblsettingsMultiplyAddSharingMinimumBitwidth');
multiplyAddSharingMinimumBitwidth_lbl.RowSpan = [currRow currRow];
multiplyAddSharingMinimumBitwidth_lbl.ColSpan = [2 2];

multiplyAddSharingMinimumBitwidth.Type = 'edit';
multiplyAddSharingMinimumBitwidth.ObjectProperty = MultiplyAddSharingMinimumBitwidthOP;
multiplyAddSharingMinimumBitwidth.Tag = [tag multiplyAddSharingMinimumBitwidth.ObjectProperty];
multiplyAddSharingMinimumBitwidth_lbl.Buddy = multiplyAddSharingMinimumBitwidth.Tag;
multiplyAddSharingMinimumBitwidth.RowSpan = [currRow currRow];
multiplyAddSharingMinimumBitwidth.ColSpan = [3 3];
multiplyAddSharingMinimumBitwidth.Source = hObjCLI;
multiplyAddSharingMinimumBitwidth.Mode = true;
multiplyAddSharingMinimumBitwidth.Enabled = enableWidget & multiplyAddSharingEnabled;
multiplyAddSharingMinimumBitwidth.DialogRefresh = true;
currRow = currRow+1;

% Enable atomic subsystem sharing
shareAtomicSubsystemsOP = 'ShareAtomicSubsystems';
shareAtomicSubsystems.Name = DAStudio.message('HDLShared:hdldialog:hdlglblsettingsShareAtomicSubsystems');
shareAtomicSubsystems.Type = 'checkbox';
shareAtomicSubsystems.ObjectProperty = shareAtomicSubsystemsOP;
shareAtomicSubsystems.Source = hObjCLI;
shareAtomicSubsystems.Tag = [tag shareAtomicSubsystemsOP];
shareAtomicSubsystems.RowSpan = [currRow currRow];
shareAtomicSubsystems.ColSpan = [1 1];
shareAtomicSubsystems.Mode = true;
shareAtomicSubsystems.Enabled = enableWidget;
currRow = currRow+1;

% Enable MATLAB function block sharing
shareMATLABBlocksOP = 'ShareMATLABBlocks';
shareMATLABBlocks.Name = DAStudio.message('HDLShared:hdldialog:hdlglblsettingsShareMATLABBlocks');
shareMATLABBlocks.Type = 'checkbox';
shareMATLABBlocks.ObjectProperty = shareMATLABBlocksOP;
shareMATLABBlocks.Source = hObjCLI;
shareMATLABBlocks.Tag = [tag shareMATLABBlocksOP];
shareMATLABBlocks.RowSpan = [currRow currRow];
shareMATLABBlocks.ColSpan = [1 1];
shareMATLABBlocks.Mode = true;
shareMATLABBlocks.Enabled = enableWidget;
currRow = currRow+1;


% Enable floating-point IP sharing
shareFloatingPointIPsOP = 'ShareFloatingPointIPs';
shareFloatingPointIPs.Name = DAStudio.message('HDLShared:hdldialog:hdlglblsettingsShareFloatingPointIPs');
shareFloatingPointIPs.Type = 'checkbox';
shareFloatingPointIPs.ObjectProperty = shareFloatingPointIPsOP;
shareFloatingPointIPs.Source = hObjCLI;
shareFloatingPointIPs.Tag = [tag shareFloatingPointIPsOP];
shareFloatingPointIPs.RowSpan = [currRow currRow];
shareFloatingPointIPs.ColSpan = [1 1];
shareFloatingPointIPs.Mode = true;
shareFloatingPointIPs.Enabled = enableWidget;
currRow = currRow+1;

spacer.Type = 'text';
spacer.Name = ' ';
spacer.RowSpan = [currRow currRow];
spacer.ColSpan = [1 1]; %#ok<STRNU>

geng.Type = 'group';
geng.Items = {balanceDelays, mapPipelineDelaysToRAM, removeRedundantCounters,... 
              multiplierPartitioningThreshold_lbl, multiplierPartitioningThreshold, ... 
              ramThreshold_lbl, ramThreshold, transformNonZeroInitValDelay,...
               removeUnusedPorts, optimBetweenMATLABAndSimulink};
geng.LayoutGrid = [4 3];
pipg.RowStretch = [0 0 0 0 1];
geng.ColStretch = [0 0 1];
geng.Tag = [tag, 'GeneralOptimsSettingsGroup'];

pipg.Type = 'group';
% pipg.Name = DAStudio.message('HDLShared:hdldialog:hdlglblsettingPipelineSettingsGroup');
pipg.Items = {hierDistPipe, distPipePriority_lbl, distPipePriority_cb, clockRatePipelining,...
     aggressiveclockRatePipelining, preserveDesignDelays, adaptivePipelining};
pipg.LayoutGrid = [6 3];
pipg.RowStretch = [0 0 0 0 0 1];
pipg.ColStretch = [1 0 0];
pipg.Tag = [tag, 'PipelineSettingsGroup'];

rsg.Type = 'group';
% rsg.Name = DAStudio.message('HDLShared:hdldialog:hdlglblsettingResourceSharingSettingsGroup');
rsg.Items = {adderSharingMinimumBitwidth_lbl, adderSharingMinimumBitwidth, shareAdders,...
    multiplierSharingMinimumBitwidth_lbl, multiplierSharingMinimumBitwidth, shareMultipliers,...
    multiplierPromotionThreshold_lbl, multiplierPromotionThreshold,...
    multiplyAddSharingMinimumBitwidth_lbl, multiplyAddSharingMinimumBitwidth, shareMultiplyAdds,...
    shareMATLABBlocks, shareAtomicSubsystems, shareFloatingPointIPs };
rsg.LayoutGrid = [6 3];
rsg.RowStretch = [zeros(1,5) 1];
rsg.ColStretch = [1 0 0];
rsg.Tag = [tag, 'ResourceSharingSettingsGroup'];

genTab.Name = DAStudio.message('HDLShared:hdldialog:hdltgtoptGeneralOptimizations');
genTab.Items = {geng};

pipTab.Name = DAStudio.message('HDLShared:hdldialog:hdlglblsettingPipelineSettingsGroup');
pipTab.Items = {pipg};

rsTab.Name = DAStudio.message('HDLShared:hdldialog:hdlglblsettingResourceSharingSettingsGroup');
rsTab.Items = {rsg};

tabBody.Type = 'tab';
tabBody.Tabs = {genTab,pipTab,rsTab};
tabBody.Tag = [tag, 'Body'];

% tabBody.TabChangedCallback = 'hdlcoderui.changehdlconfigtab'; 

tabg.Type = 'group';
tabg.Name = DAStudio.message('HDLShared:hdldialog:hdltgtoptOptimizations');
tabg.Items = {tabBody};
tabg.LayoutGrid = [1 1];

grps = {tabg};
end

function mcpsg = renderMcpGrp(~, src, enableWidget)

tag = 'ConfigSet_HDLCoder_OptSettingsPanel_Multicycle_';

% Generate Multicycle Constraints (case 3)
currRow = 1;
MulticyclePathConstraintsOP = 'MulticyclePathConstraints';
MulticyclePathConstraints1.Name = DAStudio.message('HDLShared:hdldialog:hdlglblsettingMulticyclePathConstraints');
MulticyclePathConstraints1.Type = 'checkbox';
MulticyclePathConstraints1.ObjectProperty = MulticyclePathConstraintsOP;
MulticyclePathConstraints1.Source = src;
MulticyclePathConstraints1.Tag = [tag MulticyclePathConstraintsOP];
MulticyclePathConstraints1.RowSpan = [currRow currRow];
MulticyclePathConstraints1.ColSpan = [1 1];
MulticyclePathConstraints1.Mode = true;
MulticyclePathConstraints1.Enabled = enableWidget;

% Multicycle Constraint group (case 3)
mcpsg.Type = 'group';
mcpsg.Name = DAStudio.message('HDLShared:hdldialog:hdltgtoptMulticycleSettings');
mcpsg.Items = {MulticyclePathConstraints1};
mcpsg.LayoutGrid = [1 2];
mcpsg.ColStretch = [0 1];
mcpsg.Tag = [tag, 'MulticycleSettingsGroup'];

end

% LocalWords:  Tgt hdltgtopt Hier Bitwidth IPs Optims pipg rsg
