Getting a strange error in `ovm_do

hello everybody,
I am getting an error in my program.
the error is:
** Error: …/src/env/nvs_pre_ovm_master_seq_lib.sv(41): Number of actuals and formals does not match in function call.
** Error: …/src/env/nvs_pre_ovm_master_seq_lib.sv(43): Number of actuals and formals does not match in function call.
** Error: …/src/env/nvs_pre_ovm_master_seq_lib.sv(45): Number of actuals and formals does not match in function call.

where the line 41,43,47 is : `ovm_do(trans)
and
mst_trans trans;
“trans” is an object of master transaction which we want to generate.and mst_trans class
is derived from base trans class like…
class transact extends ovm_sequence_item;//base transaction class
class mst_trans extends transact; // master transaction class

and if i write
ovm_do(req) instead of ovm_do(trans)

then errors are removed and new errors come during design loading
the errors are
** Error: (vsim-3046) nvs_pre_ovm_top.v(45): Too many arguments to ‘new’.

Region: /top

** Error: (vsim-3046) nvs_pre_ovm_top.v(43): Too many arguments to ‘new’.

Region: /top

** Error: (vsim-3046) nvs_pre_ovm_top.v(41): Too many arguments to ‘new’.

Region: /top

so friends if you know then do reply me…

regard
saurabh jain

Hi saurabh jain,

I just got the same problem as yours and like you I didn’t really know what the problem was linked to at the first place.

However, when you look at the `ovm_do macro (c.f. ovm-2.0\src\macros\ovm_sequence_defines.svh), you can see that it creates an instance of ovm_sequence_item class (in your case an instance of mst_trans) by invoking the new constructor followed with an argument as follows :

define ovm_do_with(OVM_SEQUENCE_ITEM, CONSTRAINTS) \ begin \ **OVM_SEQUENCE_ITEM = _new("")_;** \ ovm_create(OVM_SEQUENCE_ITEM)
start_item(OVM_SEQUENCE_ITEM);
assert(OVM_SEQUENCE_ITEM.randomize() with CONSTRAINTS ) else begin
ovm_report_warning(“RNDFLD”, “Randomization failed in ovm_do_with action”);
end
finish_item(OVM_SEQUENCE_ITEM);
end

That gave me a hint on how to solve this problem : in my case, the constructor of my ovm_sequence_item (again, mst_trans in your case) class did not allow any argument at construction. The problem was then solved once I modified the constructor function’s signature from

function new () ;
// Constructor’s declaration
endfunction

to

function new (name = “my_sequence_item”) ;
// Constructor’s declaration
endfunction

Once you allow the `ovm_do macro to set an argument when calling the newconstructor of your sequence item, the error message should disappear right away :D

At least, this solution did work perfeclty for my case. Hope it will work fine for yours too!

David