Hidden arguments when calling sub-sequence's task

Hi,

In my test sequence, I instantiated a sub-sequence, and try to call the “cpu_write” task from that sub-sequence. Here is the code my task calling.

task body();
    logic[255:0] read_val=0;
    logic[255:0] 
    cpu_seq=cpu_sequence::type_id::create("cpu_seq");

    cpu_seq.cpu_write(.addr(30'h3552c000),.data('h3),.parent(this),.self_start(1),.seqr(cpu_msqr));

  endtask

This is the task declaration of cpu_write inside cpu_sequence

task  cpu_write(input bit[31:0] addr,  logic[31:0] data, input bit bBypassShadow, input uvm_sequence_base parent = null, uvm_verbosity vl=UVM_LOW, bit no_disp=0, bit self_start=0, input uvm_sequencer_base seqr=null);

However, I am getting the “Too few arguments to function/task call error” in compilation.

Error-[TFAFTC] Too few arguments to function/task call
/auto/nuo-asic-3/haojin/bev_src/beverly/verif/common/l2/demo_seq.sv, 53
"sv_test_top.\cpu_sequence_0::cpu_write (this.cpu_seq, .addr(30'h3552c000), .data('h00000003), .parent(\this ), .self_start(1), .seqr(\this .cpu_msqr));"
  The above function/task call is not done with sufficient arguments.

I think the reason is that I can’t mix arguments passing by name after arguments passing by position. But I wonder where is the argument

this.cpu_seq

comes from?
Besides, I wonder what is the name of this default argument and how should I pass arguments by name when calling task from sub-sequence?

Thanks in advance!

Hao

In reply to peterjin:

Please try following code:


cpu_seq.cpu_write(.addr(30'h3552c000),.data('h3),,.parent(this),,,.self_start(1),.seqr(cpu_msqr));

You should leave empty position for those arguments you don’t use: bBypassShadow, vl, no_disp.
And bBypassShadow should have default value when you don’t use it.

In reply to cuonghl:

In reply to peterjin:
Please try following code:


cpu_seq.cpu_write(.addr(30'h3552c000),.data('h3),,.parent(this),,,.self_start(1),.seqr(cpu_msqr));

You should leave empty position for those arguments you don’t use: bBypassShadow, vl, no_disp.
And bBypassShadow should have default value when you don’t use it.

This is incorrect information. You cannot leave an empty position for arguments with no default value. bBypassShadow is the argument you did not pass, nor has a default value.

You are allowed to mix positional arguments with name binding arguments, but once you switch to name binding, you cannot switch back to positional.

The this.cpu_seq argument is an implicit this argument for non-static methods (See this link for an explanation). I’m surprised your tool added it to your error message as well as not print the missing argument.

In reply to dave_59:

My mistake, thanks for your explaination.

In reply to dave_59:

Hi Dave,

Thanks for your explanation!

However, I am still having the following confusions,
1)

The this.cpu_seq argument is an implicit this argument for non-static methods

I have gone through the link you provided, but I wonder since I have created the object cpu_seq, why my calling to cpu_seq.cpu_write is still considered as

Accessing non-static members (see 8.9) or virtual methods (see 8.20) via a null object handle

?

Besides, my sequence implementation followed the example provided in UVM Cookbook Sequences/Hierarchy
I wonder does the example write.write used in Worker Sequence on that page also runs to the potential danger of accessing non-static members via null object handle?

You are allowed to mix positional arguments with name binding arguments, but once you switch to name binding, you cannot switch back to positional

In my task calling, I think there is no switch back to positional argument passing, so I wonder why I am having the argument passing error?

cpu_seq.cpu_write(.addr(30'h3552c000),.data('h3),.parent(this),.self_start(1),.seqr(cpu_msqr));

Thanks for your help!

Hao

In reply to peterjin:

  1. You don’t have a null handle, so that part is not relevant. I was just trying to explain how the this handle gets passed into a method as an implicit argument.
  2. Yes, your code does not have positional arguments, But the error message shows the implicit argument as a positional first argument inserted by the compiler. bBypassShadow is the argument you did not pass, nor has a default value. That is an error regardless whether you use positional or by name arguments.

In reply to dave_59:
Understand, Thanks so much for the explanation!

Regards,

Hao

In reply to cuonghl:

Thanks for your help.