将所有未使用的端口切片映射在一起



因此,

我的一个实体上有一个32位端口。这实际上是由许多较小的信号组成的,所有这些信号都映射到一个寄存器中。在一个例子中,当我实例化它时,我只对32个信号中的3个感兴趣。因此,我使用切片关联(到a、b和c)来相应地映射这些。然后我想将其他29位分配为零。有没有比写几个语句来覆盖所有剩余部分更快的方法?

label: module1
port map(
     reg_in(4) => a,
     reg_in(7) => b,
     reg_in(25)=> c,
     reg_in(3 downto 0) => (others => '0'),
     reg_in(6 downto 5) => (others => '0'),
     reg_in(24 downto 8) => (others => '0'),
     reg_in(31 downto 26) => (others => '0')
);

我会添加一个内部信号,并将其连接到端口映射中。。

signal reg_assembly : std_logic_vector(31 downto 0);
...
reg_assembly <= (4 => a, 7 => b, 25 => c, others => '0');
label: module1
port map(
     reg_in => reg_assembly
);

最新更新