How to construct the test bench when there is more than one sequence item?

Hi,

In my current project I need to create a number of sequence items which are extended from one basic sequence item.
I am facing 2 difficulties here.

  1. I have a crc32 function implementation in basic sequence item. The payload which is an argument to the crc32 function need to be of variable width. I need to calculate the crc32 in the child sequence items by passing a different payload each time.
class basic_sequence_item extends uvm_sequence_item;
   localparam payload_size = 'd24;
   localparam divisor_size = 'd33;
    `uvm_object_utils(basic_sequence_item)
     .....
     ....
   function  bit[31:0] crc32rem(input bit[payload_size-1:0] payload,input bit[divisor_size-1:0] divisor);
    ............
    ...........
   endfunction

endclass

class child_sequence_item extends basic_sequence_item;
 ............
 ...........
 payload = {target_id_field,cmd};
 crc32=crc32rem(payload,divisor);

enclass

Here how can I pass the new payload_size to the crc32rem function in base_sequence_item? divisor part is okay since its fixed every time.
2) The monitor is not able to collect the fields registered to factory from the child sequence item. It shows that field is not available in the scope of basic_sequence_item instance handle.

In reply to vivekbalanandan:

Hi,

I am not sure that I fully understand what you are doing, but I would recommend to switch macro uvm_object_utils(basic_sequence_item) to uvm_object_param_utils(basic_sequence_item) and correctly pass the parameters.

I would also expect that your child class should have the same parameters and that they are set to the same values.

As for the monitor not having to acces to the fields, I try to use set/get function wheneevr I can. In that way if I want to set value inside the class, I do not call myClass.data = 0 but myClass.set_data(0). Such method can be inherited.

Best Regards,
Jan

In reply to galloth:

Thanks. My first difficulty is solved by making it parameterized class. But when the monitor, scoreboard and TLM are parameterized with base_sequence_item, they are not identifying the fields available in the child_sequence_items.How to solve this?