Intel® Quartus® Prime Software
Intel® Quartus® Prime Design Software, Design Entry, Synthesis, Simulation, Verification, Timing Analysis, System Design (Platform Designer, formerly Qsys)

integer overflow

Altera_Forum
Honored Contributor II
1,140 Views

Can anyone explain me why ModelSim Intel Starter Edition 10.5b does not complain about integer overflows, i.e. why the following code 

 

process variable n : integer; begin n := 0; report integer'image(n); for i in 1 to 1000 loop n := ((10 * n) + 3); report integer'image(n); end loop; wait; end process;  

 

generates that: 

 

 

 

--- Quote Start ---  

33 

333 

3333 

33333 

333333 

3333333 

33333333 

333333333 

-961633963 

-1026405035 

-1674115755 

438711637 

92149077 

921490773 

624973141 

1954764117 

-1927195307 

-2092083883 

553997653 

1245009237 

-434809515 

-53127851 

-531278507 

-1017817771 

-1588243115 

1297438037 

89478485 

894784853 

357913941 

-715827883 

1431655765 

1431655765 

1431655765 

... 

 

--- Quote End ---  

 

 

 

Thanks, 

 

- Julien
0 Kudos
2 Replies
Altera_Forum
Honored Contributor II
351 Views

Interesting - it could possibly be a bug - BUT 

It could be that integer implementation in VHDL is tool dependent, and not defined in the VHDL LRM. So you cannot check the range of the 32 bit integer if it goes over 32 bits! 

 

Raise a ticket with mentor and see what they say.
0 Kudos
Altera_Forum
Honored Contributor II
351 Views

I can see the very same behavior with Vivado Simulator 2016.4. 

 

If it is not defined in the LRM, then I agree it is not really a bug. 

 

Thanks! 

 

- J
0 Kudos
Reply