?? vhdljianfaqi1.doc
字號:
library ieee;
use ieee.std_logic_1164.all;
use ieee.std_logic_arith.all;
use ieee.std_logic_unsigned.all;
entity jian4 is
port
( a: in unsigned(3 downto 0);
b: in unsigned(3 downto 0);
cin:in std_logic;
bcdout: out std_logic_vector(3 downto 0);
cout:out std_logic );
end jian4;
architecture a of jian4 is
signal c,y:std_logic_vector(3 downto 0);
begin
y(0)<=a(0)xor b(0)xor cin;
c(0)<=(not a(0)and b(0))or(b(0)and cin)or( not a(0)and cin);
gen:for I in 1 to 3 generate
y(I)<=a(I)xor b(I)xor c(I-1);
c(I)<=(c(I-1)and not a(I)) or (c(I-1)and b(I))or (not a(I)and b(I));
end generate;
bcdout<=y(3)&y(2)&y(1)&y(0);
cout<=c(3);
end a;
很簡單的一個減法器的程序 對于初學者來說 這是一個很好的機會 它可以給大家許多的幫助 希望大家更加的努力 可以創作出來更好的程序 因為我本身也是個新人 所以請大家不要罵我 也給我一些支持 如果有什么我能幫到大家的地方 我會盡力的幫助大家的 謝謝
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -