title: how to compare an integer and an std_logic vector
body: <p>I have an array of signals. I want to write to the appropriate cell in the array when a signal which is the "selector" is equal to the cells number. To save on writing and code lines I generate the assignment in a generate loop:</p>
  
  <pre><code>read_data_signals_gen: for i in 0 to (CAU_num -1) generate
  
      v_direction_sig(i)(0) &lt;=  DATA_IN when (chosen_flow_sig = i) and (read_state = st_read_v_direction_0) else
                                v_direction_sig(i)(0);
      v_direction_sig(i)(1) &lt;=  DATA_IN when (chosen_flow_sig = i) and (read_state = st_read_v_direction_1) else
                                v_direction_sig(i)(1);
      v_direction_sig(i)(2) &lt;=  DATA_IN when (chosen_flow_sig = i) and (read_state = st_read_v_direction_2) else
                                v_direction_sig(i)
    ...
  end generation read_data_signals_gen;
  </code></pre>
  
  <p>chosen_flow_sig is an <code>std_logic_vector (1 downto 0)</code> and gets <code>"00"</code>, <code>"01"</code>, <code>"10"</code> or <code>"11"</code> to denote the number of the cell, And <code>CAU_num</code> is an <code>integer</code> constant equal to 4. How do I create the comparison inside the <code>when</code> statement so that an integer number will be equal to its binary translation?</p>
  
  <p>And a related question. Is there a way to perform the following code:</p>
  
  <pre><code>type  BitArray is array (natural range &lt;&gt;) of std_logic;
  
  sel_sig : std_logic_vector(0 to 1);
  bit_arr : BitArray(0 to 3)
  
  sel_sig &lt;= "00"
  bit_arr(sel_sig) &lt;= '1'  -- HOW TO PERFORM THIS? 
  </code></pre>