我正在尝试在VHDL中为比较器进行数据流设计。它在Xilinx中编译和模拟很好,但我必须使用Cadence / NCLaunch。当我将相同的代码复制到gedit并运行它时,它会给出一个关于分号的错误。
我的代码是:
library ieee;
use ieee.std_logic_1164.all;
-----------------------------------------------------
entity Comparator is
port( A: in std_logic_vector (3 downto 0);
B: in std_logic_vector (3 downto 0);
AeqB: out std_logic;
AltB: out std_logic;
AgtB: out std_logic);
end Comparator;
architecture dataflow of Comparator is
signal AeB : std_logic;
signal AlB : std_logic;
signal AgB : std_logic;
signal i : std_logic_vector (3 downto 0);
signal j : std_logic_vector (3 downto 0);
begin
B1: BLOCK BEGIN
AeB <= i(3) AND i(2) AND i(1) and i(0);
AgB <= j(3) or j(2) or j(1) or j(0);
AlB <= AeB nor AgB;
END BLOCK B1;
B2: BLOCK BEGIN
i <= a xnor b;
END BLOCK B2;
B3: BLOCK BEGIN
j(3) <= (not b(3)) and a(3);
j(2) <= i(3) and not b(2) and a(2);
j(1) <= i(3) and i(2) and not b(1) and a(1);
j(0) <= i(3) and i(2) and i(1) and not b(0) and a(0);
END BLOCK B3;
B4: BLOCK BEGIN
AeqB <= AeB;
AltB <= AlB;
AgTB <= AgB;
END BLOCK B4;
end dataflow;
...我得到的错误是:
i <= a xnor b;
|
ncvhdl_p: *E,EXPSMI (/ugrad/syedhuq/ECE425/Lab2/Comparator.vhd,29|11): expecting a semicolon (';') [9.5.1].
据我所知,我有一个分号......如果我用四个单独的语句替换语句,如
i(n) <= a(n) xnor b(n); //[n = 1, 2, 3, 4],
我得到了相同的错误4次。任何人都可以帮我解决这个问题吗?
此外,它在Synopsys(VCSMX)中编译得很好,testbench文件也是如此,但在链接过程中它告诉我:
Design unit 'COMPARATOR(BEHAVE)' from library '.' cannot be opened for
reading.
Possible causes:
[1] Incorrect logical to physical mapping in synopsys_sim.setup file.
[2] Intermediate file generation was prematurely terminated during analysis.
Reanalyze the design unit and resolve any errors that occur during analysis.
testbench代码中的相关行是:
for x1: Comparator use entity work.Comparator(Behave);
答案 0 :(得分:4)
我不熟悉Cadence / NCLaunch,但知道您的代码在符合IEEE 1076-1993标准的工具中正确分析,并注意错误在哪里(您在第29行指出了字符位置11,注意它似乎是字符位置17),我会说它在包std_logic_1164(规范和正文)中没有“xnor”未注释,或者它是符合VHDL87的工具,或者有一些缺少的工具集或命令行参数使用正确的std_logic_1164包。
在std_logic_1164的分布式源中,可从 http://standards.ieee.org/downloads/1076/1076.2-1996/
-- --------------------------------------------------------------------
-- version | mod. date:|
-- v4.200 | 01/02/92 |
-- --------------------------------------------------------------------
默认情况下,你会发现xnor被注释掉了,当VHDL92(-1993,不要求)被批准后,它应该是未注释的。
-- -----------------------------------------------------------------------
-- Note : The declaration and implementation of the "xnor" function is
-- specifically commented until at which time the VHDL language has been
-- officially adopted as containing such a function. At such a point,
-- the following comments may be removed along with this notice without
-- further "official" ballotting of this std_logic_1164 package. It is
-- the intent of this effort to provide such a function once it becomes
-- available in the VHDL standard.
-- -----------------------------------------------------------------------
-- function "xnor" ( l, r : std_logic_vector ) return std_logic_vector;
-- function "xnor" ( l, r : std_ulogic_vector ) return std_ulogic_vector;
9.5.1是指IEEE = 1076-1993中的条件信号分配。
分析器表现得像是不能识别xnor作为运算符,如果你看一下-1993 7.2.1逻辑运算符:
逻辑运算符和,或者,nand,nor,xor,xnor,而不是 为预定义类型BIT和BOOLEAN定义。它们也是定义的 对于元素类型为BIT或的任何一维数组类型 BOOLEAN。
这告诉我们在符合IEEE 1076-1993标准的工具中,xnor的声明来自std_logic_1164包。
我快速浏览了一些NCSIM等在线用户指南和教程,并没有看到任何与此问题有关的内容。很可能std_logic_1164包在声明和正文中都没有xnor未注释。
问题可能是您使用的上帝(年龄)或特定工具副本,可能需要sysadmin帮助才能纠正。与此同时,您可以编写自己的xnor函数(如图所示),如果遇到任何困难,请尝试使用not(a xor b)代替。
architecture dataflow of Comparator is
function "xnor" ( l : std_logic; r : std_logic ) return ux01 is
begin
return not (l xor r);
end "xnor";
signal AeB : std_logic;
signal AlB : std_logic;
signal AgB : std_logic;
signal i : std_logic_vector (3 downto 0);
signal j : std_logic_vector (3 downto 0);
begin