Why do we use the name of body() such as " task body()" inside sequence?

Dear All,

I came across some snippet code as the below, when I googling.
https://verificationacademy.com/cookbook/sequences/virtual

// Creating a useful virtual sequence type:
typedef uvm_sequence #(uvm_sequence_item) uvm_virtual_sequence;
 
// Virtual sequence example:
class my_vseq extends uvm_virtual_sequence;
  ...
  // Handles for the target sequencers:
  a_sequencer_t a_sequencer;
  b_sequencer_t b_sequencer;
 
  task body();
    ...
    // Start interface specific sequences on the appropriate target sequencers:
    aseq.start( a_sequencer , this );
    bseq.start( b_sequencer , this );
  endtask
endclass


As you can see above code, the name of task is body().
1.Why do we use the name of body() such as “task body()” inside sequence? Is there any specific reason?

One more question, I want to trying to know between “virtual task body();” and “task body();”.
As you can see the above code, that one was assigned without virtual. but some another class was assigned with virtual.
2.Would you please let me know when do we with or without virtual keyword use in the task?

In reply to UVM_LOVE:

“body” was the identifier name chose by the person(s) who wrote that portion of the OVM code. This is reference to the “body” of a task or function, which usually means the procedural statements, or executable implementation of the task/function.

A UVM sequence implements the functor design pattern in SystemVerilog. The sequence object is your pointer and the body() is the function reference.

I just answered your second question in another post.

In reply to dave_59:

In reply to UVM_LOVE:
“body” was the identifier name chose by the person(s) who wrote that portion of the OVM code. This is reference to the “body” of a task or function, which usually means the procedural statements, or executable implementation of the task/function.
A UVM sequence implements the functor design pattern in SystemVerilog. The sequence object is your pointer and the body() is the function reference.
I just answered your second question in another post.

Dear dave_59,
I’m not familiar with this UVM. I want to know the body() is specific defined as keyword such as a keyword of systemverilog? or just usually be made a name?

In reply to UVM_LOVE:

The list of SystemVerilog reserved keywords are in the LRM. “body” is not one of them. The UVM baser class library is written in SystemVerilog and is open source available for you to browse.