使用 T 触发器的 VHDL 中的 FSM

问题描述 投票:0回答:1

我刚刚开始学习 VHDL 编程,在理解这个问题时遇到一些困难。我有一个功能正常的 T 触发器 VHDL 代码(见下文),我知道我可以在该 FSM 的程序中调用它,但我不知道如何去做。

`library IEEE;
use IEEE.STD_LOGIC_1164.ALL;

-- Uncomment the following library declaration if using
-- arithmetic functions with Signed or Unsigned values
use IEEE.NUMERIC_STD.ALL;

-- Uncomment the following library declaration if instantiating
-- any Xilinx leaf cells in this code.
--library UNISIM;
--use UNISIM.VComponents.all;

entity tFF is
--  Port ( );
Port ( Rin, Sin, Tin, CK: in std_logic;
Qo : inout std_logic);

end tFF;

architecture designTff of tFF is

begin

process (CK)
begin


if (( CK'event and CK = '1') and ((Rin = '1') and (Sin = '1'))) then
if (Tin = '0') then
Qo <= Qo;
elsif (Tin = '1') then
Qo <= not Qo;
end if;
end if;

if (Rin = '0') then
Qo <= '0';
elsif (Sin = '0') then
Qo <= '1';
end if;

end process;


end designTff;`

我想

T
Clk
将是
inout
X
Y
Z
将被淘汰。难道是我想多了?

这就是我目前所拥有的

library IEEE;
use IEEE.STD_LOGIC_1164.ALL;

-- Uncomment the following library declaration if using
-- arithmetic functions with Signed or Unsigned values
use IEEE.NUMERIC_STD.ALL;

-- Uncomment the following library declaration if instantiating
-- any Xilinx leaf cells in this code.
--library UNISIM;
--use UNISIM.VComponents.all;

entity Q1 is
Port (T, Clk: inout std_logic;
X, Y, Z: out std_logic);
end Q1;

architecture Behavioral of Q1 is

begin

process (CK)
begin


end Behavioral;

我认为我的下一步是编写一个类似于我的 T 触发器程序中的事件/过程......我走在正确的道路上吗?

vhdl clock state-machine flip-flop
1个回答
0
投票

是的,你想多了。将您的逻辑封装在一个块中,并考虑将发生什么以及发生什么?这里,

X
Y
Z
出来,所以它们是
out
,但是
T
clk
要进去,所以它们是
input
而不是
inout
。这是一件事,
clk
始终是顺序模块的
input
信号。同样,在您的 T-Flipflop 中,您的
Qo
也必须是
out
而不是
inout

其次,由于您已经模拟了 T-FlipFlop,接下来就是在

AND
模块中实例化这些 T-FlipFlops 和
Q1
门。实例化是我们将多个模块连接在一起以进行大型设计的地方。

© www.soinside.com 2019 - 2024. All rights reserved.