UVM Factory methods

Hello sir what is the difference between UVM Factory methods do_print() and sprint().

  1. If we want to use print() mean we want to give flag in field_macros like UVM_ALL_ON … etc without giving these flag we can’t able to use any UVM object methods like copy ,compare,print,record,create ???

In reply to Om Ganesh B k:

Hi,

In UVM when you declare any members in object you register that members with uvm_field_utils ultimately this fields use in print, copy, clone etc… but with default functionality like you have array of [2046] in your field and you know for your functionality you only want array index [1024-1028] , you only care about this much then you have to write do_print it means when ever you have to change your printing with your expected printing, Now main thing what is sprint for when you call objcet_inst.print() it will print data for disable and enable printing you have to add logic , but in sprint() printing return in string format so you can put this in your info with verbosity so when you need message you can change verbosity this will help very much in avoiding unwanted infos.

In reply to Om Ganesh B k:

Hello sir what is the difference between UVM Factory methods do_print() and sprint().

  1. If we want to use print() mean we want to give flag in field_macros like UVM_ALL_ON … etc without giving these flag we can’t able to use any UVM object methods like copy ,compare,print,record,create ???

Thera are 2 ways to implement the convinient object methods:
(1) use of field macros
(2) implementing these methods individually.

Using the field macros is very specific for different data types and it creates a big overhead in the factory. For both reasons it is NOT recommended to use the field macros.
Instead create these methods individually. When using a UVM Framework Generator it will do this for you. A free-of-charge and proven generator can be found here:
https://www.doulos.com/knowhow/sysverilog/uvm/