function  hdlblkmask_mathlib_validate(block_name)
% Validate ports settings on HDLMathLib library

% Copyright 2020-2022 The MathWorks, Inc.
cObj= Simulink.DataConstraints;
% get the ports vector
phs = get_param(gcb, 'Ports');
% define the allowed data types for the  first data port
cObj.DataTypes = {'int8','int16','int32','int64','uint8','uint16','uint32','uint64','fixpt-binary'}; 
setDataConstraintsToPort(cObj,block_name,"Input",1);
if(phs(1)==3)
    % if the number of ports are three 2nd port is data port and it has
    % same data types as the first
    setDataConstraintsToPort(cObj,block_name,"Input",2);
    % define the 3rd port (control port ) allowed data type only boolean is
    % allowed and DataConstraints does not have method restrict the
    % fractional part for ufix1 like ufix(0,1,-7) and ufix1(0,1,9)
    % so used only boolean
    cObj.DataTypes = {'bool'};
    setDataConstraintsToPort(cObj,block_name,"Input",3);
else
    % if number of ports are 2 then second port is control port
    cObj.DataTypes = {'bool'};
    setDataConstraintsToPort(cObj,block_name,"Input",2);
end

end

