VHDL:通过std_逻辑_向量对应宽度的宽度查找整数范围

VHDL:通过std_逻辑_向量对应宽度的宽度查找整数范围,vhdl,Vhdl,我有一个信号std\u逻辑\u向量(宽度-1到0)。我需要一个整数信号,它从向量中获取值。如何确定此整数信号的范围 library ieee; use ieee.std_logic_1164.all; entity TEST is generic(WIDTH : integer := 8); port( S : in std_logic_vector(WIDTH-1 downto 0)); end entity TEST; architecture A of TEST is

我有一个信号
std\u逻辑\u向量(宽度-1到0)
。我需要一个整数信号,它从向量中获取值。如何确定此整数信号的范围

library ieee;
use ieee.std_logic_1164.all;

entity TEST is
  generic(WIDTH : integer := 8);
  port(
    S : in  std_logic_vector(WIDTH-1 downto 0));
end entity TEST;

architecture A of TEST is
  subtype I is integer range S'range;
  subtype T is integer range 0 to 2**WIDTH-1;
begin
  process is
  begin
    report "I: " & I'image(I'val(I'low)) & "; " & I'image(I'val(I'high));
    report "T: " & T'image(T'val(T'low)) & "; " & T'image(T'val(T'high));
    wait;
  end process;
end architecture A;
结果:

> # ** Note: I: 0; 7
> #    Time: 0 ps  Iteration: 0  Instance: /test
> # ** Note: T: 0; 255
> #    Time: 0 ps  Iteration: 0  Instance: /test

信号叫什么名字?对于
信号A:std_逻辑_向量(宽度-1到0)然后<代码>信号indx:整数范围A'范围使用预定义的数组属性“范围”。注:您可以
信号indx:整数范围宽度-1到0)以及或<代码>信号indx:整数范围A'反向范围,等等。谢谢@user1155120。非常清楚。谢谢@EML。是否有可能找出宽度而不是从一般输入中获取宽度?