function enable = getEnableState(this, hParent, prop) %#ok
%GETENABLESTATE Get the enable state of the specified property widget.

%   Copyright 2008-2023 The MathWorks, Inc.
%     

enable = false;
archit = hParent.hArchit.Architecture;
filtobj = hParent.filterObj;
switch prop
    case 'ErrorMargin'
        if any(strcmpi(fieldnames(get(hParent.filterObj)),'Arithmetic')) && ...
           any(strcmpi(hParent.filterObj.arithmetic, {'fixed', 'int'})) && ... % fixed point AND either of following is true
              ( strcmpi(hParent.CLIProperties.OptimizeForHDL,'on')             || ... % optimizeforHDL is true
                ~strcmpi(hParent.CLIProperties.CoeffMultipliers, 'multiplier') || ... % CSD or Factored CSD
                ~strcmpi(hParent.CLIProperties.FIRAdderStyle, 'Linear')        || ... % FIR Adder style is tree
                ((isa(hParent.filterObj, 'dfilt.dffir')       ||                  ... filter is an FIR and add pipeline reg is true.
                    isa(hParent.filterObj, 'dfilt.dfasymfir') || ...
                    isa(hParent.filterObj, 'dfilt.dfsymfir')  || ...
                    isa(hParent.filterObj, 'dsp.internal.mfilt.firdecim')  || ...
                    isa(hParent.filterObj, 'dsp.internal.mfilt.firinterp') || ...
                    (isa(hParent.filterObj, 'dsp.internal.mfilt.linearinterp') && ~isa(hParent.filterObj, 'dsp.internal.mfilt.holdinterp'))) && ...
                  hParent.hArchitect.AddPipelineRegisters))                    || ...
                ~strcmpi(archit, 'Fully Parallel')                                    % non fully parallel architecture
            enable = true;
        end
    case 'TestbenchCoeffStimulus'
        enable = false;
        isIIR = fdhdlcoderui.isiirfilter(filtobj);
        if isa(filtobj, 'dfilt.dffir') || isa(filtobj, 'dfilt.dfsymfir')...
                    || isa(filtobj, 'dfilt.dfasymfir') || isIIR
        % for RAM coeff feature - see g351918
            if ~strcmpi(archit, 'Distributed arithmetic (DA)') && strcmpi(hParent.hArchit.CoefficientSource, 'Processor interface')
                enable = true;
            end
        end          
end

% [EOF]

% LocalWords:  optimizefor
