全國最多中醫師線上諮詢網站-台灣中醫網
發文 回覆 瀏覽次數:1354
推到 Plurk!
推到 Facebook!

FPGA 時鐘問題

缺席
kychtht
一般會員


發表:3
回覆:3
積分:1
註冊:2007-04-12

發送簡訊給我
#1 引用回覆 回覆 發表時間:2007-04-16 23:33:24 IP:220.131.xxx.xxx 訂閱
我剛學不久~
我要做24H製的時鐘~但我一直DEBUG~一直用不出來~
Xilinx ISE 8.2i軟體~
請會的人幫我看一下哪出錯了~謝

library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
use IEEE.STD_LOGIC_ARITH.ALL;
use IEEE.STD_LOGIC_UNSIGNED.ALL;

---- Uncomment the following library declaration if instantiating
---- any Xilinx primitives in this code.
--library UNISIM;
--use UNISIM.VComponents.all;

entity CLOCK_00_60 is
Port ( CLK : in STD_LOGIC;
RESET : in STD_LOGIC;
ENABLE : out STD_LOGIC_VECTOR (6 downto 0);
SEGMENT : out STD_LOGIC_VECTOR (6 downto 0));
end CLOCK_00_60;

architecture Behavioral of CLOCK_00_60 is
signal SCAN_CLK :STD_LOGIC;
signal COUNT_CLK :STD_LOGIC;
signal DECODE_BCD :STD_LOGIC_VECTOR (3 downto 0);
signal mineable :STD_LOGIC;
signal hreable :STD_LOGIC;
signal POSITION:STD_LOGIC_VECTOR (6 downto 0);
signal DIVIDER:STD_LOGIC_VECTOR (29 downto 1);
signal COUNT_BCD:STD_LOGIC_VECTOR (23 downto 0);

begin
-------------------------------------------------
process (CLK,RESET)
begin
if RESET = '0' then
DIVIDER <= ( others => '0');
elsif CLK' event and CLK = '1' then
DIVIDER <= DIVIDER 1 ;
end if;
end process;
COUNT_CLK<=DIVIDER(24);
SCAN_CLK<=DIVIDER(15);
------------------------------------------------秒
process(RESET,SCAN_CLK)
begin
if RESET = '0' then
COUNT_BCD <= ( others => '0');
elsif SCAN_CLK' event and SCAN_CLK = '1' then
if COUNT_BCD(3 downto 0)= x"9" then
COUNT_BCD(3 downto 0)<= x"0";
COUNT_BCD(7 downto 4)<= COUNT_BCD(7 downto 4) 1;
else
COUNT_BCD(3 downto 0)<= COUNT_BCD(3 downto 0) 1;
end if;
end if;
end process;
mineable <= '1' when COUNT_BCD(7 downto 0) = x"59" else '0';
----------------------------------------------------------分

process(RESET,SCAN_CLK)
begin
if RESET = '0' then
COUNT_BCD <= ( others => '0');
if mineable = '1' then
elsif SCAN_CLK' event and SCAN_CLK = '1' then
if COUNT_BCD(11 downto 8)= x"9" then
COUNT_BCD(11 downto 8)<= x"0";
COUNT_BCD(15 downto 12)<= COUNT_BCD(15 downto 12) 1;
else
COUNT_BCD(11 downto 8)<= COUNT_BCD(11 downto 8) 1;
end if;
end if;
end if;
end process;
hreable <= '1' when COUNT_BCD(15 downto 8) = x"59" else '0';
-------------------------------------------------------------時
process(RESET,SCAN_CLK)
begin
if RESET = '0' then
COUNT_BCD <= ( others => '0');
if mineable = '1' and hreable = '1' then
elsif SCAN_CLK' event and SCAN_CLK = '1' then
if COUNT_BCD(19 downto 16)= x"9" then
COUNT_BCD(19 downto 16)<= x"0";
COUNT_BCD(23 downto 20)<= COUNT_BCD(23 downto 20) 1;
if COUNT_BCD(19 downto 16)= x"2" then
COUNT_BCD(23 downto 20)<= x"0";
else
COUNT_BCD(19 downto 16)<= COUNT_BCD(19 downto 16) 1;
end if;
end if;
end if;
end if;
end process;

process(RESET,SCAN_CLK)
begin
if RESET = '0' then
POSITION <= "1111110";
elsif SCAN_CLK' event and SCAN_CLK = '1' then
POSITION<="111111"&POSITION(0);
end if;
end process;
ENABLE<=POSITION;
-----------------------------------------------------------
process(POSITION,SCAN_CLK)
begin
case POSITION is
when "1111110" => DECODE_BCD <=COUNT_BCD(3 downto 0); --秒
when "1111101" => DECODE_BCD <=COUNT_BCD(7 downto 4); --秒
when "1111011" => DECODE_BCD <=COUNT_BCD(11 downto 8); --分
when "1110111" => DECODE_BCD <=COUNT_BCD(15 downto 12); --分
when "1101111" => DECODE_BCD <=COUNT_BCD(19 downto 16); --時
when "1011111" => DECODE_BCD <=COUNT_BCD(23 downto 20); --時
when others => null;
end case;
end process;

with DECODE_BCD Select
SEGMENT<= "1000000" when X"0",
"1111001" when X"1",
"0100100" when X"2",
"0110000" when X"3",
"0011001" when X"4",
"0010010" when X"5",
"0000010" when X"6",
"1111000" when X"7",
"0000000" when X"8",
"0010000" when X"9",
"1111111" when others;

end Behavioral;


版主


發表:261
回覆:2302
積分:1667
註冊:2005-01-04

發送簡訊給我
#2 引用回覆 回覆 發表時間:2007-04-17 01:13:46 IP:219.70.xxx.xxx 未訂閱
請描述一下問題所在 or 問題發生的情況, 大家會比較好著手.
我想大家可能沒有耐心看完整個程式.
------
-------------------------------------------------------------------------
走是為了到另一境界,停是為了欣賞人生;未走過千山萬水,怎知生命的虛實與輕重!?
kychtht
一般會員


發表:3
回覆:3
積分:1
註冊:2007-04-12

發送簡訊給我
#3 引用回覆 回覆 發表時間:2007-04-17 18:51:24 IP:220.140.xxx.xxx 訂閱
顯示~~
ERROR:Xst:827 - "F:/FPGA/CLOCK_00_60/CLOCK_00_60.vhd" line 77: Signal COUNT_BCD<15> cannot be synthesized, bad synchronous description.

ssejack
高階會員


發表:87
回覆:143
積分:106
註冊:2005-06-27

發送簡訊給我
#4 引用回覆 回覆 發表時間:2007-04-20 01:43:12 IP:218.168.xxx.xxx 訂閱
您有兩個 process 都在 reset 時將 COUNT_BCD <= others => '0';應當有問題!
修改將其對應之 bit reset 就好!但是否有其他問題?
系統時間:2024-05-20 1:03:13
聯絡我們 | Delphi K.Top討論版
本站聲明
1. 本論壇為無營利行為之開放平台,所有文章都是由網友自行張貼,如牽涉到法律糾紛一切與本站無關。
2. 假如網友發表之內容涉及侵權,而損及您的利益,請立即通知版主刪除。
3. 請勿批評中華民國元首及政府或批評各政黨,是藍是綠本站無權干涉,但這裡不是政治性論壇!