Hi Forum,
I am new to UVM RAL and was trying to understand the application of calling register.set()
Consider the following 2 ways to configure specific registers during IP initialization
(1) Using set() & update()
reg_block.rega.set(wdata1);
reg_block.regb.set(wdata2);
reg_block.regc.set(wdata3);
// Configure other registers
reg_block.update();
(2) Directly calling write()
reg_block.rega.write(status,wdata1);
reg_block.regb.write(status,wdata2);
reg_block.regc.write(status,wdata3);
// Configure other registers
There is an extra method called in (1) compared to (2) ,
so wouldn’t any user prefer using (2) ? When should I consider using set() & update() over directly calling write() ?
Simulation performance may be improved with set()/update() when
The current mirrored value is the same as the desired given by set(). Then no bus transactions happens.
you want to write to multiple fields of a register that are not individually selectable. Writing to multiple fields of register creates multiple read/modify/write transactions. You can use set() to the individual fields and then update then entire register.
Normally you would just apply set() any field/register in the entire register model, and then call a single update() on the entire model.