Recursive component / VHDL object

Hope this is possible. I want to be able to write recursive code as follows:

entity myEntity generic ( size : natural -- a power of 2 ) port ( -- whatever ); end; architecture structural of myEntity is begin smallerEntity : entity component.myEntity(structural) generic map ( size => size/2 ); port map ( ... ); end; 

Thus, each architecture creates a smaller version. For some value of the overall "size" I want to have a different implementation.

Can this be done with configurations? If so, how?

Why would I like to be able to do this, so I can create reusable code to calculate FFT / DCT and similar transformations.

+6
source share
2 answers

You can use recursion in VHDL. But you have to encapsulate your implementation in an if-generate . Sort of:

 recursive_structure : if size/2 > 0 generate smallerEntity : entity <library_name>.myEntity(structural) generic map ( size => size/2 ) port map ( ... ); end generate recursive_structure; 
+6
source

I use a function like:

-- convert natural to min vector length

function min_len_uns (arg: natural) return natural is

begin case arg is

  when 1 | 0 => return 1; when others => return 1 + min_len_uns(arg/2); end case; 

end;

code>

0
source

All Articles