Hi Manu,
In the pasted Modelica text you are using a DigitalOutput. If this is what you want the Modelica.Electrical.Digital.Converters.RealToLogic converts between a real valued signal and a digital interface.
In the attached model you are using RealInput and BooleanOutput that seems to be constructed to switch between true and false depending on a threshold value (2^2) Is that the type of component you want? If so, I'd recommend to use the Modelica.Blocks.Logical.GreaterEqualThreshold component instead, which does that.