EDA 1位全加器实验报告
- 格式:doc
- 大小:47.00 KB
- 文档页数:4
南华大学
船山学院
实验报告
(2009 ~2010 学年度第二学期)
课程名称EDA
实验名称1位全加器
姓名学号200994401
专业计算机科学与
班级01
技术
地点8-212 教师
一、实验目的:
熟悉MAX+plus 10.2的VHDL 文本设计流程全过程
二、实验原理图:
ain cout
cout ain bin sum
cin
bin sum
cin
f_adder
or2a
f e d
u3
u2u1b
a c
co so
B
co so
B
h_adder A h_adder
A
三、实验代码:
(1)LIBRARY IEEE; USE IEEE.STD_LOGIC_1164.ALL;
ENTITY f_adder IS
PORT (ain ,bin ,cin : IN STD_LOGIC; cout ,sum : OUT STD_LOGIC ); END ENTITY f_adder;
ARCHITECTURE fd1 OF f_adder IS COMPONENT h_adder PORT ( a ,b : IN STD_LOGIC; co ,so : OUT STD_LOGIC); END COMPONENT ; COMPONENT or2a
PORT (a ,b : IN STD_LOGIC; c : OUT STD_LOGIC); END COMPONENT ;
SIGNAL d ,e ,f : STD_LOGIC; BEGIN
u1 : h_adder PORT MAP(a=>ain ,b=>bin ,co=>d ,so=>e); u2 : h_adder PORT MAP(a=>e , b=>cin , co=>f ,so=>sum); u3 : or2a PORT MAP(a=>d , b=>f , c=>cout);
END ARCHITECTURE fd1;
(2)LIBRARY IEEE;
USE IEEE.STD_LOGIC_1164.ALL;
ENTITY h_adder IS
PORT (a, b : IN STD_LOGIC;
co, so : OUT STD_LOGIC);
END ENTITY h_adder;
ARCHITECTURE fh1 OF h_adder is
SIGNAL abc : STD_LOGIC_VECTOR(1 DOWNTO 0) ;
BEGIN
abc <= a & b ;
PROCESS(abc)
BEGIN
CASE abc IS
WHEN "00" => so<='0'; co<='0' ;
WHEN "01" => so<='1'; co<='0' ;
WHEN "10" => so<='1'; co<='0' ;
WHEN "11" => so<='0'; co<='1' ;
WHEN OTHERS => NULL ;
END CASE;
END PROCESS;
END ARCHITECTURE fh1 ;
(3)LIBRARY IEEE ;
USE IEEE.STD_LOGIC_1164.ALL;
ENTITY or2a IS
PORT (a, b :IN STD_LOGIC;
c : OUT STD_LOGIC );
END ENTITY or2a;
ARCHITECTURE one OF or2a IS
BEGIN
c <= a OR b ;
END ARCHITECTURE one ;
四、实验结果:
五、实验心得:
一位全加器设计可以由两个半加器组合而成,那么八位全加器的VHDL设计应该也可以由八个一位全加器来完成,效果应该和原理图输入一样呢?