How to compute 2^N in VHDL?

F

Fabio G.

In my design I have a parametrizable counter.
Then I use a package to define the number of bits of the counter:

constant Nbit_cont : integer :=8;

I also need to define the value of the max countable value+1:

For example, if Nbit_cont is 8, then I define:

constant Count_max : integer :=256;

But I'd want to make this last assignment dependent from the constant
Nbit_cont, with an expression like this:

constant Count_max : integer :=2^Nbit_cont;

....but the " ^ " operator is not recognized by my VHDL compiler.
Is there a solution to this problem?


--
Per rispondermi via email sostituisci il risultato
dell'operazione (in lettere) dall'indirizzo
-*-
To reply via email write the correct sum (in letters)
in the email address
 
C

Christoph M. Wintersteiger

In VHDL there is no ^ operator; It's **, so 2**Nbit_cont should do the
trick.

Greetings,
CM Wintersteiger
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,743
Messages
2,569,478
Members
44,899
Latest member
RodneyMcAu

Latest Threads

Top