Jump to content

Parameterised class sequence


Recommended Posts

Hi,

I am instantiating a sequence in another sequence and i have made it parametrized. but i am getting a invalid cast error at run time.

class a_seq:

class a_seq extends base_seq

`uvm_object_utils(a_seq)

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

  `uvm_object_utils(a_seq)

b_seq #(12) s0;

task body();
`uvm_do(s0)
endtask

endclass

class b_seq:

class b_seq #(parameter bit [16:0] address = 0) extends base_seq

`uvm_object_utils(b_seq)

task body();
final_addr=addr_calc(addres);
`uvm_do_with(req,{req.addr== final_addr})
endtask

endclass

error:

`uvm_do(s0)

|

ncsim: *E,BCLCST (../src/sv/seq_lib.sv,226|16): Invalid cast: a value with the class datatype 'tb_top.intR_rd_seq#(17'h00000)' cannot be assigned to a class variable with the datatype 'tb_top.intR_rd_seq#(17'h0000c)'.

Edited by qwerty
Link to post
Share on other sites
  • 2 years later...

Just to put it clearly you cannot change the parameters dynamically. That would not work. That is to say Your address in:

class b_seq #(parameter bit [16:0] address = 0) extends base_seq

need to be a constant or static not changing in the run_phase. In other words, a virtual sequencer or the task that will start this sequence cannot use a variable for this.

If you want to pass info between seq classes you can just create rand class variables and set them with randomize with before you execute the sequence. you can also use `uvm_do_on_with(xfer_or_seq,sequencer {address==32'hABCD});

 

The following info should help

https://verificationacademy.com/cookbook/sequences/generation

Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...