Vhdl 实例化组件意外端口时出现分析错误

Vhdl 实例化组件意外端口时出现分析错误,vhdl,Vhdl,我对VHDL完全陌生,我一直在尝试解决错误,但在实例化组件时无法克服此解析错误。当我使用“端口图”时,它显示: “错误:HDLParsers:164-”D:/FPGA/correlation_1/corr_1.vhd”第89行。分析错误,意外端口,应为OPENPAR或TICK或LSQBRACK " 代码如下: component cmux_m1 port (ar,ai : in std_logic_vector( N-1 downto 0); b

我对VHDL完全陌生,我一直在尝试解决错误,但在实例化组件时无法克服此解析错误。当我使用“端口图”时,它显示:

“错误:HDLParsers:164-”D:/FPGA/correlation_1/corr_1.vhd”第89行。分析错误,意外端口,应为OPENPAR或TICK或LSQBRACK "

代码如下:

component cmux_m1 
        port (ar,ai : in std_logic_vector( N-1 downto 0);
                br,bi : in std_logic_vector( N-1 downto 0);
                pr,pi : out std_logic_vector( N+N downto 0)
               );
    end component;
以及实例化:

cmult_unit : cmux_m1
                    port map(ar=>xr, ai=>xi, br=>yr, bi=>yi, pr=>temr_0, pi=>temi_0);
提前谢谢

共享更多代码:

entity corr_1 is

    generic( N : integer := 4;   -- N is the width of each input symbpl of the signals
                M : integer := 4);  -- M is the length of chosen parts of the signals to be correlated 

    port( clk : in std_logic;
            xr,xi : in std_logic_vector( N-1 downto 0);  -- real and imaginary N_bit symbol of the first signal
            yr,yi : in std_logic_vector( N-1 downto 0);  -- real and imaginary N_bit symbol of the second signal
            rr_0 : out std_logic_vector(N+N+2 downto 0); -- real part of the output with lag=0
            ri_0 : out std_logic_vector(N+N+2 downto 0); -- imaginary part of the output with lag=0
            rr_1 : out std_logic_vector(N+N+2 downto 0); -- real part of the output with lag=1
            ri_1 : out std_logic_vector(N+N+2 downto 0)  -- imaginary part of the output with lag=1
            );

end corr_1;

architecture hard_arch of corr_1 is
    signal Nyi,Cyi : std_logic_vector(N-1 downto 0);                         --signals used to conjugate the second signal
    signal yi_c : signed(N-1 downto 0);                                      --signals used to conjugate the second signal
    signal yr_d,yi_d : std_logic_vector(N-1 downto 0);                      --delayed signals used to do correlation with lag=1
    signal temr_0,temi_0,temr_1,temi_1 : std_logic_vector(N+N downto 0); --midterm signals for accumulator
    signal Srr_0,Srr_1,Sri_0,Sri_1 : signed(N+N+2 downto 0);             --midterm signals for accumulator
    signal counter_0 : integer range 0 to M;                             --counter with initial value of 0
    signal counter_1 : integer range 0 to M;                            --counter with initial value of 0  


-- component declaration (as we are using complex multiplier)
    component cmux_m1 
        port (ar,ai : in std_logic_vector( N-1 downto 0);
                br,bi : in std_logic_vector( N-1 downto 0);
                pr,pi : out std_logic_vector( N+N downto 0)
               );
    end component;      
begin

-- conjugating process using two's complement for the imaginary part of the second input signal
    process(clk)
        begin
            Nyi<= not yi;
            yi_c<=signed(Nyi);
            if rising_edge(clk) then
                Cyi<=std_logic_vector(yi_c + 1);                            --now conjugated signal is ready to be used 
            end if;
    end process;

-- delaying our second signal to prepare for correlation with lag=1 
    process(clk)
        begin
            if rising_edge(clk) then
                yr_d<=yr;
                yi_d<=Cyi;
            end if;
    end process;    

