Jump to content

enhancement feature : sequence macro for parameterized classes


Recommended Posts

The UVM registration macros

"`uvm_<xxx>_utils..."

has been missing for parameterized sequences.

Any chance this is going to be added in the near future ? Or are there any reasons why it is not present yet ?

For info, the following code can be used to work around this :

`uvm_declare_p_sequencer(sequencer_type)

`uvm_object_utils(parameterized_sequence_type)

Link to comment
Share on other sites

hi,

actually there has been a param macro for sequnces in ovm (the comments still show this). however this macro has been removed as there are some conceptual problems around param-sequnces+factory. the *utils* macro does the factory registration among other things.

the root problem is that the string based api of the factory cannot handle param types. param types can only be used with the type based api (::type_id::create....). some of the builtin sequences assume the string based api and so the param sequences do not work for them. so as long as you only use the type-based-factory api you are fine and you can use the existing field macros

if you really require string based factory requests you can wrap the param sequence into an unparam container.

class a_seq #(int P=5) extends uvm_sequence;
       `uvm_sequence_utils(a_seq#(P), a_sqr)

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

       virtual task body();
               // somebody
       endtask
   endclass 

   class b_seq extends uvm_sequence;
       `uvm_sequence_utils(b_seq, a_sqr)

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

       virtual task body();

// you will see a warning about a type being defined twice
// because a_seq#(5) and a_seq#(10) have their static init performed (and register with the factory

               a_seq#(10) foo;
               // now get a param seq from the factory
               foo=a_seq#(10)::type_id::create("seq");         
       endtask
   endclass 

   // nothing but a un-param wrapper 
   class c_seq extends a_seq#(20);
       `uvm_sequence_utils(c_seq, a_sqr)

       function new(string name = "c_sqr");
           super.new(name);
       endfunction : new
   endclass

btw if you print the factory contents you will see that the a_seq got registered in the factory with the "a_seq#(P)" string - the literal first argument to the utils macro.

Edited by uwes
Link to comment
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...