title: How to initialize a bit vector in VHDL
body: <p>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 : </p>
  
  <pre><code>variable var : bit_vector := B"00000000000000000000000000000100";
  </code></pre>
  
  <p>I get these errors : </p>
  
  <blockquote>
    <p>can't match integer literal with type array type "bit_vector"</p>
  </blockquote>
  
  <p>and</p>
  
  <blockquote>
    <p>declaration of variable "var" with unconstrained array type
    "bit_vector" is not allowed</p>
  </blockquote>
  
  <p>How can I fix this? Thanks.</p>