作者CuckooBoy (阿書)
看板comm_and_RF
標題[問題] VHDL之計數器問題
時間Mon May 14 21:27:43 2007
http://ilook.tw/7e6a
這是一個,上/下緣皆累加的計數器
但是發現有一個問題
如圖中, 框/圈起來的地方...
也就是cnt_r跟cnt_f都為3後歸0的那段會出問題
不知道如何解決呢?小弟一直想不出什麼辦法!
此模擬的程式如下,請大大指點...感謝~~
===========================================================
library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
use IEEE.STD_LOGIC_ARITH.ALL;
use IEEE.STD_LOGIC_UNSIGNED.ALL;
entity test is
Port ( Clock : in std_logic;
Led : out std_logic_vector(3 downto 0));
end test;
architecture Behavioral of test is
signal cnt : std_logic_vector(3 downto 0);
signal cnt_r:std_logic_vector(3 downto 0);
signal cnt_f:std_logic_vector(3 downto 0);
begin
process(Clock)
begin
if rising_edge(Clock) then
if cnt_r<3 then
cnt_r<=cnt_r+'1';
end if;
end if;
end process;
process(Clock)
begin
if falling_edge(Clock) then
if cnt_f<3 then
cnt_f <= cnt_f + '1';
end if;
end if;
end process;
cnt <= cnt_r + cnt_f;
Led<=cnt;
end Behavioral;
--
※ 發信站: 批踢踢實業坊(ptt.cc)
◆ From: 123.195.6.78
1F:→ zerocustom00:+/-源觸發都一起用可能也會無法合成. 220.130.19.220 05/15 10:22
2F:→ zerocustom00:何不倍頻再做計數器. 220.130.19.220 05/15 10:23