首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >理解这个T触发器的例子吗?

理解这个T触发器的例子吗?
EN

Stack Overflow用户
提问于 2012-04-21 00:35:52
回答 1查看 1.3K关注 0票数 2

我正在读一本VHDL书,在理解他们给出的一个例子时遇到了困难。

给出的代码:

代码语言:javascript
复制
-------------------------------------------------------------------
-- 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的。在process语句之外,它是Q <= t_tmp,但在进程内部,if S='0' then Q <= '1'。这到底是如何工作的呢?由于我对VHDL的理解有限,这看起来是错误的。基本上,在我看来,这就像是在写:

代码语言:javascript
复制
Q <= '0';
Q <= '1';

有人能帮我更好地理解这个例子吗?

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2012-04-21 00:48:58

你质疑这个例子是对的。它坏了。

代码语言:javascript
复制
Q <= '1';

应该是

代码语言:javascript
复制
t_tmp <= '1';

有人意识到他们无法读取输出,于是引入了t_tmp,只修改了一半的代码。

票数 4
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/10250095

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档