0
我對VHDL中的結構建模有以下代碼。當我嘗試編譯它(ghdl -a filename.vhdl),我得到這個錯誤在4線以下評論:「< =」或「:=」預期而不是端口結構VHDL代碼中的端口映射
順便說一句,我已經定義在下面的代碼塊之前使用的組件。
我的代碼有什麼問題?我不允許在進程/ if語句中使用port map
?
我能做些什麼來解決這個問題?謝謝!
-- Entity Definition
entity jk is
port(
CP: in std_logic; -- clock signal
J : in std_logic; -- J signal
K : in std_logic; -- K signal
Q : inout std_logic; -- Q signal
QN : inout std_logic; -- Q' signal
reset : in std_logic -- reset signal
);
end entity jk;
architecture dev1 of jk is
-- declare the singals that outputs the results of some gates
signal a, b, internal_q, internal_qn : std_logic;
-- get each component needed
component and3 is
port(o0 : out std_logic; i0, i1, i2: in std_logic);
end component and3;
component nor2 is
port(o0 : out std_logic; i0, i1: in std_logic);
end component nor2;
begin
internal_q <= Q; -- used to show internal Q value
QN <= not Q; -- inverse of Q
internal_qn <= QN; -- used to show internal QN value
process is
begin
if (reset = '0') then -- asynchronous reset
Q <= '0';
internal_qn <= '0';
elsif rising_edge(CP) then -- on positive clock edge
-- AND gate outputs
g0: and3 port map(a, internal_q, K, CP); -- error
g1: and3 port map(b, internal_qn, J, CP); - error
-- NOR gate outputs
g2: nor2 port map(Q, a, internal_qn); -error
g3: nor2 port map(QN, b, internal_q); -error
end if;
end process;
end architecture dev2;
他的組件在正確的位置聲明:他應該在組合區域(在「開始」之後和進程之外)實例化它們 –
@Russell - 我已經添加了組件。我需要這個過程,因爲如果沒有它,if語句就不能放在任何地方。我還需要用於CP的rising_edge()的if語句。 –
對不起,我的第一句話是對的,第二句是錯的。我將「你應該聲明你的組件」改爲「你應該實例化你的組件」Happy @BrianDrummond? :) – Russell