我想知道我是否可以使用单个体系结构的多个实体(不同的端口)(使用基于通用的生成语句访问不同的端口)all in 1 file但是具有将体系结构映射到正确的实体在编译时。
我的问题是我有代码,其中3/4的代码是相同的,部分代码是不同的,因为代码使用的fpga具有不同的引脚映射,我不想维护每当我更改代码时多个文件。希望这是有道理的
伪代码:
entity e_1 is
generic(
entityType : string := '1'
);
port1 : in std_logic
);
entity e_2 is
generic(
entityType : string := '2'
);
port2 : in std_logic
);
architecture a of e_1 is
begin
L_1 : if entityType = "1" generate
port1 <= '1';
end generate L_1;
L_2 : if entityType = "2" generate
port2 <= '1';
end generate L_2;
end architecture a;
阿米什