bcdadd4.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 + -
显示快捷键?