The Designer's Guide Community
Forum
Welcome, Guest. Please Login or Register. Please follow the Forum guidelines.
Apr 16th, 2024, 9:06am
Pages: 1
Send Topic Print
real to int (Read 3386 times)
markb
New Member
*
Offline



Posts: 2
UK
real to int
Sep 15th, 2004, 5:43am
 
???
Can anyone tell me f its possible to convert a real to an integer type in VHDL-AMS?  

I need to calculate the number of times for a for loop to execute and the answer comes out as a real, for loops only accept integers as you cant go round a loop 45.3 times say.

Any ideas?
Cheers
Mark
Back to top
 
 
View Profile   IP Logged
Paul
Community Fellow
*****
Offline



Posts: 351
Switzerland
Re: real to int
Reply #1 - Sep 15th, 2004, 12:15pm
 
Mark,

have a look at the math package, there's many conversion functions between the most common signal types in VHDL.

Paul
Back to top
 
 
View Profile WWW   IP Logged
Mark Burford
Guest




Re: real to int
Reply #2 - Sep 15th, 2004, 2:03pm
 
yeah, i kinda got that when I remembered VHDL-AMS was a superset of VHDL - 'feeling stupid right now'.
cheers!  it was signal = integer(real_number);
so simple.
Back to top
 
 
  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.