Hi guys! I just coded a 4 to 2 priority encoder and am getting the following errors:
How do I fix these? Here is my code:
Code VHDL - [expand] |
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
| library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
entity priorityencoder is
port(en_l: in std_logic; --Active low enable
din: in std_logic_vector(3 downto 0); --Active high data input
dv_l: out std_logic; --Valid output active low
dout: out std_logic_vector(1 downto 0) --Active high data output
);
end priorityencoder;
architecture Behavioral of priorityencoder is
signal en: std_logic;
signal dv: std_logic;
begin
en <= not en_l; --Activation level conversion
dv_l <= not dv; --Activation level conversion
process(din, en)
begin
if(en = '1' and dv = '1') then
if(din(0) = '1') then
dout <= "11"; --LSB has priority
if(din(1) = '1') then
dout <= "10";
if(din(2) = '1') then
dout <= "01";
if(din(3) = '1') then --MSB has least priority
dout <= "00";
end if;
else
en <= '0';
dv <= '0';
dout <= "00";
end if;
end process;
end Behavioral; |