📄 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 + -