如何将阵列信号路由到输入

How to route array signal to input

我有一个顶层 VHDL 模块,其中包含一个我声明为无符号数数组的信号。我在这个顶级模块中有一个实例化组件,我想将顶级模块中的数组路由到这个组件。做出相同的声明

type array_type is array(5 downto 0) of unsigned (15 downto 0);

在组件中似乎不起作用。我已经知道如何将输入连接到包含数组的输出,但我不确定如何将信号连接到 input/output。

顶级模块示例

library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
use IEEE.NUMERIC_STD.ALL;

entity top_level is
end top_level;

architecture str_arch of top_level is
   type array_type is array (5 downto 0) of unsigned (15 downto 0);
   signal example_array: array_type;
begin
instantiated_component: entity work.component(Behavioral)
   port map(array=>example_array);
end str_arch;

1) 在某处声明:

type array_type is array(5 downto 0) of unsigned (15 downto 0);

在另一个地方:

type array_type is array(5 downto 0) of unsigned (15 downto 0);

声明了两种不同的类型!即使它们具有相同的名称(它们将具有完整的扩展名:somewhere.array_type 和 another.array_type)

2) VHDL 是一种强类型语言,即使您声明的两个不同 "types" 具有相同的定义,您也不能将一个分配给另一个。

一个简单的解决方案是使用相同类型(来自一个包):

package pkg is
  type array_type is array(5 downto 0) of unsigned (15 downto 0);
end package pkg;

并且在子模块和到级模块中:

use work.pkg.all; --if pkg is in the same library