I commented out the assignments not involved in your error.
You could have provided an indication of where (pointed to which line) the error was associated with.
You basically had a -
operator instead of a downto
in specifying the range of right hand operand of the -
operator the error was complaining about. Where is marked with a comment:
-- downto was "-"
You could have provided a Minimal, Complete, and Verifiable example, which in this case would have implied throwing things out not associated with the error.
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 entity 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) downto i * 8) + -- downto was "-"
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 architecture behavioral;
After the change of the -
operator to the reserved word downto
your code analyzes (and I make no claim that it will run, that requires a test bench to drive clk
).
Adding a rudimentary testbench to drive clk
Shows that your first assignment:
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));
produces a range error (the range of the expression on the right hand side doesn't match the range of the slice on the left hand side).
The same occurs for the second assignment:
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));
As well as the last (having the -
operator instead of downto, corrected).
These are all run time errors.