无法确定运营商的定义“” - “”

时间:2015-07-07 19:59:45

标签: vhdl operator-keyword definition

操作员“ - ”出现此错误。使用signed type和ieee.numeric_std。我想问一下我对“for”的用法是否正确。

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;

1 个答案:

答案 0 :(得分:0)

我注释掉了与您的错误无关的作业。

您可以提供与错误相关联的位置(指向哪一行)的指示。

在指定错误所抱怨的-运算符的右手操作数范围时,您基本上有一个downto运算符而不是-。哪里标有评论:

 -- downto was "-"

你本可以提供一个Minimal, Complete, and Verifiable example,在这种情况下,这意味着抛出与错误无关的东西。

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;

-运算符更改为保留字downto之后,您的代码会进行分析(我并未声明它会运行,这需要一个测试平台来驱动clk

添加一个基本的测试平台来驱动clk

显示您的第一个作业:

            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));

除了最后一个(使用-运算符而不是downto,已更正)。

这些都是运行时错误。