The Designer's Guide Community Forum
https://designers-guide.org/forum/YaBB.pl
Design Languages >> Verilog-AMS >> Printing loop variable
https://designers-guide.org/forum/YaBB.pl?num=1286184238

Message started by Peter_R_Kroon on Oct 4th, 2010, 2:23am

Title: Printing loop variable
Post by Peter_R_Kroon on Oct 4th, 2010, 2:23am

I want to print, via the display function, the value of an integer loop variable. If I use %d (decimal) I get a large number of spaces in front of the printed loop variable. Using %s (string) or %c (character) is not the solution because I must print an integer value.
How can I avoid or suppress the large number of spaces in front of the printed loop variable?

Title: Re: Printing loop variable
Post by Geoffrey_Coram on Oct 4th, 2010, 2:16pm

I don't believe the V-AMS LRM says anything about putting spaces in front of a number; I expect it to follow the C convention for format specifiers.  Have you asked your simulator vendor?

Title: Re: Printing loop variable
Post by Ken Kundert on Oct 4th, 2010, 3:14pm

Try using %0d. That indicates that the minimum field width is what is desired.

-Ken

Title: Re: Printing loop variable
Post by Peter_R_Kroon on Oct 5th, 2010, 4:53am

Ken,

Thanks for your suggestion, it indeed solves the problem.

Peter

The Designer's Guide Community Forum » Powered by YaBB 2.2.2!
YaBB © 2000-2008. All Rights Reserved.