0

Here is a VHDL code to find length of return type of function :

LIBRARY IEEE;
USE IEEE.std_logic_1164.ALL;
USE IEEE.std_logic_arith.ALL;
entity test is
  port( 
     x : in bit_vector(3 downto 1);
     l : out integer);
end test;

LIBRARY IEEE;
USE IEEE.std_logic_1164.ALL;
USE IEEE.std_logic_arith.ALL;

architecture a of test is
  type array2 is array (natural range <>) of bit_vector(3 downto 1);
  type array3 is array (natural range <>) of array2 (2 downto 1);
  function G ( x : array2) return array3 is
  begin
     return  array3'(x &  "001" & "110" & x);
  end G;
  constant v : array2 := (1=>"001", 0=>"111") ;
begin

  l <= G(v)'length;
end a;

but with DC, value of

l
is 2 not 3. why?