Jump to content

Recommended Posts

Posted

Hi all,

1. If all the sequences in the library contains same rand varialbes, is there a why that I could pass the in line constraint to it, such as:

my_seq_lib seq_lib;

`uvm_do_with( seq_lib, {

speed < 115200;

})

2. This could not work either

my_seq_lib seq_lib;

`uvm_do_with( seq_lib, {

min_random_count == 3;

max_random_count == 5;

})

3. If it is not the correct way to use it, could you share some code to illustrate how? thanks!

Posted

If you override the "execute" method in your "my_seq_lib", you could then make it do a "randomize() with" on the selected sequence (by casting the sequence to a common base class with that variable).

  • 2 weeks later...
Posted

Hi, My example works a while ago, share it below for your reference.

class root_seq extends uvm_sequence;
  rand int a; // with short hand macro
endclass

class seq_lib extends uvm_sequence_library#(uvm_sequence_item);
  rand int a; // with short hand macro

  virtual task execute( uvm_object_wrapper warp);
    int _a = a;
    root_seq seq;
    $cast(seq,  obj);
    seq.randomize() with { a == _a; };
   `uvm_send(seq)
  endtask
endclass: seq_lib

class seq1 extends root_seq; // add to seq lib
class seq2 extends root_seq; // add to seq lib

// client code

seq_lib lib;
`uvm_do_with (lib, { a > 0,  a < 5})

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...