📄 alu.vhd
字号:
--------------------------------------------------------------------------------
-- Company:
-- Engineer:
--
-- Create Date: 10:32:27 10/15/05
-- Design Name:
-- Module Name: execontrol - Behavioral
-- Project Name:
-- Target Device:
-- Tool versions:
-- Description:
--
-- Dependencies:
--
-- Revision:
-- Revision 0.01 - File Created
-- Additional Comments:
--
--------------------------------------------------------------------------------
library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
use IEEE.STD_LOGIC_ARITH.ALL;
use IEEE.STD_LOGIC_UNSIGNED.ALL;
---- Uncomment the following library declaration if instantiating
---- any Xilinx primitives in this code.
--library UNISIM;
--use UNISIM.VComponents.all;
entity alu is
port( input1,input2 :in std_logic_vector(7 downto 0);
opreg:in std_logic_vector(3 downto 0);
output:out std_logic_vector(7 downto 0));
end alu;
architecture Behavioral of alu is
begin
process(input1,input2,opreg)
begin
if opreg="0000" then output<=input1+input2;
elsif opreg="0001" then output<=input1-input2;
elsif opreg="0010" or opreg="0111" then output<=input1;
end if ;
end process;
end Behavioral;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -