Akhila

Randomizing sequence items in UVM-SC

5 posts in this topic

Hi All,

Just wanted to check if the UVM sequence macros (UVM_DO_ON_WITH and UVM_DO_WITH) which support randomizing the sequence object are yet supported by UVM-SC or not? If not, what is the best way to add some randomization in the framework? I saw a post where there are some snippets (link given below) using scvx_rand_object class but I am not sure where to find this(didn't find it in latest SCV and UVM-SC libraries). 

http://nascug.org/events/20th/1-NASCUG20-UVMforSystemC-Karsten.pdf

Also, I get errors while using plain UVM_DO_ON macros. Is it expected? The same works fine with ahb_wr_seq->start(top_env->agent->ahb_sequencer_inst);

I have registered the sequence class with factory already.

UVM_DO_ON(ahb_wr_seq,top_env->agent->ahb_sequencer_inst);

Error message says:

/nfs/iind/disks/ba_bdl_xplore_disk001/am5/UVM_SC/uvm-systemc-1.0-alpha1/src/uvmsc/macros/uvm_sequence_defines.h:150:31: error: expected type-specifier before ‘typeof’
   SEQ_OR_ITEM = dynamic_cast< typeof(SEQ_OR_ITEM) >(create_item(objw__, SEQR, "SEQ_OR_ITEM"));
                               ^
/nfs/iind/disks/ba_bdl_xplore_disk001/am5/UVM_SC/uvm-systemc-1.0-alpha1/src/uvmsc/macros/uvm_sequence_defines.h:115:3: note: in expansion of macro ‘UVM_CREATE_ON’
   UVM_CREATE_ON(SEQ_OR_ITEM, SEQR) \
   ^
/nfs/iind/disks/ba_bdl_xplore_disk001/am5/UVM_SC/uvm-systemc-1.0-alpha1/src/uvmsc/macros/uvm_sequence_defines.h:80:3: note: in expansion of macro ‘UVM_DO_ON_PRI_WITH’
   UVM_DO_ON_PRI_WITH(SEQ_OR_ITEM, SEQR, -1, "")
   ^
ahb_basic_test.h:59:11: note: in expansion of macro ‘UVM_DO_ON’
           UVM_DO_ON(ahb_wr_seq,top_env->agent->ahb_sequencer_inst);

 

Appreciate any help here.

Thanks

Akhila

Share this post


Link to post
Share on other sites

Hi All,

I integrated SCV library in my environment and I am able to randomize my sequence item using SCV_EXTENSIONS and scv_smart_ptr. I still couldn't figure out the issue with UVM_DO* macros. But have found a way to randomize the transactions.

 

Thanks

Akhila

Share this post


Link to post
Share on other sites

I'm faced with the same question. But my sequence item is parameterized via template as follow:

template<unsigned DA_WIDTH>
class item_c: public uvm::uvm_sequence_item {
public:
    sc_uint<DA_WIDTH> addr;
...

I'm trying to use SCV_EXTENSIONS and scv_smart_ptr like Akhila do, but my scv_extensions class becomes not fully specialized in my case:

template<unsigned DA_WIDTH>
class scv_extensions<item_c<DA_WIDTH> > : public scv_extensions_base<item_c<DA_WIDTH> > {
public:
    scv_extensions<sc_uint<DA_WIDTH> > addr;
  ...

If understand it right, that will not work.

When I'm trying to create scv_smart_ptr like this:

scv_smart_ptr<item_c<DA_WIDTH> > req("req_item");

I'm receiving the following error:

_scv_smart_ptr.h:88:16: error: invalid new-expression of abstract class type ‘scv_extensions<item_c<16u> >’
     tmp_(&*ext_) {
                ^

Could somebody, please, explain me how to resolve this?

Probably, there are some more appropriate way to create a parameterized sequence item. 

Share this post


Link to post
Share on other sites
On 21/04/2017 at 6:01 PM, Loki5000 said:

I'm trying to use SCV_EXTENSIONS and scv_smart_ptr like Akhila do, but my scv_extensions class becomes not fully specialized in my case:

Did you include the required "extensions ctor" in your extension?

template<unsigned DA_WIDTH>
class scv_extensions<item_c<DA_WIDTH> > : public scv_extensions_base<item_c<DA_WIDTH> > {
public:
  scv_extensions<sc_uint<DA_WIDTH> > addr;
  // ...

  SCV_EXTENSIONS_CTOR(item_c<DA_WIDTH>) {
    SCV_FIELD(addr);
    // ...
  }
};

That said, (depending on your compiler) the current implementation of SCV_EXTENSIONS_CTOR is missing some "this->" qualifications in its body to cope with the different lookup rules for templated base classes.

Hope that helps,
  Philipp

Share this post


Link to post
Share on other sites

Yes, I did. Following the compiler (g++) errors descriptions I came to this:

template<>
template<unsigned DA_WIDTH>
class scv_extensions<item_c<DA_WIDTH> > : public scv_extensions_base<item_c<DA_WIDTH> > {
public:
    scv_extensions<op_t> op;
    scv_extensions<sc_uint<DA_WIDTH> > addr;
    scv_extensions<unsigned> delay;

    item_c<DA_WIDTH>* _instance;
    void _set_instance(item_c<DA_WIDTH>* p) { _instance = p; _set_instance_core_wrap(p); }
    item_c<DA_WIDTH>* _get_instance() const { return _instance; }

    SCV_EXTENSIONS_CTOR(item_c<DA_WIDTH>)
{
        SCV_FIELD(op);
        SCV_FIELD(addr);
        SCV_FIELD(delay);
    }
};

I defined another _instance, _set_instance and _get_instance functions. I'm not fully understand how, but it works.

The next problem is that I need one more data field in item_c class.

And it's of std::vector type. I didn't found a way to use std::vector type with SCV. Am I right? It's not possible with SCV?

The only way is to use CRAVE?

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now