VHDL中奇怪的XNOR行为

Pat*_*ick 6 fpga vhdl xilinx

导致问题的代码看起来像普通的xnor操作,如下所示:

S(1) <= L(16) xnor L(26);
Run Code Online (Sandbox Code Playgroud)

此行导致以下错误:

ncvhdl_p: *E,EXPSMI (HDL/aes_sbox_enc_depth16.vhd,169|14): expecting a semicolon (';') [9.5.1].
ncvhdl_p: *F,MAXERR: maximum error count reached (1).
TOOL: ncvhdl 10.20-s075: Exiting on Feb 14, 2012 at 12:56:05 GMT (total: 00:00:01)
Run Code Online (Sandbox Code Playgroud)

任何人都知道这里出了什么问题,分号显然在那里.是否有可能VHDL不支持xnor,如果是这样,我该如何重写它?

非常感谢!

Pau*_*l S 6

我认为这xnor是针对位和布尔值而定义的,而不是std_logic.我认为这实际上取决于您使用的VHDL版本(例如98/2002/2008).它肯定是从std_logic_1164.vhd我见过的文件的某些版本中评论出来的.

如何反转xor

S(1) <= not (L(16) xor L(26));
Run Code Online (Sandbox Code Playgroud)


Bil*_*nch 6

详细阐述保罗的答案.

  • IEEE-1076 1987年:不支持xnor运算符.
  • IEEE-1076 2002年:支持xnor运算符.

这可以通过查看语言规范的第7.1节来验证.

1987年:

expression ::=
      relation { and  relation }
    | relation { or   relation }
    | relation { xor  relation }
    | relation [ nand relation ]
    | relation [ nor  relation ]
Run Code Online (Sandbox Code Playgroud)

2002年:

expression ::=
        relation { and  relation }
      | relation { or   relation }
      | relation { xor  relation }
      | relation [ nand relation ]
      | relation [ nor  relation ]
      | relation { xnor relation }
Run Code Online (Sandbox Code Playgroud)

如果您的工具支持2002(或2008),那么它还需要在std_logic_1164中定义运算符,但这是相对可能的.

最有可能的是,您的工具仅支持IEEE-1076-1987.然后你想写一个xnor:

not(L(16) xor L(26));
Run Code Online (Sandbox Code Playgroud)