微型计算机程序代码比较大小,《微型计算机原理及应用技术》程序代码.doc

这篇博客展示了使用VHDL编程实现微型计算机中的一些核心组件,包括2分频电路、N分频电路(以8选1为例)、多进制加法计数器、基本D触发器和异步复位的D触发器。通过这些实例,读者可以了解到如何在数字逻辑设计中运用VHDL来描述和实现数字系统。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

《微型计算机原理及应用技术》程序代码

《微型计算机原理及应用技术》编程程序

目录:

2分频电路

N分频电路(8选一为例)

多进制加法计数器

基本D触发器

数据选择器(四选一)

异步复位可逆计数器

优先编码器

2分频电路

library ieee;

use ieee.std_logic_1164.all;

entity fredvider1 is

port(

clock:in std_logic;

clkout:out std_logic

);

end;

architecture behavior of fredvider1 is

signal clk:std_logic;

begin

process(clock)

begin

if rising_edge(clock) then

clk<=not clk;

end if;

end process;

clkout<=clk;

end;

N分频电路(8选一为例)

library ieee;

use ieee.std_logic_1164.all;

entity fredevider8 is

port

(clkin:in std_logic;

clkout:out std_logic);

end;

architecture bhv of fredevider8 is

constant n:integer:=3;

signal counter:integer range 0 to N;

signal clk:std_logic;

begin

process(clkin)

begin

if rising_edge(clkin) then

if counter = n then

counter <=0;

clk <= not clk;

else

counter <= counter+1;

end if;

end if;

end process;

clkout <= clk;

end;

多进制加法计数器

library ieee;

use ieee.std_logic_1164.all;

use ieee.std_logic_unsigned.all;

entity count2 is

port

(cp,res:in std_logic;

ql,qh:out std_logic_vector(3 downto 0));

end;

architecture bhv of count2 is

signal qnl,qnh:std_logic_vector(3 downto 0);

begin

process(cp,res)

begin

if res = '1' then qnl<="0000";qnh<="0000";

elsif rising_edge(cp) then

if qnl="0011" and qnh="0010"

then qnl<="0000";

qnh<="0000";

elsif qnl="1001" then qnl<="0000";qnh<=qnh+1;

else qnl<=qnl+1;

end if;

end if;

end process;

ql <= qnl;

qh <= qnh;

end;

基本D触发器

library ieee;

use ieee.std_logic_1164.all;

entity dff1 is

port( d: in std_logic;

clk: in std_logic;

q: out std_logic);

end;

architecture bhv of dff1 is

signal qn: std_logic;

begin

process(clk)

begin

if rising_edge(clk) then

qn<=d;

end if;

end process;

q<= qn;

end;

异步复位的D触发器

library ieee;

use ieee.std_logic_1164.all;

entity dff2 is

port(D,clk,clr: in std_logic;

Q: out std_logic);

――定义输入、输出端口

end entity dff2;

architecture one of dff2 is

begin

process(clk,D,clr)

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值