📄 bcdadder.vhd
字号:
Library ieee;
Use ieee.std_logic_1164.all;
Use ieee.std_logic_unsigned.all;
Entity bcdadder is
Port( a,b : in std_logic_vector(3 downto 0);
ci : in std_logic;
result : out std_logic_vector(3 downto 0);
co : out std_logic );
End bcdadder;
Architecture Na of bcdadder is
constant adjnum : integer:=6;
signal binadd : std_logic_vector(4 downto 0);
signal re: std_logic_vector(4 downto 0);
Begin
binadd<=('0'&a)+('0'&b)+ci;
process(binadd)
variable tmp: integer range 0 to 6;
begin
if binadd>9 then tmp:=adjnum; else tmp:=0; end if;
re<= binadd+tmp;
result<=re(3 downto 0);
co<=re(4);
end process;
End Na;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -