The Designer's Guide Community
Forum
Welcome, Guest. Please Login or Register. Please follow the Forum guidelines.
Jul 17th, 2024, 10:19am
Pages: 1
Send Topic Print
Printing loop variable (Read 2512 times)
Peter_R_Kroon
New Member
*
Offline



Posts: 5
The Netherlands
Printing loop variable
Oct 04th, 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?
Back to top
 
 
View Profile   IP Logged
Geoffrey_Coram
Senior Fellow
******
Offline



Posts: 1999
Massachusetts, USA
Re: Printing loop variable
Reply #1 - 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?
Back to top
 
 

If at first you do succeed, STOP, raise your standards, and stop wasting your time.
View Profile WWW   IP Logged
Ken Kundert
Global Moderator
*****
Offline



Posts: 2386
Silicon Valley
Re: Printing loop variable
Reply #2 - Oct 4th, 2010, 3:14pm
 
Try using %0d. That indicates that the minimum field width is what is desired.

-Ken
Back to top
 
 
View Profile WWW   IP Logged
Peter_R_Kroon
New Member
*
Offline



Posts: 5
The Netherlands
Re: Printing loop variable
Reply #3 - Oct 5th, 2010, 4:53am
 
Ken,

Thanks for your suggestion, it indeed solves the problem.

Peter
Back to top
 
 
View Profile   IP Logged
Pages: 1
Send Topic Print
Copyright 2002-2024 Designer’s Guide Consulting, Inc. Designer’s Guide® is a registered trademark of Designer’s Guide Consulting, Inc. All rights reserved. Send comments or questions to editor@designers-guide.org. Consider submitting a paper or model.