Jump to content
Sign in to follow this  
pushkar.naik

Register Package - Read Only Registers

Recommended Posts

There is a common requirement that the Read-Only registers like status registers in hardware need to be reflected relatime in its register package counterpart for their current status on every HW update they go through. This may be required since there could e a sequence whose course of action would change immediately upon this status update detection.

Is there a mechanism available in UVM Register package to take care of such requirement, without user having to write a sequence to monitor the hardware register ? If not, has the UVM community thought about this requirement ?

Share this post


Link to post
Share on other sites

hi,

you should be looking at the uvm_reg_backdoor's auto-update capability (see uvm_reg_backdoor::is_auto_updated. a very simple impl. is attached

    class my_bkdr extends uvm_reg_backdoor;
       function new(string name = "");
           super.new(name);
       endfunction

       task read(uvm_reg_item rw);
           do_pre_read(rw);
           rw.value = new[1];
           rw.value[0] = dut.register;
           rw.status= UVM_IS_OK;
           do_post_read(rw);
           `uvm_info("BKDR","performed read",UVM_HIGH)
       endtask

       task write(uvm_reg_item rw);
           do_pre_write(rw);
           dut.register = rw.value[0];
           do_post_write(rw);
           `uvm_info("BKDR","performed write",UVM_HIGH) 
       endtask

       virtual local task wait_for_change(uvm_object element);
           @(dut.register);
           `uvm_info("BKDR","detected change",UVM_HIGH)
       endtask 

       function bit is_auto_updated(uvm_reg_field field);
           return 1;
       endfunction
   endclass

Share this post


Link to post
Share on other sites

hi,

you should be looking at the uvm_reg_backdoor's auto-update capability (see uvm_reg_backdoor::is_auto_updated. a very simple impl. is attached

class my_bkdr extends uvm_reg_backdoor;
        function new(string name = "");
            super.new(name);
        endfunction
        
        task read(uvm_reg_item rw);
            do_pre_read(rw);
            rw.value = new[1];
            rw.value[0] = dut.register;
            rw.status= UVM_IS_OK;
            do_post_read(rw);
            `uvm_info("BKDR","performed read",UVM_HIGH)
        endtask

        task write(uvm_reg_item rw);
            do_pre_write(rw);
            dut.register = rw.value[0];
            do_post_write(rw);
            `uvm_info("BKDR","performed write",UVM_HIGH) 
        endtask

        virtual local task wait_for_change(uvm_object element);
            @(dut.register);
            `uvm_info("BKDR","detected change",UVM_HIGH)
        endtask 
   
        function bit is_auto_updated(uvm_reg_field field);
            return 1;
        endfunction
    endclass

Hi I just wrote the code as you referred above, and how could I set the "dut.register". actually when I set as "tb_top.dut.register", there is error info as below

"illegal location for a hierarchical name (in a package)."

Could you help me about this error?

Share this post


Link to post
Share on other sites

as the message says you cant reference an absolute hier path from within a package (dut.register). there are various solutions (use a interface/virtual interface or move the code outside of the package or...)

Share this post


Link to post
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.

Sign in to follow this  

×
×
  • Create New...