⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 luojidanyuan.vhd

📁 一些很好的FPGA设计实例
💻 VHD
字号:
library ieee;
use ieee.std_logic_1164.all;
use ieee.std_logic_unsigned.all;

---------------------------------
entity luijidanyuan is 
port ( a,b : in std_logic_vector(7 downto 0);
       sel : in std_logic_vector(3 downto 0);
       cin : out std_logic;
       y   : out std_logic_vector(7 downto 0));
end luijidanyuan;
---------------------------------------------
architecture dataflow of luijidanyuan is
  signal arith, logic: std_logic_vector(7 downto 0);
begin
---------------arithmetic unit-----------------
   when sel (2 downto 0 )select
    arith <= a when "000",
           a+1 when "001",
           a-1 when "010",
           b   when "011",
           b+1 when "100",
           b-1 when "101",
           a+b when "110",
           a+b+cin when others;
-----------------logic unit------------------------
  when sel (2 downto 0 )select
    logic <= not a when "000",
             not b when "001",
             a and b when "010",
             a or b when "011",
             a nand b when "100",
             a nor b when "101",
             a xor b when "110",
             not(a xor b) when others;
------------------mux-----------------------------
with sel(3) select
       y<= arith when '0';
           logic when  others;
end dataflow;    
----------------------------------------------------        

⌨️ 快捷键说明

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