Create_item, start_item, finish_item not declared Issue in UVM

Error : rror-[IND] Identifier not declared
apb_test.sv, 35
Identifier ‘create_item’ has not been declared yet. If this error is not
expected, please check if you have set `default_nettype to none.

Error-[IND] Identifier not declared
apb_test.sv, 35
Identifier ‘start_item’ has not been declared yet. If this error is not
expected, please check if you have set `default_nettype to none.

Error-[IND] Identifier not declared
apb_test.sv, 35
Identifier ‘finish_item’ has not been declared yet. If this error is not
expected, please check if you have set `default_nettype to none.

//The Below code is my test run_phase
task run_phase(uvm_phase phase);
apb_write_read write_read;
write_read = apb_write_read::type_id::create(“write_read”,this);

phase.raise_objection(this);

// assert(write_read.randomize());
// write_read.start(seqr);
`uvm_do_on(write_read, seqr);
$display(" Hier : %0s", get_full_name());
#10000ns;
phase.drop_objection(this);

endtask

endclass

//start() is working fine but if I use uvm_do macros, I am getting the error as above.

In reply to Arun_Rajha:

The `uvm_do macros are for use inside your sequence body methods.

We do not recommend using these macros and instead use the consistant Sequence API start method which works the same from your test as it does from other sequences.

In reply to Arun_Rajha:

uvm_do_* Macros will not work in uvm_test. Here you can only use the start method. The reason is if you see below code of uvm_do_on_pri_with which is being ultimately called by all the `uvm_do_* macros.

define uvm_do_on_pri_with(SEQ_OR_ITEM, SEQR, PRIORITY, CONSTRAINTS) \ begin \ uvm_sequence_base __seq; \ uvm_create_on(SEQ_OR_ITEM, SEQR)
if (!$cast(__seq,SEQ_OR_ITEM)) start_item(SEQ_OR_ITEM, PRIORITY);
if ((__seq == null || !__seq.do_not_randomize) && !SEQ_OR_ITEM.randomize() with CONSTRAINTS ) begin
`uvm_warning(“RNDFLD”, “Randomization failed in uvm_do_with action”)
end
if (!$cast(__seq,SEQ_OR_ITEM)) finish_item(SEQ_OR_ITEM, PRIORITY);
else __seq.start(SEQR, this, PRIORITY, 0);
end

Here the start_item and finish_item and create_item function all defined in uvm_sequence_base class. So if you are trying to use this macro while executing sub-sequence or sequence_item in your sequence it will work fine. You may see the declaration of this function here.

Hope this answers your question.

In reply to dave_59:

Hi
my code with sequence_item(stimulus class) is used in generating sequence, even then i am gettting same errors as mentioned above ,pls guide me through , thnks

code :



import uvm_pkg::*;
`include "uvm_macros.svh"

class seq_stimulus extends stimulus;

  `uvm_object_utils(seq_stimulus)
  
  stimulus req;
  function new(string name = "seq_stimulus");
    super.new(name);
  endfunction

virtual task body();
  req = stimulus::type_id::create("req");
  `uvm_do(req);
 `uvm_info(get_type_name(),$sprintf("data = 'h%0h,valid= 'h%0h",req.data,req.valid),UVM_HIGH)

endtask

endclass

error: Top Level Modules:
uvm_custom_install_recording
uvm_custom_install_verdi_recording
top
TimeScale is 1 ns / 10 ps

Error-[IND] Identifier not declared
classes_v/seq_stimulus.sv, 20
Identifier ‘create_item’ has not been declared yet. If this error is not
expected, please check if you have set `default_nettype to none.

Error-[IND] Identifier not declared
classes_v/seq_stimulus.sv, 20
Identifier ‘start_item’ has not been declared yet. If this error is not
expected, please check if you have set `default_nettype to none.

Error-[IND] Identifier not declared
classes_v/seq_stimulus.sv, 20
Identifier ‘finish_item’ has not been declared yet. If this error is not
expected, please check if you have set `default_nettype to none.

3 errors
CPU time: 1.686 seconds to compile

thnks

In reply to ramankaur09:

Is stimulus extended from uvm_sequence?

In reply to dave_59:

Hello Dave
Thank you Dave for your response.No ,actually it was uvm_sequence_item for stimulus,
so i changed seq_stimulus to extend from uvm_sequence and now working ,but is it not possible to inherit a sequence item to create sequences or we need to inherit from uvm_sequence and pass seq_item (or may be the uvm_pkg code is that way), thnks

import uvm_pkg::*;
`include "uvm_macros.svh"

class stimulus extends uvm_sequence_item;

rand logic[31:0] data;
rand logic valid;

`uvm_object_utils(stimulus);

 function new(string name= "stimulus");
   super.new(name);
 endfunction

endclass


In reply to ramankaur09:

Because you are using `uvm_do, that hides the fact that it is calling create_item, start_item, and finish_item which are methods of uvm_sequence, not uvm_sequence_item. Only a sequence can send a sequence_item to a driver.