Jump to content

extracting data from uvm_do_with macro


Recommended Posts

Hello,

 

let's say i have a sequence, in this sequence i'm reading data using the uvm_do_with macro.

an example would be a read transaction in an APB agent.

 

how do i extract the data from it?

 

PARTIAL CODE:

 

    virtual task  body();
        apb_item#(AW, DW) it;
 
        case(op_kind)
            `APB_READ: begin
                `uvm_do_with(it,
                    {
                    it.address == tr_address;
                    it.rw          == op_kind;
                    }
                );// `uvm_do_with
            end
 
        endcase
 
    endtask: body
 
Thx,
Assaf
 
Link to comment
Share on other sites

For a read transfer, it's your driver's job to fill the data field (I'm assuming you have one) of the item with the value present on the PRDATA bus. This way you know that once your item is finished (i.e. you return from `uvm_do_*(...)) you rely on the contents of it.data. I don't really see why you need the case statement in there, though.

Link to comment
Share on other sites

Thanks for the answer.

 

i'm using a VIP that is `protected so i don't have access to the driver.

all i can do is create a sequence and "feed" it to the driver, inside the sequence i use the code i attached in my previous post.

(the case is there because there is also a write option which i omitted)

 

isn't the transaction deleted at the end of the uvm_do_with? otherwise can i use something like this:

 

 

class sequence;

int data;

virtual task  body();
        apb_item#(AW, DW) it;
        `uvm_do_with(it,
             {
             it.address == tr_address;
             it.rw          == op_kind;
             }
        );// `uvm_do_with
        this.data = it.data;
    endtask: body
endclass
 
and then read it from the higher hierarchy the creates the sequence and "feeds" it to the driver?
 
Thx,
Assaf
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...