0
在下面的代碼中沒有合成錯誤,但是當我模擬它時仍然沒有得到輸出。 cout
始終保持邏輯1。請任何人幫我找出最新的錯誤?爲什麼我沒有得到輸出以下除以3時鐘vhdl代碼?
library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
use IEEE.STD_LOGIC_ARITH.ALL;
use IEEE.STD_LOGIC_UNSIGNED.ALL;
entity divide_by_3 is
port (
cout :out std_logic; -- Output clock
clk :in std_logic; -- Input clock
reset :in std_logic -- Input reset
);
end divide_by_3;
architecture Behavioral of divide_by_3 is
signal pos_cnt :std_logic_vector (1 downto 0);
signal neg_cnt :std_logic_vector (1 downto 0);
begin
process (clk, reset)
begin
if (reset = '1') then
pos_cnt <= (others=>'0');
elsif (rising_edge(clk)) then
if (pos_cnt = "10") then
pos_cnt <= pos_cnt + '1';
end if;
end if;
end process;
process (clk, reset) begin
if (reset = '1') then
neg_cnt <= (others=>'0');
elsif (falling_edge(clk)) then
if (neg_cnt = "10") then
neg_cnt <= neg_cnt + '1';
end if;
end if;
end process;
cout <= '1' when ((pos_cnt /= "10") and (neg_cnt /= "10")) else
'0';
end Behavioral;
嘿感謝很多..它的工作:) – meghs 2011-05-13 13:05:53