我有這樣的代碼我想要做的LSFR,但我有幾個問題,包括:錯誤與VHDL腳本語法
ERROR:HDLParsers:3010 - "C:/Users/user/Documents/tp_vhdl/median_LSFR/LSFR.vhd" Line 18. Entity LFSR does not exist.
ERROR:HDLParsers:3312 - "C:/Users/user/Documents/tp_vhdl/median_LSFR/LSFR.vhd" Line 19. Undefined symbol 'std_logic_vector'.
ERROR:HDLParsers:1209 - "C:/Users/user/Documents/tp_vhdl/median_LSFR/LSFR.vhd" Line 19. std_logic_vector: Undefined symbol (last report in this block)
ERROR:HDLParsers:3312 - "C:/Users/user/Documents/tp_vhdl/median_LSFR/LSFR.vhd" Line 20. Undefined symbol 'std_logic'.
ERROR:HDLParsers:1209 - "C:/Users/user/Documents/tp_vhdl/median_LSFR/LSFR.vhd" Line 20. std_logic: Undefined symbol (last report in this block)
ERROR:HDLParsers:3312 - "C:/Users/user/Documents/tp_vhdl/median_LSFR/LSFR.vhd" Line 24. Undefined symbol 's_xor1'.
代碼:
library ieee;
use ieee.std_logic_1164.all;
use IEEE.STD_LOGIC_ARITH.ALL;
use IEEE.STD_LOGIC_UNSIGNED.ALL;
library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
entity LSFR is port (
clk : in std_logic;
reset,en : in std_logic;
de1,de2 : out std_logic_vector(2 downto 0)
);
end LSFR;
architecture arch of LFSR is
signal etatpresent, etatfutur : std_logic_vector(16 downto 1);
signal s_xor1, s_xor2, s_xor3 : std_logic;
begin
-- Calcul intermediaire des ou exclusifs
s_xor1 <= etatpresent(15) xor etatpresent(1);
s_xor2 <= etatpresent(14) xor etatpresent(1);
s_xor3 <= etatpresent(12) xor etatpresent(1);
-- Calcul de l'état futur en fonction de l'état présent et des ou exclusifs
process(etatpresent) begin
etatfutur(16) <= etatpresent(1);
etatfutur(1) <= etatpresent(2);
etatfutur (2) <= etatpresent(3);
etatfutur (3) <= etatpresent(4);
etatfutur (4) <= etatpresent(5);
etatfutur (5) <= etatpresent(6);
etatfutur (6) <= etatpresent(7);
etatfutur (7) <= etatpresent(8);
etatfutur (8) <= etatpresent(9);
etatfutur (9) <= etatpresent(10);
etatfutur (10) <= etatpresent(11);
etatfutur (11) <= s_xor3;
s_xor3 <= etatpresent(12);
etatfutur (12) <= etatpresent(13);
etatfutur (13) <= s_xor2;
s_xor2 <= etatpresent(14);
etatfutur (14) <= s_xor1;
s_xor1 <= etatpresent(15);
etatfutur (15) <= etatpresent(16);
end process;
process(reset) begin
if (reset = '1') then
etatfutur <="0000000000000001";
end if ;
end process;
-- cablage des deux sorties
de1(2 downto 0) <= etatpresent(16 downto 14);
de2 (2 downto 0) <= etatpresent(3 downto 1);
end arch;
您已經聲明瞭兩次庫。 – Maria
高興地仔細閱讀錯誤消息。這只是LSFR/LFSR中的一個錯字。 –