1

Can the power operator ** be used with arbitrarily large operands?

Ex:  
 reg [100:0] c;  
   reg [15:0] a;  
   reg [15:0] b;  
   c = a**b;  

Does there is some maximum limit on operand size?

quartz
  • 747
  • 9
  • 26
  • 1
    Power operator '**' is supported only for the results that do not exceed the size of 'real' data type. The size of the real operator is 8 byte, this is the most common limit followed by eda vendors – Emman Jul 06 '15 at 15:08

1 Answers1

2

IEEE 1800-2012 doesn't mention any maximum size of operands.

But... different IDE might have some limitations in ** operator usage, e.g. it works only in case like 2**n or length of the operands is limited. However, there should be no limitations in simulations (e.g. Riviera-PRO allowed to simulate a**b operation, with a and b length equal to 150, without any warning).

When using power operator for synthesis, it's sythesizable as long as a=2. In that case the power operator simply "change" to shifter.

Qiu
  • 5,651
  • 10
  • 49
  • 56
  • 1
    I don't think `**` is synthesizable anyway. – Eugene Sh. Jul 06 '15 at 15:35
  • @Qiu, thanks. For pure testbench simulation, do you think there should be some limitation on ** operator? – quartz Jul 06 '15 at 16:12
  • 1
    @quartz: I don't know about all IDE, but I was able to simulate `a**b` in Riviera-PRO, with `a` and `b` length equal 151. – Qiu Jul 06 '15 at 17:09
  • @EugeneSh. According to Sec. 7.3.1.5 of IEEE Std. 1364.1-2002(E) the `**` operator is synthesizable as long as both operands are constant or the first operand is 2. – CliffordVienna Jul 11 '15 at 14:50