0
votes
 library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
use IEEE.STD_LOGIC_UNSIGNED.ALL;
entity DruigZadatak is
 Port ( iSW : in  STD_LOGIC_VECTOR (7 downto 0);
       iSEL : in  STD_LOGIC;
       oLED : out  STD_LOGIC_VECTOR (7 downto 0));
 end DruigZadatak;

 architecture Behavioral of DruigZadatak is

begin
    oLED <= "11111111" when iSEL ='0' else
            oLED(3 downto 0) <= (iSW(5 downto 3) + iSW(2 downto 0)),
            oLED(6 downto 4) <= "111" when iSW(7)='1' else
            "110" when iSW(6)='1' else
            "101" when iSW(5)='1' else
            "100" when iSW(4)='1' else
            "011" when iSW(3)='1' else
            "010" when iSW(2)='1' else
            "001" when iSW(1)='1' else  
            "000" when iSW(0)='1';  
    oLed(7) <= '0' when iSW ="00000000" else
        iSEL;
 end Behavioral;

and i get following errors

ERROR:HDLCompiler:288 -Line 45: Cannot read from 'out' object oled ; use 'buffer' or 'inout'
ERROR:HDLCompiler:1731 -Line 45: found '0' definitions of operator "<=", cannot determine exact overloaded matching  definition for "<="
ERROR:HDLCompiler:288 -Line 47: Cannot read from 'out' object oled ; use 'buffer' or 'inout'
ERROR:HDLCompiler:1731 -Line 47: found '0'   definitions of operator "<=", cannot determine exact overloaded matching definition for "<="
ERROR:HDLCompiler:854 -Line 39: Unit <behavioral> ignored due to previous errors.

if someone could explain to me what should i do that and why these errors keep coming out it would be great, thanks. i hope you understand what was the point of my project..

1

1 Answers

1
votes

Your conditional signal assignment statement can't have another conditional signal assignment statement embedded in it.

Break the assignments into three pieces instead of two:

 architecture foo of DruigZadatak is

 begin
     oLED (6 downto 4) <= "111" when iSEL = '0' or iSW(7) = '1' else 
                          "110" when iSW(6)='1' else
                          "101" when iSW(5)='1' else
                          "100" when iSW(4)='1' else
                          "011" when iSW(3)='1' else
                          "010" when iSW(2)='1' else
                          "001" when iSW(1)='1' else  
                          "000" when iSW(0)='1';                       

     oLED ( 3 downto 0) <= "1111"                    when iSEL = '0' else
                           '0' & (iSW(5 downto 3) + iSW(2 downto 0)) ;
     oLed(7) <= '0'   when iSW ="00000000" else    
                iSEL;                      
 end architecture;

Also note the concatenation of the '0' to the result of the addition to make the right hand side expression length match the left hand side of the assignment.

These three assignments are elaborated into equivalent processes with if statements. You could combine the if statements into a single process, they all would have identical sensitivity lists.

With VHDL -2008 compliant tools you could use sequential conditional signal assignment statements in a single process.

The above architecture with three concurrent signal assignment statements analyzes, elaborates and simulates (telling us there are no length mismatches and everything connects up).