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

[問題求助] 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;
喜歡嗎?分享這篇文章給親朋好友︰
               感謝作者     

請注意︰利用多帳號發表自問自答的業配文置入性行銷廣告者,將直接禁訪或刪除帳號及全部文章!
您需要登錄後才可以回覆 登入 | 註冊


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

GMT+8, 2024-5-8 15:03

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