I hope this is possible. I want to be able to write recursive code like this:
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;
So each architecture instantiates a smaller version of itself. At some value of the generic 'size' I want to have a different implementation however.
Can this be done with configurations? If so, how?
As to why I'd like to be able to do this - so I can build reusable code for computing FFTs/DCTs and similar transforms.
You can use recursion in VHDL. But you need to encapsulate your instantiation in an if-generate
statement. Something like:
recursive_structure : if size/2 > 0 generate
smallerEntity : entity <library_name>.myEntity(structural)
generic map (
size => size/2
)
port map (
...
);
end generate recursive_structure;
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With