I am writing a function in scoreboard to check whether reset is working.
This is the code
function bit check(Packet obj);
if(obj.a == 0&&
obj.b == 0&&
obj.c == 0&&
obj.d == 0&&
obj.e == 0)
return 1;
else
return 0;
endfunction
Is there anyway to reduce this code by traversing through each content of obj and checking whether it’s 0, without individually checking each?
In reply to bachan21:
You could write
function bit check(Packet obj);
if(obj.a ||
obj.b ||
obj.c }}
obj.d ||
obj.e )
return 0;
else
return 1;
endfunction
Or if you are using the UVM’s field automation macros, you could pack all of the registered fields into an array and check that the array was all 0. However, that would be very inefficient.
In reply to bachan21:
You can encapsulate that specific function in the packet class and make it reusable by everyone. Then in the scoreboard it will mainly just a matter of calling it
In reply to bachan21:
I do not know hoa you are checking the functionality of your DUT. But you should have areference model which checks also the reset function. Then you do not need a specific check function.
In reply to chr_sue:
Hi,
TB development is in initial days so we are making a basic environment to test DUT.
But my reset signal is not a part of sequence item. So I am detecting the reset action in monitor and sending it to scoreboard.