Weird XNOR behaviour in VHDL

六眼飞鱼酱① 提交于 2020-01-03 11:01:32

问题


The code that is causing problems looks like a normal xnor operation as you can see below:

S(1) <= L(16) xnor L(26);

This line causes the following error:

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)

Anyone an idea what is going wrong here, the semicolon is clearly there. Is it possible that VHDL does not support xnor, if so, how do I have to rewrite it?

Many thanks!


回答1:


I believe that xnor is defined for bits and booleans, but not std_logic. I think it actually depends on which version of VHDL (e.g. 98 / 2002 / 2008) you're using. It's certainly commented out of some versions of the std_logic_1164.vhd files I've seen.

How about just inverting an xor?

S(1) <= not (L(16) xor L(26));



回答2:


To elaborate on Paul's Answer.

  • IEEE-1076 Year 1987: Does not support an xnor operator.
  • IEEE-1076 Year 2002: Supports an xnor operator.

This can be verified by looking at Section 7.1 of the Language Spec.

For Year 1987:

expression ::=
      relation { and  relation }
    | relation { or   relation }
    | relation { xor  relation }
    | relation [ nand relation ]
    | relation [ nor  relation ]

For Year 2002:

expression ::=
        relation { and  relation }
      | relation { or   relation }
      | relation { xor  relation }
      | relation [ nand relation ]
      | relation [ nor  relation ]
      | relation { xnor relation }

If your tool supports 2002 (or 2008), then it would also need to define the operator in std_logic_1164, but that would be relatively likely.

What is most likely, is that your tool is only supporting IEEE-1076-1987. You would then want to write an xnor as:

not(L(16) xor L(26));


来源:https://stackoverflow.com/questions/9277353/weird-xnor-behaviour-in-vhdl

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!