SOGO論壇
  登入   註冊   找回密碼
查看: 1206|回覆: 2
列印 上一主題 下一主題

[問題求助] VHDL process 執行時機? [複製連結]

Rank: 2

狀態︰ 離線
跳轉到指定樓層
1
發表於 2016-2-17 23:15:07 |只看該作者 |倒序瀏覽
小弟我看書上寫 VHDL process(sensitivity list),
process運作是偵測到 sensitivity list 訊號有變化就會執行底下所有敘述,
但小弟實際上我實際上測試,如果沒有掛一個if來偵測CLK的訊號變化根本不會動。

小弟以前學VHDL的時候都是掛一個CLK來運作,當初也沒想太多為什麼,
最近自己在玩卻一直搞不懂為什麼不能這樣操作,請各位大大指點迷津,謝謝。

不會動的程式碼:
library ieee;
Use ieee.std_logic_1164.all;
Use ieee.std_logic_arith.all;
Use ieee.std_logic_unsigned.all;

entity test is
        port (
                CLK : in  std_logic;
                SO : out std_logic_vector(2 downto 0)
        );
end test;


architecture output of test is
        signal buf : std_logic_vector(2 downto 0) := "000";
begin
        process(CLK)
        begin
                buf <= buf + 1;
                SO <= buf;
        end process;
end output;

會動的程式碼:
library ieee;
Use ieee.std_logic_1164.all;
Use ieee.std_logic_arith.all;
Use ieee.std_logic_unsigned.all;

entity test is
        port (
                CLK : in  std_logic;
                SO : out std_logic_vector(2 downto 0)
        );
end test;


architecture output of test is
        signal buf : std_logic_vector(2 downto 0) := "000";
begin
        process(CLK)
        begin
                if ((CLK'event) and (CLK='1')) then
                        buf <= buf + 1;
                        SO <= buf;
                end if;
        end process;
end output;
喜歡嗎?分享這篇文章給親朋好友︰
               感謝作者     

Rank: 3Rank: 3

狀態︰ 離線
2
發表於 2016-6-1 23:45:20 |只看該作者
恩...該怎麼說勒.....
因為你要它處理時脈信號,但是begin之後沒有clk的描述句
在組譯器來看,就像是和它說請依照clk做事,但實際硬體上沒給clk的輸入點一樣

論壇顧問

Q^心靈導師^Q

Rank: 14Rank: 14Rank: 14Rank: 14

顧問勳章 原創及親傳圖影片高手勳章 布布達人勳章

狀態︰ 離線
3
發表於 2016-6-2 08:04:02 |只看該作者
你的process依據CLK動作,但你沒有描述要動作的條件,後面那個程式中,你加上一段if,那就是描述要動作的條件。
請注意︰利用多帳號發表自問自答的業配文置入性行銷廣告者,將直接禁訪或刪除帳號及全部文章!
您需要登錄後才可以回覆 登入 | 註冊


本論壇為非營利自由討論平台,所有個人言論不代表本站立場。文章內容如有涉及侵權,請通知管理人員,將立即刪除相關文章資料。侵權申訴或移除要求:abuse@oursogo.com

GMT+8, 2024-4-27 09:21

© 2004-2024 SOGO論壇 OURSOGO.COM
回頂部