In reply to vijay0210:
The $display is shown in your log-file only. You can write a parser for this statement and stop the simulation from your log-file.
But the check which is behind your $display is evaluating variables or signals iny our DUT. I meant you can connect to exactly these items.