Search code examples
verilogsystem-verilog

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


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

For example:

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

Is there is some maximum limit on operand size?


Solution

  • 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.