我们的许多模块使用一组配置描述符记录来配置Configurable组件。数组类型、记录类型和可配置组件在每个人都使用的全局包中声明。
type config_descriptor_type is record
config0 : integer;
config1 : boolean;
end record;
type config_type is array(natural range <>) of config_descriptor_type;
component Configurable is
generic (
g_CONFIG : config_type
);
end component;
使用它的每个模块Configurable都有一个包含该模块配置信息的包(所有现有的此类配置必须保持不变)。
constant c_config : config_type(0 to 3) := (
(1, true),
(2, false),
(8, false),
(4, true)
);
这个每个模块的常量被传递给 Configurable 实例(实例化也必须保持不变)。
config_inst : Configurable
generic map (
g_CONFIG => c_config
);
我正在添加一些需要在记录Configurable中添加额外字段的功能。config_descriptor_type
type new_config_descriptor_type is record
config0 : integer;
config1 : boolean;
config2 : integer; -- this field was added
end record;
我可以自由地对全局可配置包和实体以及使用新功能的任何新模块进行任何我喜欢的更改,但我不应该触及任何使用可配置的现有模块。如果由旧模块实例化,新字段应该获得一些默认值。
有没有办法添加这样一个字段,而不必修改所有使用可配置的现有模块?