Ishu Gupta
Ishu Gupta

Reputation: 55

How does verilog behave with negative exponents?

How does verilog behave with negative exponents? For example: expression (2**(M-N)) has a negative exponent when both M and N are constant and N is larger than M. What will be issues if I write such code in my RTL code.

Upvotes: 0

Views: 608

Answers (1)

dave_59
dave_59

Reputation: 42616

The expresson 2x gets implemented as an arithmetic shift operation. A negative value of x represents a shift left by x.

Upvotes: 1

Related Questions