-- calculating correlation with lag=0
    process(clk)
        begin
            Srr_0<=(others=>'0');
            Sri_0<=(others=>'0');
            if counter_0 < M then
                if rising_edge(clk) then
                    cmult_unit : cmux_m1    
                    port map(ar=>xr, ai=>xi, br=>yr, bi=>Cyi, pr=>temr_0, pi=>temi_0);
                    Srr_0<= signed(temr_0) + Srr_0;
                    Sri_0<= signed(temi_0) + Sri_0;
                    counter_0<= counter_0 + 1;
                    rr_0<=std_logic_vector(Srr_0);
                    ri_0<=std_logic_vector(Sri_0);
                end if;
            elsif counter_0=M then
                Srr_0<=(others=>'0');
                Sri_0<=(others=>'0');
                rr_0<=(others=>'0');
                ri_0<=(others=>'0');
            end if;     
    end process;
实体corr_1为
通用(N:整数:=4;--N是信号的每个输入symbpl的宽度
M:整数:=4);--M是要关联的信号的选定部分的长度
端口(时钟:在标准逻辑中;
Xr,席:在STDYLogLogic向量(N-1下降到0);第一信号的实Ni位符号
yr,yi:标准逻辑向量(N-1到0);——第二个信号的实部和虚部N位符号
rr_0:out std_logic_vector(N+N+2向下到0);--滞后为0的输出的实部
ri_0:out std_logic_vector(N+N+2向下到0);--滞后为0的输出的虚部
rr_1:out std_logic_vector(N+N+2向下到0);--滞后=1的输出的实部
ri_1:out标准逻辑向量(N+N+2向下至0)——滞后=1的输出虚部
);
完(1);
corr_1的架构硬拱门是
信号Nyi,Cyi:std_逻辑_向量(N-1向下至0)--用于共轭第二个信号的信号
信号yi_c:有符号(N-1向下至0)--用于共轭第二个信号的信号
信号yr\u d,yi\u d:标准逻辑向量(N-1向下至0)--用于与滞后=1进行相关的延迟信号
信号temr_0、temi_0、temr_1、temi_1:std_逻辑_向量(N+N向下至0)--蓄电池的中期信号
信号Srr_0、Srr_1、Sri_0、Sri_1:已签名(N+N+2向下至0)--蓄电池的中期信号
信号计数器_0:整数范围0到M--初始值为0的计数器
信号计数器_1:0到M的整数范围--初始值为0的计数器
--组件声明(当我们使用复数乘法器时)
组件cmux_m1
端口(ar,ai:std_逻辑_向量中(N-1到0);
br,bi:标准逻辑向量(N-1到0);
pr,pi:out标准逻辑向量(N+N向下至0)
);
端部元件;
开始
--对第二输入信号的虚部使用两个补码的共轭过程
过程(clk)
开始
Nyitemr_0,pi=>temi_0);

Srr_0您正试图在一个进程中实例化您的组件(一个
if
语句)。这并不意味着什么。组件(实际上)是一块硬件。当您实例化它时,它必须始终存在。您无法在进程内实例化组件(或
if
语句),就像您无法让芯片在PCB上神奇地出现和消失一样


组件必须在
开始
结束架构
之间实例化欢迎使用堆栈溢出。我看不出您的组件实例化有任何错误,这表明错误在别处。在询问有关堆栈溢出的问题时,发布一条消息几乎总是有帮助的,然后试图帮助您的人可以重现您的问题。谢谢您的回复。我正在分享更多代码以获得帮助,它将计算相关性。当然,如果它能工作:)HDLPARSERS:164是一个XST错误代码,在语法分析期间报告意外的令牌这里是保留字port,它只能出现在实体或组件声明中的port子句、块头或组件实例化、块头或绑定指示中的端口映射方面。在顺序语句中找不到这些语句。组件实例化是一个并发语句。非常感谢。错误消失:)或在一系列语句中,这些语句也将排除子程序和流程语句。