十进制位加法计数器设计.doc
文本预览下载声明
洛阳理工学院
十
进
制
4
位
加
法
计
数
器
系别:电气工程与自动化系
姓名:李奇杰 学号:十进制4位加法计数器设计
设计要求:
设计一个十进制4位加法计数器设计
设计目的:
1. 掌握EDA设计流程
2. 熟练VHDL语法
3. 理解层次化设计的内在含义和实现
设计原理
通过数电知识了解到十进制异步加法器的逻辑电路图如下
则可以通过对JK触发器以及与门的例化连接实现十进制异步加法器的设计
设计内容
JK触发器逻辑功能表:
J
K
CP
Q
Qn
0
0
↓
Q
Q’
0
1
↓
0
1
1
0
↓
1
0
1
1
↓
Q’
Q
JK触发器的VHDL文本描述实现:
--JK触发器描述
library ieee;
use ieee.std_logic_1164.all;
entity jk_ff is
port(
j,k,clk: in std_logic;
q,qn:out std_logic
);
end jk_ff;
architecture one of jk_ff is
signal q_s: std_logic;
begin
process(j,k,clk)
begin
if clkevent and clk=0 then
if j=0 and k=0 then
q_s = q_s;
elsif j=0 and k=1 then
q_s = 0;
elsif j=1 and k=0 then
q_s = 1;
elsif j=1 and k=1 then
q_s = not q_s;
end if;
end if;
end process;
q = q_s;
qn = not q_s;
end one;
元件门级电路:
与门VHDL文本描述实现:
--与门描述
library ieee;
use ieee.std_logic_1164.all;
entity yumen2 is
port(
a,b:in std_logic;
co:out std_logic
);
end entity yumen2;
architecture one of yumen2 is
begin
co= (a and b );
end architecture one;
门级电路:
十进制异步加法器例化元件文本实现:
library ieee; --JK触发器描述
use ieee.std_logic_1164.all;
entity jk_ff is
port(
j,k,clk: in std_logic;
q,qn:out std_logic
);
end jk_ff;
architecture one of jk_ff is
signal q_s: std_logic;
begin
process(j,k,clk)
begin
if clkevent and clk=0 then
if j=0 and k=0 then
q_s = q_s;
elsif j=0 and k=1 then
q_s = 0;
elsif j=1 and k=0 then
q_s = 1;
elsif j=1 and k=1 then
q_s = not q_s;
end if;
end if;
end process;
q = q_s;
qn = not q_s;
end one;
--与门描述
library ieee;
use ieee.std_logic_1164.all;
entity yumen2 is
port(
a,b:in std_logic;
co:out std_logic
);
end entity yumen2;
architecture one of yumen2 is
begin
co= (a and b );
end architecture one;
library ieee; --十进制加法计数器描述
use ieee.std_logic_1164.all;
entity count10 is
port(
cp: in std_logic;
c:out std_logic;
q:out std_logic_vector(3 downto 0)
);
end entity count10;
architecture count of count10 is
--例化元件JK触发器
component jk_ff
port(
j,k,clk: in std_logic;
q,qn:o
显示全部