In reply to OmerTariq:
``` verilog
task count_pulses(input <input signal (e.g. pulse) from monitor>)
int pulse_cnt = 0;
forever @pulse
pulse_cnt = pulse_cnt+1;
endtask
This task needs to be forked outside with raise and drop objections..