Finding index of the negative value in Queue

In reply to Manoj J:

Works for me. How about showing us a complete example? Mine was 5 lines (and 2 of them were module top; endmodule).