Hi All,
I have tried to understand try_get method of the IEEE LRM STD-1800:
In the LRM try_get method of the mailbox it is mentioned as “If the type of the message variable is not equivalent to the type of the message in the
mailbox, the method returns a negative integer”.
So i have run a piece this of code mentioned below:
program check;
class a;
mailbox #() mbx1;
function new();
mbx1 = new(1);
endfunction
endclass
initial begin
int sucess;
byte k = 'd4;
int j;
a a_inst = new();
a_inst.mbx1.put(k);
sucess = a_inst.mbx1.try_get(j);
$display("the value of output == %d",sucess);
end
endprogram
So as per the LRM when you we are using the try_get method with different message type then the function return a negative number.
But am observing that the try_get function is returning a positive number of 1 with the help of display present in the program block.
Can anyone elaborate this behavior as it is not as per the LRM.
Thanks,
Nikhil