In reply to dave_59:
I was trying to do the exercises in the chris spear’s book
``` verilog
module queue_prblm8;
int queue[3]='{2,-1,127};
initial begin
$display("Sum of the queue is %0d",queue.sum());
queue.sort;
$display("Min value in the queue is %0d",queue[0]);
$display("Max value in the queue is %0d",queue[3]);
$display("Queue after sorting is %p",queue);
$display("Index of the negative value %d",queue.find_first_index(x) with (x < 0));
$display("Positive values in the queue is %p",(queue.find() with (item > 0)));
queue.reverse;
$display("queue after reversing %p",queue);
end
endmodule
This is the code and i am using synopsys simulator
> Sum of the queue is 128
...
Index of the negative value 166757000
and this is the output i am getting