How to set Default Print Radix for $display() , $format() in Systemverilog?

Hi every one ,

Whenever we use %p to print unpacked data type, The Tool will print all variables in Decimal format. But how to print all variable in Hexdecimal? 

Please provide me info to achieve.

Regards/Thanks
kbkdec15

The LRM does not specify a way to do this (see Mantis 2580), but with Modelsim/Questa 10.2 you can use $displayb/o/h and similar tasks to select the radix. Please note that %p is a quick but crude way to print an object; you should put some effort in to properly format it.

In reply to dave_59:

Hi Deve ,

Thank you very much.

regards
kbkdec15

I am printing the OBJECT of my class.
The class have FIELDS and some constraints in it.
If i want to print only FIELDS and NOT CONSTRAINTS, is there any method to do so ?

Sorry for silly question.

In reply to Balu_15:

If you print “int signed” data type with “%p”, then it shows in Decimal. But if you print “int unsigned” then it shows in Hexadecimal.

Convert Signed into unsigned, then print.

Also its not good thing to use %p, but just temporary solution!!!