专注收集记录技术开发学习笔记、技术难点、解决方案
网站信息搜索 >> 请输入关键词:
您当前的位置: 首页 > 硬件开发

关于书上的用vhdl做t触发器的例子的有关问题

发布时间:2010-06-13 21:44:44 文章来源:www.iduyao.cn 采编人员:星星草
关于书上的用vhdl做t触发器的例子的问题
代码如下
library ieee;
use ieee.std_logic_1164.all;
entity tff is
port(
t,clk,reset:in std_logic;
q:out std_logic);
end tff;
architecture tff_art of tff is
signal q_temp:std_logic;
begin
process(clk)
begin
if rising_edge(clk) then
if t='1' then
q_temp<=not q_temp;
else
q_temp<=q_temp;
end if;
q<=q_temp;
end process;
q<=q_temp;
end tff_art;
问题:
1.在process中为什么不直接用q而是用q_temp
2.在end process后面为什么又写了一遍q<=q_temp;

------解决方案--------------------
1、q不能对自己取反,所以要用q_temp寄存一下
2、end process后的q<=q_temp,和process前的q<=q_temp,只需保留一个即可,多写没有作用

3、程序中少了一处end if;
友情提示:
信息收集于互联网,如果您发现错误或造成侵权,请及时通知本站更正或删除,具体联系方式见页面底部联系我们,谢谢。

其他相似内容:

热门推荐: