无法解决错误,VHDL,语法错误,但我没有看到它

时间:2014-12-13 13:17:16

标签: compiler-errors vhdl

我无法解决此乘数中的错误。我是VHDL的新手,所以这可能是一个非常愚蠢的问题(我试图解决问题,但它似乎并没有成功)它说:Error: C:/modeltech_6.5/examples/pipe.vhd(41): near "label": syntax error

我正在尝试为我的项目制作管道倍增器

entity  mult_secv  is 
  generic(
    Na    : integer := 8;
    Nb    : integer := 8;
    Nscnt : integer := 4
   );
  port(
    iCLK  : in std_logic;
    iRST    : in std_logic;
    iDV   : in std_logic;

    ia      : in std_logic_vector(Na-1 downto 0);
    ib      : in std_logic_vector(Nb-1 downto 0);

    oDV     : out std_logic;
    oDATA   : out std_logic_vector(Na+Nb-2 downto 0)
    );
end  mult_secv;

architecture produs of mult_secv is
  type my_array1 is array(1 to 8)of std_logic_vector(Na+Nb-2 downto 0);
  type my_array2 is array(1 to 8) of std_logic_vector(Nb-1 downto 0);
  type my_array3 is  array(1 to 8) of std_logic;
--8 stagii pentru a se calcula tot produsul
  signal sa, srez : my_array1;   
  signal sb : my_array2;
  signal dv : my_array3;
  constant scntmax : integer:=8 ;

begin
  -- for each pipeline stage
label : for scnt in 1 to scntmax generate ---> CAUTA SINTAXA PENTRU GENERARE DE COMPONENTE IDENTICE

process(iCLK,iRST)
begin
  if iRST= '1' then
    sa <= (others => (others => '0'));
  elsif rising_edge(iCLK) then
    -- first stage
    if (scnt = 1) then
      sa(scnt) <= (Na+Nb-2 downto Na => ia(Na-1))  & ia; ---se bordeaza cu bitul de semn daca e negativ
    -- other stages
    else
      sa(scnt) <= sa(scnt-1)(Na+Nb-3 downto 0) & '0';  --altfel se shifteaza sa
    end if;
  end if;
end process;


process(iCLK,iRST)
begin
  if iRST='1' then
    sb <= (others => (others => '0'));   
  elsif rising_edge(iCLK) then
    if (scnt = 1) then
      sb(scnt) <= ib;
    else
      sb(scnt) <= '0' & sb(scnt-1)(Nb-1 downto 1); --se shifteaza sb
    end if;
  end if;
end process;

process(iCLK,iRST)
begin
  if iRST='1' then
    srez <= (others => (others => '0'));  
  elsif rising_edge(iCLK) then
    if (scnt = 1) then
      if ib(Nb-1)='1' then
   srez(scnt) <= not (ia & (Nb-2 downto 0 => '0')) + '1'; --daca este negativ
      else
        srez(scnt) <= (others => '0'); --in primul stadiu
      end if;
    elsif sb(scnt-1)(0)='1' then        
      srez(scnt) <= srez(scnt-1)+sa(scnt-1);
    else    
      srez(scnt) <= srez(scnt-1);
    end if;
  end if;
end process;    

process(iCLK,iRST)
begin
  if iRST='1' then
    dv <= (others => '0');
  elsif rising_edge(iCLK) then
    if (scnt = 1) then
      dv(scnt) <= iDV;
    else
      dv(scnt) <= dv(scnt-1);
    end if;
  end if;
end process;

end generate label;

oDATA <= srez(scntmax);
oDv <= dv(scntmax);

end;

有人可以帮忙吗?

2 个答案:

答案 0 :(得分:1)

ghdl报道:

ghdl -a mult_secv.vhd
mult_secv.vhd:31:1: unexpected token 'label' in a concurrent statement list
mult_secv.vhd:37:3: unexpected token 'elsif' in a concurrent statement list
mult_secv.vhd:42:5: unexpected token 'else' in a concurrent statement list
mult_secv.vhd:44:9: ';' is expected instead of 'if'
ghdl: compilation error

这使得问题更加清晰。

我经常发现使用多个编译器编译源代码很有用;每个人都有自己的优点和缺点。

答案 1 :(得分:0)

label是VHDL中的保留关键字。正如您在上面突出显示的代码中所看到的那样,它是蓝色的:)