VHDL中的门电平T触发器

时间:2019-03-08 12:04:25

标签: vhdl flip-flop

我正在尝试在VHDL中对T级触发器进行编码,但是显然出了点问题,我找不到它。

    library IEEE;
use IEEE.STD_LOGIC_1164.ALL;

entity TFF is
port( T: in std_logic;
Clock: in std_logic;
reset: in std_logic;
notq: inout std_logic:= '0';
Q: inout std_logic:= '1');
end TFF;

architecture Behavioral of TFF is
signal tmp: std_logic := '0';
signal r: std_logic := '0';
signal s: std_logic := '0';
signal tmp2: std_logic := '0';
begin

    r <= t and clock and q;
    s <= clock and t and notq;
    tmp <= r nor notq;
    tmp2 <= s nor q;
    q <= tmp and reset;
    notq <= not q

end Behavioral;

谢谢。

PS:这是我模拟此代码时发生的事情:

enter image description here

我正在使用下图以及异步重置。

enter image description here

编辑2:我重写了它,并用out和used信号替换了inout。但是出现此错误: at 0 ps:达到了迭代限制10000。在第30行出现信号无法解析为稳定值的情况下,无法及时进行仿真的情况下,可能检测到零延迟振荡

    architecture Behavioral of TFF is
signal tmp: std_logic := '0';
signal r: std_logic := '0';
signal s: std_logic := '0';
signal tmp2: std_logic := '0';
signal tmp3: std_logic := '0';
signal tmp4: std_logic := '0';
begin

    r <= t and clock and tmp3;
    s <= clock and t and tmp4;
    tmp <= r nor tmp4;
    tmp2 <= s nor tmp3;
    tmp3 <= tmp and reset;
    tmp4 <= not tmp3;
    q <= tmp3;
    notq <= tmp4;

end Behavioral;  

我正在使用 Xilinx ISE设计套件进行仿真。

0 个答案:

没有答案