Printing values in uppercase

L

lee nguyen

Guest
does anyone know how to print a reg value in upper hexadecimal?
 
lee nguyen wrote:

does anyone know how to print a reg value in upper hexadecimal?


Use "%X" for upper case and "%x" for lower case, as in: $display("%X",
value);
 
Ron wrote:
lee nguyen wrote:

does anyone know how to print a reg value in upper hexadecimal?

Use "%X" for upper case and "%x" for lower case, as in: $display("%X",
value);
First of all, it's %h and %H. The %x and %X format specifications
are not part of the standard and are only accepted by some tools
as extensions to the language.

Second, for %h and %o (hex and octal), uppercase X and Z vs'
lowercase x and z have specific meanings: X means some bits
of the group are 'bx, and x means ALL bits of the group are 'bx.
Same for z.

And finally, there is no such rule in the standard that says
that the a-f characters are uppercase for %H. And such a rule
would confuse the meanings of the x and z characters. As far
as the standard is concerned, %H and %h are exactly the same.

That said, there is nothing preventing a specific tool from
offering this feature as an extension. The LRM does not disallow
this (except for the specifics of x/z vs. X/Z) but certainly
does not suggest it.

--
Steve Williams "The woods are lovely, dark and deep.
steve at icarus.com But I have promises to keep,
http://www.icarus.com and lines to code before I sleep,
http://www.picturel.com And lines to code before I sleep."
 
The %X and %x prints the same value with the simulator that i am using.

I was able to get this to work by writing my own functions using a case
statement and string {} operator.
"Ron" <News5@spamex.com> wrote in message news:%EzQf.2$BW5.1@fe06.lga...
lee nguyen wrote:

does anyone know how to print a reg value in upper hexadecimal?
Use "%X" for upper case and "%x" for lower case, as in: $display("%X",
value);
 

Welcome to EDABoard.com

Sponsor

Back
Top