title: Get range attribute of array subtype in vhdl
body: <p>Given an array type: </p>
  
  <pre><code>type enc is array (integer 0 to 1) of std_logic_vector(3 downto 0);
  </code></pre>
  
  <p>Is it possible to access attributes of the array subtype (The std_logic_vector)?</p>
  
  <p>I would have thought that something like this was possible:
  <code>enc(0)'range</code> -> 3 downto 0 (Taking the range of element number 0)
  This is an error in my simulator.</p>
  
  <p>Looking at the LRM(14.1) there is a range attribute for array elements:</p>
  
  <pre><code>A'RANGE [(N)]
  </code></pre>
  
  <p>This attribute seems to be only able to return the range of the array's dimensions, i.e the "0 to 10", and not the subtype.</p>
  
  <p>One solution could be to make a constant of that type:</p>
  
  <pre><code>constant tmp : enc :=(
  0 =&gt; "0000",
  1 =&gt; "0001"
  )
  </code></pre>
  
  <p>And take the range of that constant:</p>
  
  <pre><code>tmp(0)'range
  </code></pre>
  
  <p>This works, however i feel it should be possible using the type alone, since it is fully constrained.</p>