[sv-bc] [Fwd: associativity of ** operator]

From: Surya Pratik Saha <spsaha_at_.....>
Date: Mon Oct 26 2009 - 21:38:11 PDT


-------- Original Message --------
Subject: associativity of ** operator
Date: Mon, 26 Oct 2009 15:56:23 +0100
From: Marq Kole <marq.kole@nxp.com>
To: verilog-ams@server.eda.org <verilog-ams@eda.org>


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.






-- 
Regards
Surya

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

This archive was generated by hypermail 2.1.8 : Mon Oct 26 2009 - 21:40:12 PDT