Sequences

Hi I have two sequence A and B.
I want two sequences sharing same database. sequence A and B will see same database to determine what sequence item should be sent.
Also,I want there are some communication between two sequences. I have no idea to implement it. Could you give me some suggestions?
Thanks!!

In reply to chy:

i think you can use uvm config data base…

In reply to chy:

Hi I have two sequence A and B.
I want two sequences sharing same database. sequence A and B will see same database to determine what sequence item should be sent.
Also,I want there are some communication between two sequences. I have no idea to implement it. Could you give me some suggestions?
Thanks!!

Could you please describe your problem in some more detail?
What do you mean with database?
Are sequences A and B of the same base type or are they different?

In reply to chr_sue:

Thanks for reply
I have two sequence,itemA and itemB are different type
In seqA

task body
itemA = xxx::create("itemA");
  start_item(itemA)
  itemA.randomize(); 
  finish_item(itemA)
endtask

In seqB

task body
itemB = xxx::create("itemB");
  start_item(itemB)
  itemB.randomize();
  finish_item(itemB)
endtask 

In seqB, i will call itemB.randomize(), but I want itemB’s randomization which have some relationship with itemA. I want itemB’s randomization is dependent of itemA’s randomization
Therefore,I want there are some communication between two sequences
Thanks a lot!

In reply to chy:
Is there a dependency on value of itemA randomized by seqA? If yes, how do you start both the sequences?

In reply to bdreku:

i run two sequence parallelly. but i want itemB’s randomization is dependent of itemA’s randomization

In reply to chy:

Do both sequences generate seq_items of the same type or are they different?
If you are running seqA and seqB in parallelyou cannot share data between both.
Running in parallel mean you are using a fork/join. The execution of these sequences happens in random order. You do not know which sequence starts first.

In reply to chr_sue:
thanks for reply
Do both sequences generate seq_items of the same type or are they different?
→ itemA and itemB are not same type, they are different

seqA and seqB should be execution at same clock cycle, so they run parallelly
I want seqB generating itemB which is dependent of itemA
thanks!

In reply to chy:
In this case, if both the sequences are extended from the same base sequence, then you can declare itemA in base class and also create a method to randomize and return itemA in base class to randomize.
In SeqA: call the method of base class to get randomized itemA
In SeqB: put some wait logic till itemA gets randomized and use itemA from base class to randomize itemB

Limitation: seqB will always have dependency on seqA. Even in case seqB is completed first, for next iteration also it has to wait for seqA.

In reply to chy:

In reply to chr_sue:
thanks for reply
Do both sequences generate seq_items of the same type or are they different?
→ itemA and itemB are not same type, they are different
seqA and seqB should be execution at same clock cycle, so they run parallelly
I want seqB generating itemB which is dependent of itemA
thanks!

Sequences will never be executed on clock cycles. I believe your requirement cannot be met.
The timing is determinded by the driver functionality. The processing of itemB might take a lot more time as for itemA you cannot share data between both sequences only for items which will be generated later.

In reply to chy:

I think the questions about the sequences being the same type or not are irrelevant.

The problem is you can’t have something both simultaneous and have an order dependency.

What you can do is have another sequence above these two sequences create and randomize itemA and itemB in order, and then fork off seqA and seqB in parallel.

In reply to dave_59:

thanks for reply


class itemA
rand bit [3:0] mode;
xxxx
endclass
class itemB
rand bit [15:0] addr; // dependent of mode in itemA
xxx
endclass

two itemA and B are not same type. Now I want seqB generating itemB’s addr which is dependent of itemA’s mode
i create the new seq, i intend to call seqA.start and seqB.start. How to let seqB know the seqA generating mode’s value in itemA, and let seqB generate corresponding addr in itemB?


class  new_seq extends uvm_sequence (xxx)
 task body();
   seqA = xxx::create;
   seqB = xxx::create;
   fork
   seqA.start();
   seqB.start();
   join
endclass

by the way , what is xxx (class new_seq extends uvm_sequence (xxx))?
should be uvm_sequence_item?

In reply to chy:

In this case you do not need 2 seq_items. You can solve your problem by odering the randomization.
Your code should look like this:

class itemA extends uvm_sequence_item;
rand bit [3:0] mode;
rand bit [15:0] addr;
// more data members
// factory registration
// constructor
constraint order {solve mode before addr;}
constraint mode_addr {mode == mode1 -> addr == [range];}
endclass

In reply to chr_sue:

sadly, i need 2 seq_items

In reply to chy:
You can have your top-level sequence construct both sequences and the sequence_items, and then randomize them in order. Every uvm_sequence has a ‘req’ variable that is parameterized to the sequence_item.

class  new_seq extends uvm_sequence;
  myseqA#(myitemA) seqA;
  myseqB#(myitemB) seqB;
 task body();
   seqA = myseqA::typeid::create;
   seqB = myseqB::typeid::create;
   seqA.req = myitemA::typeid::create;
   seqB.req = myitemB::typeid::create;
   assert(seqA.req.randomize());
   assert(seqB.req.randomize() with {whatever_constraints_you_need} );
   fork
   seqA.start();
   seqB.start();
   join
endclass

Then you need to remove the sequence_item creation and randomization from the lower level sequences.

class myseqA extends uvm_sequence#(myitemA);
task body;
  start_item(req);
  finish_item(req);
endtask 
endclass