如何使用 VHDL 获取数组的前 3 个值?

How to get the first 3 values of an array using VHDL?

如何从数组中获取前 3 个值?

示例:

a [0,0,2,2,3,0];

sel_x <= " ....";
sel_y <= "    ";

这些是信号声明:

a : in std_logic_vector(5 downto 0);

sel_x : out std_logic_vector(2 downto 0);
sel_y : out std_logic_vector(2 downto 0);

取决于您对 "first" 的含义,但要将 a 最左边的 3 个条目分配给 sel_x,您可以执行以下操作:

sel_x <= a(5 downto 3);

并以更一般的方式:

sel_x <= a(a'left downto a'left - 2);

希望这可以帮助您入门,也许您应该尝试使用模拟器来验证代码,因为 a [0,0,2,2,3,0]; 不是有效的 VHDL 语法。