How to code a uvm sequence in order get this operation done "consecutive write and read for same address"?

Hi All,

i have uvm_seq_item which consists of rand access(0=read,1=write), rand [2:0]address as data members.
now i want to write a sequence such that it should do write and read for same address like below shown examples.
ex: addr=0, write and read to be happen, addr=1…, address=2,… address=3…

Please let me know guys.

In reply to subbarao:

Your sequence body task should look like this:


task body();
  req = ....       // create your seq_item_object
  for (int i = 0) begin
    start_item(req);
    if (!req.randomize() with {access == 1'b1; addr == i;})
      `uvm_error(get_name(), "Error randomizing write");
    finish_item(req);
    start_item(req);
    if (!req.randomize() with {access == 1'b0; addr == i;})
      `uvm_error(get_name(), "Error randomizing read");
    finish_item(req);
  end
endtask