-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathPriorityEncoder.vhd
More file actions
46 lines (41 loc) · 1.11 KB
/
Copy pathPriorityEncoder.vhd
File metadata and controls
46 lines (41 loc) · 1.11 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
library ieee;
use ieee.std_logic_1164.all;
entity PriorityEncoder is
port (PriorityEncoderReg : STD_LOGIC_VECTOR(7 downto 0);
PE_out : OUT STD_LOGIC_VECTOR(2 downto 0);
PE0 : OUT STD_LOGIC);
end PriorityEncoder;
architecture behave of PriorityEncoder is
begin
process (PriorityEncoderReg)
begin
if PriorityEncoderReg(0) = '1' then
PE_out <= "000";
PE0 <= '0';
elsif PriorityEncoderReg(1) = '1' then
PE_out <= "001";
PE0 <= '0';
elsif PriorityEncoderReg(2) = '1' then
PE_out <= "010";
PE0 <= '0';
elsif PriorityEncoderReg(3) = '1' then
PE_out <= "011";
PE0 <= '0';
elsif PriorityEncoderReg(4) = '1' then
PE_out <= "100";
PE0 <= '0';
elsif PriorityEncoderReg(5) = '1' then
PE_out <= "101";
PE0 <= '0';
elsif PriorityEncoderReg(6) = '1' then
PE_out <= "110";
PE0 <= '0';
elsif PriorityEncoderReg(7) = '1' then
PE_out <= "111";
PE0 <= '0';
else
PE_out <= "000";
PE0 <= '1';
end if;
end process;
end behave;