4bitbcd加法.vhd

来自「含有各类寄存器」· VHDL 代码 · 共 26 行

VHD
26
字号
LIBRARY ieee;USE ieee.std_logic_1164.all;USE ieee.std_logic_unsigned.all;ENTITY bcdadd4 IS	PORT (op1, op2	: in std_logic_vector(3 downto 0);		   result	: out std_logic_vector(4 downto 0)        );END bcdadd4;ARCHITECTURE behavior OF bcdadd4 IS    signal   binadd    :std_logic_vector(4 downto 0);BEGIN  binadd<=('0' & op1) +('0' & op2);  process(binadd)   begin     if binadd>9 then           result <= binadd+6;       else         result <= binadd;     end if;     end process;      END behavior;

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?