我正在读一本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的。在process语句之外,它是Q <= t_tmp,但在进程内部,if S='0' then Q <= '1'。这到底是如何工作的呢?由于我对VHDL的理解有限,这看起来是错误的。基本上,在我看来,这就像是在写:
Q <= '0';
Q <= '1';有人能帮我更好地理解这个例子吗?
发布于 2012-04-21 00:48:58
你质疑这个例子是对的。它坏了。
Q <= '1';应该是
t_tmp <= '1';有人意识到他们无法读取输出,于是引入了t_tmp,只修改了一半的代码。
https://stackoverflow.com/questions/10250095
复制相似问题