Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Weird XNOR behaviour in VHDL

Tags:

vhdl

fpga

xilinx

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!

like image 968
Patrick Avatar asked Feb 14 '12 13:02

Patrick


2 Answers

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));
like image 199
Paul S Avatar answered Oct 06 '22 00:10

Paul S


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));
like image 38
Bill Lynch Avatar answered Oct 06 '22 00:10

Bill Lynch