[英]T flip flop VHDL code
我正在學習VHDL,遇到了以下代碼:
Entity fft is
port (t, r: in bit; q: out bit);
End entity;
Architecture fft_df of fft is
signal state: bit :='0';
Begin
state <='0' when r='1' else
not state when t='0' and t'event else
state;
q<=state;
End;
好吧,我對此代碼的作用感到懷疑,這是否是帶復位的T觸發器的行為或數據流描述。 並且,那么, not state when t='0' and t'event
, not state when t='0' and t'event
的含義是什么? (我想T觸發器在下降沿工作)。
謝謝大家。
我錯過了時鍾輸入。 T型觸發器(具有異步復位)實際上是由
entity tff is
port (clk, reset, t: in bit; q: out bit);
end entity;
architecture rtl of tff is begin
q <= '0' when reset = '1' else
not q when rising_egde(clk) and t = '1';
end;
或更常用的寫法是:
architecture rtl of tff is begin
tff_proc : process(clk, reset) begin
if reset = '1' then
q <= '0';
elsif rising_egde(clk) then
if t = '1' then
q <= not q;
end if;
end if;
end process;
end;
ps讀取輸出需要在VHDL-2008模式下進行編譯。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.