移植映射到多个实体的最佳方法

问题描述 投票:0回答:1

如果某个实体需要在另一个 "顶层 "实体中多次引用,最好的方法是什么?

例如,给定某个实体 My_Entity (这里是简化描述)。

entity My_Entity is
    port (
        etc ...
    );
end My_Entity;

...我如何描述一个使用了... 10 My_Entity's?

entity Top_Entity is
    port (
        etc ...
    );
end Top_Entity;

architecture rtl of Top_Entity is
begin
    entity1 : entity work.My_Entity(rtl) port map (
        etc ...
    );

    entity2 : entity work.My_Entity(rtl) port map (
        etc ...
    );

    -- repeat 10 times? or is there a better way?
end rtl;
vhdl
1个回答
0
投票

是的,使用一个 "顶层 "实体。使用一个 产生循环:

entity Top_Entity is
    port (
        etc ...
    );
end Top_Entity;

architecture rtl of Top_Entity is
begin

    G: for I in 1 to 10 generate   -- the label "G" is compulsory here
        -- I varies between 1 and 10 here
        -- you can use it to distinguish between instances
        -- eg to connect each to a different element of an array
        entity1 : entity work.My_Entity(rtl) port map (
             etc ...
        );
    end generate;

end rtl;
© www.soinside.com 2019 - 2024. All rights reserved.