Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

VHDL : 'Integer' range and its use

Status
Not open for further replies.

GeekWizard

Full Member level 1
Joined
Oct 24, 2004
Messages
98
Helped
5
Reputation
10
Reaction score
2
Trophy points
1,288
Location
United Kingdom
Activity points
853
Hello,

I know that integer's range is upto 2^31 - 1. But does this condition apply to the every number in the equation that would result in an integer ?

e.g.

Code:
signal factor : integer ; 

begin 

factor <= (2**48) / (300E6) ; 
factor_bin <= conv_std_logic_vector (factor,20);

2**48 is beyond integer range but the resulting value for factor is within. Still the ouptut is zero ! ?

I do not want to use 'real' as its in conflict with conv_std_logic_vector function.

Thanks!
 

It may depend on the compiler, but I guess integer range must be kept for any factor and partial expression. Otherwise, the compiler would use real internally and thus loose precision.

But using real for the factors and converting the results to integer shouldn't conflict with anything.
 

I had similar problem with calculating values for phase accumulator
GeekWizard said:
But does this condition apply to the every number in the equation that would result in an integer ?
unfotunately: yes :( you have to calculate the fragment of code in some other way, so that every product would be in proper integer range
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top