VHDL error power of 2 in quartus

Status
Not open for further replies.

Adnan86

Full Member level 2
Joined
Apr 4, 2013
Messages
121
Helped
26
Reputation
52
Reaction score
26
Trophy points
1,308
Activity points
2,153
I want use power in my code in VHDL :
for example A * (10**b) that b > 2 but I have this error in Quartu 6.1
Error (10638): VHDL exponentiation error at project_2.vhd(20): operator not supported for the specified operands, base must be a positive power of 2 with non-constant exponent.
any one here for help that what can i do ?
Thanks
 

Yes. You cant synthesise the ** operator where the base is not a power of 2. I suggest redesigning the algorithm with some form of multiplier chain, or changing the 10**factor for some 2**c factor.
2**c is just a bitshift operation, and very simple.

What is the range of b? how many values can it take? if it isnt very many (say, < 32), you can do this simply with a mux, otherwise I recommend using a look-up table.
 
b < 32 .
but how ? just 2**c ....
 

2**c will work, because the answer will always be a 1 with a load of '0's around it - very cheap to implement. any other wont work because the answer cannot easily be determined.
 
Thanks it's useful
 

Status
Not open for further replies.
Cookies are required to use this site. You must accept them to continue using the site. Learn more…