在VHDL中重用旧组件

时间:2015-07-02 22:54:27

标签: vhdl vivado

我是VHDL的新手并跟随xilinx提供的实验室,但我在某个方面迷失了方向。在其中一个实验室中,我做了2位宽2to1多路复用器。在我目前的实验室中,我应该使用两个旧的多路复用器来构建一个3to1多路复用器。它根本没有解释如何做到这一点,所以我在这个黑暗中采取了刺。我收到以下错误代码。

  

[HDL 9-806]" end"附近的语法错误。 [" C:/ Nexys 4> Projects / lab1_5_dataflow / lab1_5_dataflow.srcs / sources_1 / new / mux_2bit_3_to_1_dat> aflow.vhd":48]

     

[HDL 9-806]";"附近的语法错误。 [" C:/ Nexys 4> Projects / lab1_5_dataflow / lab1_5_dataflow.srcs / sources_1 / new / mux_2bit_3_to_1_dat> aflow.vhd":52]

     

[HDL 9-806]" =>"附近的语法错误。 [" C:/ Nexys 4> Projects / lab1_5_dataflow / lab1_5_dataflow.srcs / sources_1 / new / mux_2bit_3_to_1_dat> aflow.vhd":55]

     

[HDL 9-806]";"附近的语法错误。 [" C:/ Nexys 4> Projects / lab1_5_dataflow / lab1_5_dataflow.srcs / sources_1 / new / mux_2bit_3_to_1_dat> aflow.vhd":59]

     

[HDL 9-806]" =>"附近的语法错误。 [" C:/ Nexys 4> Projects / lab1_5_dataflow / lab1_5_dataflow.srcs / sources_1 / new / mux_2bit_3_to_1_dat> aflow.vhd":62]

这是我的主要源文件的代码。

library IEEE;
use IEEE.STD_LOGIC_1164.ALL;

entity mux_2bit_3_to_1_dataflow is
Port ( u : in STD_LOGIC_VECTOR (1 downto 0);
       v : in STD_LOGIC_VECTOR (1 downto 0);
       w : in STD_LOGIC_VECTOR (1 downto 0);
       s : in STD_LOGIC_VECTOR (1 downto 0);
       o : out STD_LOGIC_VECTOR (1 downto 0));
end mux_2bit_3_to_1_dataflow;

architecture Behavioral of mux_2bit_3_to_1_dataflow is
component mux_2bit_2_to_1 port
(
    x, y : in STD_LOGIC_VECTOR;
    s : in STD_LOGIC;
    m : out STD_LOGIC_VECTOR
) end component;
signal a : STD_LOGIC_VECTOR;
begin
mux1 : mux_2bit_2_to_1 port map (
    x => u;                                            LINE 52
    y => v;
    s => s(1);
    m => a                                             LINE 55
);

mux2 : mux_2bit_2_to_1 port map (
     x => a;                                           LINE 59
     y => w;
     s => s(0);
     m => o;                                           LINE 62
);


end Behavioral;

这是我添加到项目中的2到1 mux的源文件。

entity mux_2bit_2_to_1 is
Port ( x : in STD_LOGIC_VECTOR (1 downto 0);
       y : in STD_LOGIC_VECTOR (1 downto 0);
       s : in STD_LOGIC;
       m : out STD_LOGIC_VECTOR (1 downto 0));
end mux_2bit_2_to_1;

architecture Behavioral of mux_2bit_2_to_1 is

begin
m(0) <= (x(0) and not s) or (y(0) and s);
m(1) <= (x(1) and not s) or (y(1) and s);


end Behavioral;

1 个答案:

答案 0 :(得分:1)

两件事。首先,您在SELECT a.[Current ClaimID] ,a.[Claim Adjustment Type Code] ,a.[Claim Effective Date] FROM #tmp_hic_dupes_list_final_not10 a INNER JOIN (SELECT [ClaimAdjustment Type Code], MAX([Claim Effective Date]) AS MostRecentEffectiveDate FROM #tmp_hic_dupes_list_final_not10 GROUP BY [ClaimAdjustment Type Code]) AS XYZ ON a.[Claim Effective Date] = XYZ.MostRecentEffectiveDate ORDER BY a.[Current ClaimID], a.[ClaimAdjustment Type Code] 之前错过了分号:

end component;

第二件事,在实例化中分配端口时使用冒号:

component mux_2bit_2_to_1
port (
    x, y : in STD_LOGIC_VECTOR;
    s : in STD_LOGIC;
    m : out STD_LOGIC_VECTOR
); -- <--- semicolon here
end component;

最后,在第二个实例化中,您在最后一个端口(mux1 : mux_2bit_2_to_1 port map ( x => u, y => v, s => s(1), m => a ); )上使用分号。首先,端口实例化没有分号,第二个,在结束括号之前没有冒号。