Register access using sequence

Hello:

My question is what the recommended way to access one or more registers?

I saw in the ovm examples, in that a sequence is used for this purpose, for a single register access, just set the address and data via ovm_do_with { ... } inside function body(), for access more registers, just using multiple times of ovm_do_with { … }, or using for loop to calculate the addresses.

Can I say for each register I want to access, I have to create a sequence for it? Can I reuse the same sequence to access a different register with different address and/or data value, by passing the new address and/or data via the new constructor?

instead of this:
function new(string name=“”, ovm_object parent=null);
super.new(name);
endfunction

I do this way
function new(string name=“”, ovm_object parent=null,
bit[31:] addr, bit[31:0] data);
super.new(name);
start_addr[31:0] = addr[31:0];
start_data[31:0] = data[31:0];
endfunction


`ovm_do_with {seq_item_addr = start_addr,
seq_item_data = star_data,
…}

In my testbench environment, I plan to perform read and write test for all the registers. Also I need to configure certain registers to perform traffic operation, can anyone please let me know what’s the possible way to do what I want to do here and what’s the most recommended way is and why?

Thanks,

Bob

Hi Bob,

The Inline constraint capability of `ovm_do-with{} does the same as modifying the new() constructor.

I do this way
function new(string name=“”, ovm_object parent=null,
bit[31:] addr, bit[31:0] data);
super.new(name);
start_addr[31:0] = addr[31:0];
start_data[31:0] = data[31:0];
endfunction

This is just a duplication of

`ovm_do_with {seq_item_addr = start_addr,
seq_item_data = star_data,
…}

We uses the same sequence (which primarily does an register read/write access) with different Inline constraints for various register accesses (provided constraints should NOT conflict).

ovm_do_with {seq_item_addr = start_addr1, seq_item_data = star_data1, ...} ovm_do_with {seq_item_addr = start_addr2,
seq_item_data = star_data2,
…}

Also you can use for loop approach.

We use separate sequence for configuration registers.

Hope it will help u.

TVAR

Thanks TVAR.

Bob