打印

新人请教关于T触发器的问题~~~

[复制链接]
1110|0
手机看帖
扫描二维码
随时随地手机跟帖
跳转到指定楼层
楼主
mhanchen|  楼主 | 2011-12-26 21:40 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
library ieee;
use ieee.std_logic_1164.all;
entity ttrig is
port(clk : in std_logic;
       t : in std_logic;
       q : out std_logic;
      qb : out std_logic);
end ttrig;
architecture behave of ttrig is
      signal qtemp : std_logic;
begin
process(clk)
begin
     if clk'event and clk='1' then
         if t<='0' then
            qtemp<=qtemp;
         else
            qtemp<=not qtemp;
         end if;
     end if;
end process;
    q<=qtemp;
   qb<=not qtemp;
end behave;


library ieee;
use ieee.std_logic_1164.all;
entity ttrig is
port(clk : in std_logic;
       t : in std_logic;
       q : out std_logic;
      qb : out std_logic);
end ttrig;
architecture behave of ttrig is
       signal qtemp : std_logic;
begin
process(clk)
begin
      if clk'event and clk='1' then
           if t<='1' then
              qtemp<=not qtemp;
           else
              qtemp<=qtemp;
           end if;
      end if;
end process;
    q<=qtemp;
    qb<=not qtemp;
end behave;

关于T触发器的描述:
     上面一段的程序仿真结果是正确的,即:输入信号t为低电平时,输出信号保持;输入信号t为高时,输出信号q相对上个状态反相。
     下面那段程序结果为:输出信号q只随时钟信号的上升沿变化,输入信号t低电平时起不到保持的作用。

小弟一开始认为是因为输入信号t的数据类型std_logic所致,所以将下段程序中输入信号t改为bit类型,可仿真结果却仍然错误。求高手指点一二,谢谢。

相关帖子

发新帖 我要提问
您需要登录后才可以回帖 登录 | 注册

本版积分规则

30

主题

252

帖子

2

粉丝