Intel® Quartus® Prime Software
Intel® Quartus® Prime Design Software, Design Entry, Synthesis, Simulation, Verification, Timing Analysis, System Design (Platform Designer, formerly Qsys)
17247 Discussions

Error using shift and power operator

Altera_Forum
Honored Contributor II
1,868 Views

Hi; 

I am getting error using sla and ** operators. 

My code is as under : 

Rx_Buff_i : in STD_LOGIC_VECTOR (7 downto 0); 

signal Chksum : std_logic_vector(7 downto 0) := 

(others => '0'); 

signal Shft_buff : std_logic_vector(1607 downto 

0) :=(others => '0'); 

Shft_buff<= Shft_buff sla 8; 

Chksum <= Chksum ** Rx_Buff_i; 

I am including the following libraries: 

use IEEE.STD_LOGIC_1164.ALL; 

use IEEE.STD_LOGIC_unsigned.ALL; 

use IEEE.std_logic_arith.all; 

use IEEE.numeric_std.ALL; 

The following errors I am getting 

1)found '0' definitions of operator "sla", cannot 

determine exact overloaded matching definition 

for "sla" 

2) found '0' definitions of operator "**", cannot 

determine exact overloaded matching definition 

for "**" 

plz help
0 Kudos
1 Reply
Altera_Forum
Honored Contributor II
1,055 Views

 

--- Quote Start ---  

Hi; 

I am getting error using sla and ** operators. 

 

I am including the following libraries: 

use IEEE.STD_LOGIC_1164.ALL; 

use IEEE.STD_LOGIC_unsigned.ALL; 

use IEEE.std_logic_arith.all; 

use IEEE.numeric_std.ALL; 

--- Quote End ---  

 

 

Please, don't use numeric_std and std_logic_arith/unsigned at the same time! That makes for a lot of type confusion. Use numeric_std only. 

 

 

--- Quote Start ---  

Shft_buff<= Shft_buff sla 8; 

Chksum <= Chksum ** Rx_Buff_i; 

 

The following errors I am getting 

1)found '0' definitions of operator "sla", cannot 

determine exact overloaded matching definition 

for "sla" 

 

--- Quote End ---  

 

 

Regarding the sla operator, it is not defined for std_logic_vector. It is defined (in numeric_std) for unsigned and signed, but they're problematic and nobody uses them (and they may not synthesize). Instead, just use the usual shift left: 

 

ShiftLeft : process (clk) is begin if rising_edge(clk) then foo <= foo(foo'left - 1 downto 0) & '0'; end if; end process ShiftLeft; 

 

 

--- Quote Start ---  

 

2) found '0' definitions of operator "**", cannot 

determine exact overloaded matching definition 

for "**" 

plz help 

--- Quote End ---  

 

 

The exponent has to be:  

a) a constant (compile-time) integer. It cannot be a variable and it certainly cannot be a std_logic_vector. 

b) a power-of-two, which means it is implemented as a shift left. 

 

So just use the shift left.
0 Kudos
Reply