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

📄 priority.vhd

📁 这是自己编写的一个优先编码器程序
💻 VHD
字号:
library IEEE;
use IEEE.std_logic_1164.all,IEEE.numeric_std.all;
entity priority is
  generic(n:POSITIVE :=2);
  port(a:in std_logic_vector(2**n-1 downto 0);
       y:out std_logic_vector(n-1 downto 0);
       valid:out std_logic);
   end entity priority;
   
  architecture iterative of priority is
   begin
   process (a) is
    begin 
    valid<='0';
    y<=(others=>'0');
    for i in a'RANGE loop
    if a(i)='1' then
    y<=std_logic_vector(to_unsigned(i,n));
    valid<='1';
    exit;
    end if;
    end loop;
    end process;
    end architecture iterative;    

⌨️ 快捷键说明

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