-1
library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
use IEEE.STD_LOGIC_ARITH.ALL;
use IEEE.STD_LOGIC_UNSIGNED.ALL;

entity conv_enc is
    Port ( clk : in  STD_LOGIC;
           rst : in  STD_LOGIC;
           inp : in  STD_LOGIC;
           outp : out  STD_LOGIC_VECTOR(3 DOWN TO 0));
end conv_enc;

architecture Behavioral of conv_enc is
begin
 process
 variable ff:std_logic_vector(3 down to 0);
  begin
   wait until rising_edge (clk)
     if rst='1' then
      ff<="0000";
     else
      for i in 2 down to 0 loop
       ff(i)<=ff(i+1);
        end loop;
        ff(3)<=inp;
    end if;
 end process;
 outp(0) <= inp xor ff(1) xor ff(0) ;
 outp(1) <= inp xor ff(3) xor ff(2) xor ff(1) ;
 outp(2) <= inp xor ff(3) xor ff(2) xor ff(1) xor ff(0);
 end Behavioral;

错误说:HDLParsers:3481 - 图书馆工作没有单位。没有为它保存参考文件“xst/work/hdlib.ref”。请帮忙

4

2 回答 2

3

虽然 Maria 和 Scary_jeff 给出了部分解决方案,但有几个错误:

您声明了一个范围down to,而不是downto在三个地方。

您错过了一个分号来终止进程中的等待语句。

您尝试在进程之外(在其范围之外)读取变量。

以下是纠正这些问题的代码,特别是使 ff 成为信号:

library ieee;
use ieee.std_logic_1164.all;
-- use IEEE.STD_LOGIC_ARITH.ALL;
-- use IEEE.STD_LOGIC_UNSIGNED.ALL;

entity conv_enc is
    port (
        clk:   in  std_logic;
        rst:   in  std_logic;
        inp:   in  std_logic;
        outp:  out std_logic_vector(3 downto 0) -- WAS DOWN TO
    );
end entity conv_enc;

architecture behavioral of conv_enc is
     signal ff:   std_logic_vector(3 downto 0); -- variable used outside process
begin
    process
        -- variable ff:   std_logic_vector(3 downto 0);  --  was down to
    begin
        wait until rising_edge (clk);  -- was miaaing terminating semicolon
        if rst = '1' then
            ff <= "0000";
        else
            for i in 2 downto 0 loop   -- was down to
                ff(i) <= ff(i + 1);
            end loop;
            ff(3) <= inp;
        end if;
    end process;

    outp(0) <= inp xor ff(1) xor ff(0);
    outp(1) <= inp xor ff(3) xor ff(2) xor ff(1);
    outp(2) <= inp xor ff(3) xor ff(2) xor ff(1) xor ff(0);

 end architecture behavioral;

请注意,未使用的 Synopsys 软件包已被注释掉。

然后您的代码进行分析。

请注意,没有分配给 outp(3)。

您的卷积编码器看起来不太正确,但这可能就是我。

如果没有提供刺激和预期结果的测试平台,则无法验证功能。

于 2016-04-18T20:50:10.293 回答
0

ff(3)<=inp;必须在之后else

于 2016-04-18T12:06:42.210 回答