Forum Discussion
Altera_Forum
Honored Contributor
18 years agoError 10327: Can't determine definition of operator ""+""
Hello to everybody,
could someone tell me what's wrong in the following code? library ieee; use ieee.std_logic_1164.all; use ieee.numeric_std.all; entity round16to12 is port ( a : in std_logic_vector(15 downto 0); q : out std_logic_vector(11 downto 0) ); end entity; architecture beh of round16to12 is signal roundoff : std_logic_vector(11 downto 0) := (0 => a(3), others => '0'); begin process(a) begin line 23: q <= (not( a(15)) & a(14 downto 4)) + roundoff; end process; end beh; The error message is the following: Error (10327): VHDL error at round16to12.vhd(23): can't determine definition of operator ""+"" -- found 0 possible definitions Thank for your support30 Replies
- Altera_Forum
Honored Contributor
you havent shown the definition of ARRAY32TO3 type.
- Altera_Forum
Honored Contributor
Actually, y_den is a single signed number, not an array of signed. Y_den(0) is a single bit - you cannot add that to a signed.
- Altera_Forum
Honored Contributor
--- Quote Start --- Actually, y_den is a single signed number, not an array of signed. Y_den(0) is a single bit - you cannot add that to a signed. --- Quote End --- Oh.. Yes..sorry. i forget to post the first file.. with the definition of subtype and type.. so i correct y_den into array32to2 but the error of "+" don't change.. LIBRARY ieee; USE ieee.std_logic_1164.ALL; use ieee.numeric_std.all; use ieee.std_logic_signed.all; PACKAGE width_bit_signed IS SUBTYPE BITS16 IS signed(15 downto 0) ; --11bit SUBTYPE BITS32 IS signed(31 downto 0); --22bit TYPE ARRAY16TO3 IS ARRAY (0 TO 2) OF BITS16; TYPE ARRAY32TO2 IS ARRAY (0 TO 1) OF BITS32; TYPE ARRAY32TO3 IS ARRAY (0 TO 2) OF BITS32; END width_bit_signed; Mh... i compile this program last week and it function ..then i change the size of the register into 11 and 22 bit instead of 16 and 32 and it don't function so i rewrite the original program with 16 and 32 bit but.. there is alway the error that don't recognize "+" why????:confused::( thank for your response Tricky.. - Altera_Forum
Honored Contributor
--- Quote Start --- Oh.. Yes..sorry. i forget to post the first file.. with the definition of subtype and type.. so i correct y_den into array32to2 but the error of "+" don't change.. LIBRARY ieee; USE ieee.std_logic_1164.ALL; use ieee.numeric_std.all; use ieee.std_logic_signed.all; PACKAGE width_bit_signed IS SUBTYPE BITS16 IS signed(15 downto 0) ; --11bit SUBTYPE BITS32 IS signed(31 downto 0); --22bit TYPE ARRAY16TO3 IS ARRAY (0 TO 2) OF BITS16; TYPE ARRAY32TO2 IS ARRAY (0 TO 1) OF BITS32; TYPE ARRAY32TO3 IS ARRAY (0 TO 2) OF BITS32; END width_bit_signed; Mh... i compile this program last week and it function ..then i change the size of the register into 11 and 22 bit instead of 16 and 32 and it don't function so i rewrite the original program with 16 and 32 bit but.. there is alway the error that don't recognize "+" why????:confused::( thank for your response Tricky.. --- Quote End --- at 19:40 i resolve my problem when i rewrite i don't put y like an array but only single register.. sorry.. i'm tired.. all day in front of the pc.. and so i write crazy code... Thank you Tricky!:-P Can i engage you like my personal debugger??? :o - Altera_Forum
Honored Contributor
i've got the same error for the operator "-". Using signed type and ieee.numeric_std. I would like to ask if my usage of "for" is correct.
library IEEE; use IEEE.STD_LOGIC_1164.ALL; use IEEE.STD_LOGIC_signed.ALL; use IEEE.STD_LOGIC_TEXTIO.ALL; use ieee.numeric_std.all; entity stage_1 is Port ( clk : in bit; imagem: in SIGNED (19999 DOWNTO 0); imagemanterior: in SIGNED (19999 DOWNTO 0); Ix: out SIGNED (24999 DOWNTO 0); Iy: out SIGNED (24999 DOWNTO 0); It: out SIGNED (24999 DOWNTO 0) ); end stage_1; architecture Behavioral of stage_1 is begin process (clk) begin If (clk 'event and clk = '1') then for I in 0 to 2448 loop Ix(I*10+9 DOWNTO I*10) <= 1/4 * (imagemanterior((I+1)*8+7 DOWNTO (I+1)*8) - imagemanterior(I*8+7 DOWNTO I*8) + imagemanterior ((I+1)*8+407 DOWNTO (I+1)*8+400) - imagemanterior(I*8+407 DOWNTO I*8+400) + imagem((I+1)*8+7 DOWNTO(I+1)*8) - imagem(I*8+7 DOWNTO I*8)+ imagem((I+1)*8+407 DOWNTO(I+1)*8) - imagem((I)*8+407 DOWNTO I*8 +400)); Iy(I*10+9 DOWNTO I*10) <= 1/4*(imagemanterior((I*8)+407 DOWNTO (I)*8+400) - imagemanterior(I*8+7 DOWNTO I*8) + imagemanterior((I+1)*8+407 DOWNTO (I+1)*8) - imagemanterior((I+1)*8+7 DOWNTO(I+1)*8) + imagem(I*8+407 DOWNTO I*8+400) - imagem(I*8+7 DOWNTO I*68) + imagem((I+1)*8+407 DOWNTO (I+1)*8+400) -imagem((I+1)*8+7 DOWNTO(I+1)*8)); It(I*10+9 DOWNTO I*10) <= 1/4 * (imagem(I*8+7 DOWNTO I*8)- imagemanterior((I*8+7)-I*8) + imagem((I*8)+407 DOWNTO I*8+400)- imagemanterior(I*8+407 DOWNTO I*8+400) +imagem((I+1)*8+7 DOWNTO(I+1)*8)- imagemanterior((I+1)*8+7 DOWNTO(I+1)*8) + imagem((I+1)*8+407 DOWNTO (I+1)*8+400)- imagemanterior((I+1)*8+407 DOWNTO (I+1)*8+400)); end loop; end if ; end process; end Behavioral; - Altera_Forum
Honored Contributor
wow - those are possibly the largest busses I have ever seen
Why have you got busses so wide? Plus there are many problems. 1/4 = 0 when it is rounded down. Why do you have such a massive for loop? - Altera_Forum
Honored Contributor
--- Quote Start --- wow - those are possibly the largest busses I have ever seen Why have you got busses so wide? Plus there are many problems. 1/4 = 0 when it is rounded down. Why do you have such a massive for loop? --- Quote End --- My idea was to implement the same architecture for pixels (0,0) to (48,48) arriving at the same time in a 50x50 image. Replacing the 1/4 by a division would solve the issue? Thanks. - Altera_Forum
Honored Contributor
Almost definately not.
How do you expect a 50x50 image to arrive at the same time? why did you make some massive array of unsigned? why not just a 2d array of unsigned:
But if you expect a 50x50 image to just magically appear, I suspect there is something more fundamentally wrong with your design than a '-' function not working. The error you had will be because you sliced something wrong somewhere (and because it is rather hideous to look at I cant be bothered to find it right now)type image_array_t is array(0 to 49, 0 to 49) of unsigned(7 downto 0); signal my_image : image_array_t; for x in my_image'range(1) loop for y in my_image'range(2) loop my_image(x,y) <= something; end loop end loop; - Altera_Forum
Honored Contributor
i've got the error for the operator ""-"" in the following code. I'm not sure about accessing the indivdual bits of each unsigned in the array.
library IEEE; use IEEE.STD_LOGIC_1164.ALL; use Ieee.numeric_std.all; use work.genetica_type.all; entity binario_fitness is Port ( clk : in std_logic; individuos: in genetica; adaptacao: out fitness; somafitness: out unsigned (7 downto 0) ); end binario_fitness; architecture Behavioral of binario_fitness is begin process (clk) begin If (clk 'event and clk = '1') then for x in 0 to 49 loop adaptacao(x) <= individuos(x)(0)-individuos(x)(1) +individuos(x)(2)- individuos(x)(3)+individuos(x)(4)- individuos(x)(5)+individuos(x)(6)-individuos(x)(7); somafitness<=(others=>'0'); end loop; end if ; end process; end Behavioral; which includes the genetica_type in another file: library IEEE; use IEEE.STD_LOGIC_1164.ALL; use IEEE.STD_LOGIC_TEXTIO.ALL; use ieee.numeric_std.all; package genetica_type is type genetica is array(0 to 49) of unsigned(7 downto 0); type fitness is array(0 to 49) of unsigned (2 downto 0); end package genetica_type; - Altera_Forum
Honored Contributor
Why are you trying to access individual bits of a number? You cannot sum them as they are just std_logic so no arithmetic is defined for them.
I think you need to make a function to count the bits for you.