四位全加器在Quartus上如何实现

来源:百度知道 编辑:UC知道 时间:2024/06/30 03:25:17

恩 怎么说呢,方法太多了 我可以用VHDL 可以用 Verilog写 可以用电路图画。 四位全加器水平太低了把。 你才给0分。
用verilog写的画。可以用门级别的方式。可以用数据输出流方式 ,可以用行为描述级别的。 N中方式。太多了
VHLD
library ieee;
use ieee.std_logic_1164.all;
use ieee.std_logic_unsigned.all;
entity adder4bit is
port(cin: in std_logic;
a,b: in std_logic_vector(3 downto 0);
s: out std_logic_vector(3 downto 0);
cout: out std_logic );
end adder4bit;
architecture beh of adder4bit is
signal sint: std_logic_vector(4 downto 0);
signal aa,bb: std_logic_vector(4 downto 0);
begin
aa<='0' & a (3 downto 0);
bb<='0' & b(3 downto 0);
sint<= aa+bb+cin;
s(3 downto 0) <= sint (3 downto 0);
cout<= sint(4);
end beh;

verilog门级别的:module halfadder (a,b,s,c);
input a;
input b;
output s;
output c;
reg s;
reg c;
always @(a,b)
begin
s<