[英]Understanding this T Flip-Flop example?
我正在閱讀一本VHDL書,無法理解他們給出的示例。
給出的代碼:
-------------------------------------------------------------------
-- RET T Flip-flop model with active-low asynchronous set input. --
-------------------------------------------------------------------
-- library declaration
library IEEE;
use IEEE.std_logic_1164.all;
-- entity
entity t_ff_s is
port ( T,S,CLK : in std_logic;
Q : out std_logic);
end t_ff_s;
-- entity
architecture my_t_ff_s of t_ff_s is
signal t_tmp : std_logic; -- intermediate signal declaration
begin
tff: process (S,CLK)
begin
if (S = '0') then
Q <= '1';
elsif (rising_edge(CLK)) then
t_tmp <= T XOR t_tmp; -- temp output assignment
end if;
end process tff;
Q <= t_tmp; -- final output assignment
end my_t_ff_s;
我不明白的是它們如何向Q分配多個信號。在流程語句之外,它是Q <= t_tmp
但是在流程內部,如果S='0'
則Q <= '1'
。 這是如何工作的? 我對VHDL的了解有限,這對我來說似乎是錯誤的。 基本上,這對我來說就像寫一樣:
Q <= '0';
Q <= '1';
誰能幫助我更好地理解這個例子?
您是對示例的質疑。 壞了
Q <= '1';
應該
t_tmp <= '1';
有人意識到他們無法讀取輸出,介紹了t_tmp,只更改了一半代碼。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.