Skip to content

Instantly share code, notes, and snippets.

@davilamds
Last active August 29, 2015 14:05
Show Gist options
  • Save davilamds/18ebcc508aba983f3288 to your computer and use it in GitHub Desktop.
Save davilamds/18ebcc508aba983f3288 to your computer and use it in GitHub Desktop.
Encoder prioridad
library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
entity Priority_encoder is
port(
r: in std_logic_vector(4 downto 1);
pcode: out std_logic_vector(2 downto 0)
);
end Priority_encoder;
architecture cond_arch of Priority_encoder is
begin
pcode <= "100" when (r(4)='1') else
"011" when (r(3)='1') else
"010" when (r(2)='1') else
"001" when (r(1)='1') else
"000";
end cond_arch;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment