符号端口的通用驱动可定制总线宽度

时间:2014-07-17 15:12:26

标签: vhdl xilinx bus xilinx-ise

我在ISE中创建了一个VHDL模块,并生成了相应的原理图符号。我希望符号中的总线是可变宽度,使用原理图布局编辑器中的属性指定。整个项目的DRC是可以的,但是当我尝试合成顶级原理图时,它会为我已指定为变量的每个端口抛出一个错误'。我是根据常识和herehere列出的示例构建的。

模块的VHDL:

library IEEE;
use IEEE.STD_LOGIC_1164.ALL;

entity BUS_SWITCHER is
    generic (
        WIDTH : integer := 1 -- Structure
    );

    port (
        A : in STD_LOGIC_VECTOR (WIDTH - 1 downto 0);
        B : in STD_LOGIC_VECTOR (WIDTH - 1 downto 0);
        X : out STD_LOGIC_VECTOR (WIDTH - 1 downto 0);
        Y : out STD_LOGIC_VECTOR (WIDTH - 1 downto 0);
        S : in STD_LOGIC
    );
end BUS_SWITCHER;

architecture Behavioral of BUS_SWITCHER is
begin
    process (A, B, S)
    begin
        if S = '1' then
            X <= B;
            Y <= A;
        else
            X <= A;
            Y <= B;
        end if;
    end process;
end Behavioral;

模块符号(原理图连接到4 x 256宽总线):

Screenshot (via Imgur)

属性窗口:

Screenshot (via Imgur)

错误日志:

ERROR:DesignEntry:20 - Pin "A(0:0)" is connected to a bus of a different width.
ERROR:DesignEntry:20 - Pin "B(0:0)" is connected to a bus of a different width.
ERROR:DesignEntry:20 - Pin "Y(0:0)" is connected to a bus of a different width.
ERROR:DesignEntry:20 - Pin "X(0:0)" is connected to a bus of a different width.

1 个答案:

答案 0 :(得分:0)

当您实例化此模块时,需要将其连接到宽度相等的std_logic_vector。因此,在这种情况下,您的更高级别模块需要创建一个std_logic_vector(0 downto 0)的中间信号。如果您想将其转换为单个std_logic,您可以执行以下操作:

single_bit <= entire_vector(0);

我试图避免长度为1 std_logic_vectors因此,它们可能很痛苦。