gpt4 book ai didi

vhdl - 了解这个 T 触发器示例?

转载 作者:行者123 更新时间:2023-12-04 18:23:02 25 4
gpt4 key购买 nike

我正在阅读一本 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 并且只更改了一半的代码。

关于vhdl - 了解这个 T 触发器示例?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10250095/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com