Jump to content

Constaining register fields from the testcase


Recommended Posts

If we are using a register layer in our UVM testbench, how to contrain the individual register fields from the testcase? Do we just do it using an object of the register model we have written?

can anyone throw some light on this?

Commonly, we just create one uvm_object for all registers fields , and then do some constraints for each of them. In the specific phase, You will random some fields and write to DUT through Register layer in the UVM Tb.

If you need to test the functional features of DUT, you may use above.

If you want to test Register, you may use the build-in sequences for reset/random access.

Hope this to help you.

Link to comment
Share on other sites

if you are using RALF, you can add the constraints in the Input specifications (RALF itself), add constraints for the 'value' of different fields.. IPXACT1.5 also allows you to add constraints

You can also add inline constraints while randomizing individual fields, registers..

eg:model.regname.randomize() with ...

Link to comment
Share on other sites

If you are using Cadence RGM Pkg, you could try following codes in you TB

// Block-level sequence : This sequence is meant to work for 'block_rf'

// type container. All registers are accessed relative to 'block_rf'

// container

class block_seq extends uvm_rgm_sequence;

reg_t r;

virtual task body();

if(!container) container=p_sequencer.get_container();

p_sequencer.uvm_report_info(get_name(),

$psprintf("Seq Starting. Container = %s", container.get_full_name()));

$cast(r, get_reg_by_name("urf.uart_reg0"));

void'(r.randomize() with {value=='h12345678;});

`rgm_write_send®

....

endclass

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...