MAX, 7, 1 2 ** 7 - 1 (127) 2 ** 7 (128).
:
library ieee;
use ieee.std_logic_1164.all;
use ieee.numeric_std.all;
entity foo is
end entity;
architecture faa of foo is
constant MAX: natural := 7;
signal somename: unsigned (MAX downto 0) := (others => '1');
begin
UNLABELED:
process
begin
report "somename'length = " & integer'image(somename'length);
report "somename maximum value = " &integer'image(to_integer(somename));
wait;
end process;
end architecture;
(others => '1') "1" somename, .
:
foo.vhdl: 15: 9: @0ms: ( ): somename'length = 8
foo.vhdl: 16: 9: @0ms: ( ): somename = 255
8, , , 0 2 ** 8 - 1 (255), 2 ** 7 (128), .
This has been seen in the newer issue of the VHDL modulo 2 ^ 32 supplement . In the context of your accepted answer, it is assumed that you meant length instead of the leftmost value.
A decrease from zero of the case leads to the value 2 ** 8 - 1 (255) (MAX = 7). Deficiency or overflow depending on your math religion.
Hat advice to Jonathan Drolet for pointing out a related new question.
source
share