> On 25/11/2015, at 9:10 am, René Doß <d...@gmx.de> wrote: > > > I have a question. What is the range of integer in GHDL?
type integer is range -2147483648 to 2147483647; > This works (wert>2^31): > signal wert: std_logic_vector(31 downto 0):= X"ffff0000"; > signal a: integer:= to_integer(unsigned(wert)); > > > This produce an error (c=2^31): > signal c: integer:=2**31; 2**31 = 2147483648 (according to Apples calculator app) IEEE Std 1076-2008 5.2.3.2 Predefined integer types The only predefined integer type is the type INTEGER. The range of INTEGER is implementation dependent, but it is guaranteed to include the range –2147483647 to +2147483647. It is defined with an ascending range. NOTE—The range of INTEGER in a particular implementation is determinable from the values of its 'LOW and 'HIGH attributes. You should be using 2**31-1. You could also note that the range in declaration of type INTEGER from the pseudo package STANDARD dumped out by --disp-standard) would not be legal as a new INTEGER type declaration. type integer is range -2147483648 to 2147483647; the left bound given as sign operator, decimal literal (basic operation to universal integer, implicit conversion to the widest range predefined integer type (INTEGER), whose right bound abstract literal (decimal literal) 2147483648 is out of bounds for type INTEGER. > hometown.vhd:34:23: static constant violates bounds > ghdl: compilation error > makefile:4: recipe for target 'all' failed > _______________________________________________ Ghdl-discuss mailing list Ghdl-discuss@gna.org https://mail.gna.org/listinfo/ghdl-discuss