How to initialize a bit vector in VHDL

Viewed 24934

I want to have a bit vector, I want it to have a value 2. I tried many things but I always get an error. Now I have this :

variable var : bit_vector := B"00000000000000000000000000000100";

I get these errors :

can't match integer literal with type array type "bit_vector"

and

declaration of variable "var" with unconstrained array type "bit_vector" is not allowed

How can I fix this? Thanks.

3 Answers
Related