flater0614 2015-06-27 08:06
浏览 1412

vhdl中buffer与inout的区别

library ieee;
use ieee.numeric_bit.all;

entity clock is
port (clk, inch, incm, incha, incma, set_alarm, alarm_off:in bit;
hours, ahours, minutes, aminutes, seconds: inout unsigned(7 downto 0);
am_pm, aam_pm, ring: inout bit;
alarm_set: inout bit);
end clock;

architecture clock1 of clock is
component CTR_59 is
port(clk, inc, reset:in bit;dout: out unsigned(7 downto 0);
t59: out bit);
end component;

component CTR_12 IS
port(clk, inc: in bit; dout: out unsigned(7 downto 0);am_pm: inout bit);
end component;

signal s59 , m59 , inchr , incmin ,c99 :bit;
signal alarm_ring_time :integer range 0 to 50;
signal div100:integer range 0 to 99; a

begin
sec1:ctr_59 port map(clk,c99,'0',seconds,s59);
min1:ctr_59 port map(clk,incmin,'0',minutes,m59);
hrs1:ctr_12 port map(clk,inchr,hours,am_pm);
incmin<=(s59 and c99)or incm;
inchr<=(m59 and s59 and c99)or inch;
alarm_min:ctr_59 port map(clk,incma,'0',aminutes,open);
alarm_hr:ctr_12 port map(clk,incha,ahours,aam_pm);
c99<='1' when div100 =99 else '0';
process(clk)
begin
if clk'event and clk='1' then
if c99='1' then div100<= 0;
else div100<=div100+1;
end if;
if set_alarm='1' then
alarm_set <=not alarm_set;
end if;
if ((minutes=aminutes)and(hours=ahours)and(am_pm=aam_pm))and seconds=0 and alarm_set='1' then
ring<='1';
end if;
if ring='1' and c99='1' then
alarm_ring_time<=alarm_ring_time+1;
end if;
if alarm_ring_time=50 or alarm_off='1' then
ring<='0';alarm_ring_time<=0;
end if;
end if;
end process;
end clock1;

这段程序出自数字系统设计与VHDL(第二版)385-386页,书上使用的是inout,但是我换成buffer仿真结果也没有区别,请问大家这里有必须要用inout的理由嘛?

  • 写回答

0条回答 默认 最新

    报告相同问题?

    悬赏问题

    • ¥15 fpga自动售货机数码管(相关搜索:数字时钟)
    • ¥20 Python安装cvxpy库出问题
    • ¥15 用前端向数据库插入数据,通过debug发现数据能走到后端,但是放行之后就会提示错误
    • ¥15 python天天向上类似问题,但没有清零
    • ¥30 3天&7天&&15天&销量如何统计同一行
    • ¥30 帮我写一段可以读取LD2450数据并计算距离的Arduino代码
    • ¥15 C#调用python代码(python带有库)
    • ¥15 活动选择题。最多可以参加几个项目?
    • ¥15 飞机曲面部件如机翼,壁板等具体的孔位模型
    • ¥15 vs2019中数据导出问题