I have a generic VHDL entity and I have this code:
--- in testbench
const bits : integer := 13; -- number of bits
const pow: integer := 8192; -- 2^bits
const squared : integer := 67108864; -- pow^2
In where I pass those 3 constants to the entity. What I would really like is something like:
--- in testbench
const bits: integer := 13;
--- in architecture (generic bits:integer)
const pow : integer := 2^bits;
const squared : integer := pow^2;
Since bits
is known at synthesis time is there any way to do it without using hardware?
Best Answer
The VHDL power operator is
**
.So your code should look like this: