SeanChou Posted August 17, 2011 Report Posted August 17, 2011 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! Quote
jadec Posted August 19, 2011 Report Posted August 19, 2011 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). Quote
SeanChou Posted September 2, 2011 Author Report Posted September 2, 2011 Jadec, Thank you for the hint, could you write an short example of the the exectue() function the client code of the library? it would be even better. Quote
SeanChou Posted September 5, 2011 Author Report Posted September 5, 2011 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}) Quote
Recommended Posts
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.