实验说明:
1.使用 quartusII 9.0 完成8位可控的二进制补码加减法器
2.使用 VHDL 语言编写代码
3.学会模块化编程处理
实验步骤
一. 先实现一位全加器
library ieee;
use ieee.std_logic_1164.all;
entity fa is
port(a,b,ci : in std_logic;
s,co : out std_logic);
end fa;
architecture b_fa of fa is
begin
s<=a xor b xor ci;
co<=((a xor b) and ci) or (a and b);
end b_fa;
二. 使用刚设计的全加器设计
library ieee;
use ieee.std_logic_1164.all;
entity adder8 is
port(a,b : in std_logic_vector(7 downto 0);
ci,m : in std_logic;
s : out std_logic_vector(7 downto 0);
co ,vf: out std_logic);