数理逻辑实验报告七

  1. 1、下载文档前请自行甄别文档内容的完整性,平台不提供额外的编辑、内容补充、找答案等附加服务。
  2. 2、"仅部分预览"的文档,不可在线预览部分如存在完整性等问题,可反馈申请退款(可完整预览的文档不适用该条件!)。
  3. 3、如文档侵犯您的权益,请联系客服反馈,我们会尽快为您处理(人工客服工作时间:9:00-18:30)。

触发器的仿真

实验内容:

1.调用系统中的74LS163芯片,对其进行波形仿真,验证其功能。

2.用逻辑图和VHDL语言编写一个能够实现同样功能的电路(能同步清零、同步置数的4位二进制计数器)。

3.修改代码,将这个计数器修改为模10计数器。

实验主要步骤及实验结果:

74LS163

1、新建工程队74LS163进行波形仿真,编译后的正确的逻辑图为:

波形仿真后的结果为:

能同步清零、同步置数的4位二进制计数器

2、用VHDL描述74SL163

代码:

library ieee;

use ieee.std_logic_1164.all;

use ieee.std_logic_arith.all;

entity V74163 is

port(clk,clr_l,ld_l,enp,ent:in std_logic; D:in UNSIGNED (3 downto 0);

Q:out UNSIGNED (3 downto 0);

rco:out std_logic);

end V74163;

architecture V74163_arch of V74163 is

signal IQ: UNSIGNED (3 downto 0);

begin

process(clk,ent,IQ)

begin

if(clk'event and clk='1')then

if clr_l='0' then IQ <= (others =>'0'); elsif ld_l='0' then IQ <= D;

elsif (ent and enp)='1' then IQ <= IQ +1; end if;

end if;

if(IQ=15) and (ent='1')then rco<='1';

else rco <= '0';

end if;

Q<=IQ;

end process;

end V74163_arch;

波形仿真后的结果为:

模10计数器

3、修改2中的代码将其变为模10计数器后为:

library ieee;

use ieee.std_logic_1164.all;

use ieee.std_logic_unsigned.all;

entity V74163 is

PORT(data: in std_logic_vector(3 downto 0);

clk,ld,p,t,clr:in std_logic;

count: buffer std_logic_vector(3 downto 0);

tc:out std_logic);

end V74163;

architecture behavior OF V74163 IS

begin

tc<='1' when (count="1001" and p='1' and t='1' and ld='1' and clr='1') else '0';

cale:

process(clk,clr,p,t,ld)

begin

if(rising_edge(clk)) then

if(clr='1')then

if(ld='1')then

if(p='1')then

if(t='1')then

if(count="1001")then

count<="0000";

else

count<=count+1;

end if;

else

count<=count;

end if;

else

count<=count;

end if;

else

count<=data;

end if;

else

count<="0000";

end if;

end if;

end process cale;

end behavio r;

波形仿真后的结果为:

相关文档
最新文档