associativity of ** operator

From: Marq Kole <marq.kole_at_.....>
Date: Mon Oct 26 2009 - 07:56:23 PDT
Dear all,

In LRM 2.3.1 I believe there is a mistake in operator associativity. According to section 4.2.2 all operators associate left to right except the contional operator. This is the wrong choice in the case of the exponentiation operator '**' because this operator should also associate right to left. With left-to-right associativity this operator becomes equivalent to the multiplication operator except for the leftmost operand.

Here is a small example to show the difference:

2**3**2 = ?

left-to-right associativity:

2**3**2 = (2**3)**2 = 8**2 = 64 = 2**(3*2)

right-to-left associativity:

2**3**2 = 2**(3**2) = 2**9 = 512

This should probably be changed in IEEE 1364 (Verilog) and IEEE 1800 (SystemVerilog) as well.

Cheers,
Marq



-- 
This message has been scanned for viruses and
dangerous content by MailScanner, and is
believed to be clean.
Received on Mon Oct 26 07:59:46 2009

This archive was generated by hypermail 2.1.8 : Mon Oct 26 2009 - 08:00:12 PDT