【问题标题】:Errors when running the vhdl code运行 vhdl 代码时出错
【发布时间】:2017-06-23 09:21:21
【问题描述】:

我正在运行 VHDL 代码,但是在编译时我在端口映射行遇到了错误。有什么问题,我该如何解决。

错误是说:

错误 (10500):DU.vhd(52) 靠近文本“端口”的 VHDL 语法错误;期待“(”,或“'”,或“。”

我的代码:

library IEEE;
use IEEE.STD_LOGIC_1164.all;
use IEEE.STD_LOGIC_UNSIGNED.all;

entity DU is
    port(
    Clk     : in std_logic;
    state   : in std_logic_vector (3 downto 0);     
    Input   : in std_logic_vector (63 downto 0);
    De_out,En_out       : out std_logic_vector (63 downto 0)
    );
end DU;

architecture result of DU is
signal en_data1,en_data2    : std_logic_vector (63 downto 0);
signal de_data1,de_data2    : std_logic_vector (63 downto 0);
signal en_sum,de_sum        : std_logic_vector (31 downto 0):=x"00000000";
signal k0,k1,k2,k3,delta    : std_logic_vector (31 downto 0);

component encoder
port(
    k0,k1,k2,k3,delta   : in std_logic_vector (31 downto 0);
    En_In   : in std_logic_vector (63 downto 0);
    En_Out  : out std_logic_vector (63 downto 0)
);
end component;

component decoder
port(
    k0,k1,k2,k3,delta   : in std_logic_vector (31 downto 0);
    Dec_In  : in std_logic_vector (63 downto 0);
    Dec_Out : out std_logic_vector (63 downto 0)
);
end component;


begin
    process(state,Clk)
    begin
    k0 <= x"CBE6160F";
    k1 <= x"12345678";
    k2 <= x"FC189540";
    k3 <= x"00AB7655";
    delta <= x"9E3779B9";

    if(rising_edge(Clk)) then
        if state(0) = '1' then
            en_data1 <= Input;
            en_sum <= en_sum + delta;
            En_Out <= Input;
        elsif state(1) = '1' then
            encryption : encoder port map (k0,k1,k2,k3,en_sum,en_data1,en_data2);
            En_Out <= en_data2;
            en_data1 <= en_data2;
            en_sum <= en_sum + delta;
        elsif state(2) = '1' then
            de_data1 <= en_data2;
            de_sum <= en_sum;
            De_Out <= de_data1;
        elsif state(3) = '1' then
            decryption : decoder port map (k0,k1,k2,k3,de_sum,de_data1,de_data2);
            De_Out <= de_data2;
            de_data1 <= de_data2;
            de_sum <= de_sum - delta;
        end if;
    end if;
    end process;

end result;

【问题讨论】:

标签: vhdl


【解决方案1】:

您不能在进程中实例化实体。

encryption : encoder port map (k0,k1,k2,k3,en_sum,en_data1,en_data2);

这需要在您的流程之外完成,无论状态如何,输入都已连接。然后,您可以根据您所处的状态对输出进行多路复用。

【讨论】:

    猜你喜欢
    • 2014-04-26
    • 2017-11-13
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2015-03-16
    相关资源
    最近更新 更多