Can anyone break this down for me:
** Warning: (vsim-3764) …/monitor/ram_monitor.sv(26): Stand-alone call to function ‘get’ treated as implicit void cast.
Can anyone break this down for me:
** Warning: (vsim-3764) …/monitor/ram_monitor.sv(26): Stand-alone call to function ‘get’ treated as implicit void cast.
For most messages from Questa, you can type verror NNNN for a more verbose message
verror 3764
Message # 3764:
Since the function’s return value is not used, the elaboration process
treats this use as if a void cast has been made on the function call.
This means you called a function as a statement and forgot to check the return value. This is usually a bad programming practice as it probably means you are not catching an error condition.
If you want to throw the return value away, you need to cast it to void. For example
void'(uvm_config_db#(int)::get(arguments));
See section 13.4.1 Return values and void functions of the IEEE 1800-2012 LRM
In reply to dave_59:
Thanks dave_59. Can you elaborate on “means you are not catching an error condition”.
In reply to verify_mars:
Function like randomize() and uvm_config_db::get return 0 if they fail. Your testbench needs to check the result.
If you know they could never fail, or don’t care if they do, then write void’(randomize()) to show that you know what you are doing.
I would need to see your code calling get() and the definition of get() to help you further.
In reply to dave_59:
This is what I have done, my intention is to count the number of reads.
task run_phase(uvm_phase phase);
base_transaction base_tx;
ram_global_variables driver_gvar;
uvm_config_db #(ram_global_variables)::get(this,“*”,“gvar”,driver_gvar);
forever begin
@ramvif_driver.cbram
seq_item_port.get(base_tx);
if(!base_tx.wen) begin
driver_gvar.num_reads = driver_gvar.num_reads + 1;
//`uvm_info(“NUMREADS”,$sformatf(“NUM_READS=%d”,driver_gvar.num_reads),UVM_INFO);
end
ramvif_driver.cbram.a <=base_tx.addr;
ramvif_driver.cbram.d <=base_tx.data;
goes on…
endtask
In reply to verify_mars:
So what will happen if someone forgets to set “gvar” or there is a typo? Assuming ram_global_variables is a class type, you will segfault as soon as it referenced in the code following the get. You should generate a graceful error
if (uvm_config_db #(ram_global_variables)::get(this,"*","gvar",driver_gvar))
forever begin ...
else
`uvm_error("NOGVAR","gvar was not set in the configuration DB");
In reply to dave_59:
Thank you, that’s more readable too.