从未使用过的数组输入
array input never used
我正在尝试创建一个寄存器数组,并希望消除警告。我在下面创建了一个最小的示例设计。为什么 addr
的一部分未被使用?
当我合成时收到警告:
WARNING:Xst:647 - Input <addr<3:2>> is never used. This port will be preserved and left unconnected if it belongs to a top-level block or it belongs to a sub-block and the hierarchy of this sub-block is preserved.
module test(addr,in,out,wr,clk);
input [3:0] addr;
input [7:0] in;
output reg [7:0] out;
input wr;
input clk;
reg [7:0] ra [0:3];
always @(posedge clk)
begin
if (wr)
ra[addr] = in;
else
out <= ra[addr];
end
endmodule
我正在尝试创建一个具有 16 个地址 (0-15) 的 8 位宽的寄存器。
给出的警告的以下部分很重要。
Input "addr3:2" is never used.
这里,addr
是四位,ra
声明为reg [7:0] ra [0:3];
。假设 ra
被称为寄存器数组(内存)。这声明了一个 4-byte 的内存。
寻址4个字节,只需要两位就足够了。因此,地址仅为 00,01,10,11。 addr
的 高位 从未 使用,即位 3:2 在任何情况下都未使用。因此发出警告。
对于16-bytes的内存,需要将ra
声明为reg [7:0] ra [0:15];
,通过这个addr
的所有位都将用完并删除警告。
现在进入警告的第二部分。
This port will be preserved and left unconnected if it belongs to a top-level block or it belongs to a sub-block and the hierarchy of this sub-block is preserved.
即使未使用这些位,它们也会被综合工具保留并保持未连接状态。如果这些行在顶部实例化块中可用。这是一件很合理的事情。
我正在尝试创建一个寄存器数组,并希望消除警告。我在下面创建了一个最小的示例设计。为什么 addr
的一部分未被使用?
当我合成时收到警告:
WARNING:Xst:647 - Input <addr<3:2>> is never used. This port will be preserved and left unconnected if it belongs to a top-level block or it belongs to a sub-block and the hierarchy of this sub-block is preserved.
module test(addr,in,out,wr,clk);
input [3:0] addr;
input [7:0] in;
output reg [7:0] out;
input wr;
input clk;
reg [7:0] ra [0:3];
always @(posedge clk)
begin
if (wr)
ra[addr] = in;
else
out <= ra[addr];
end
endmodule
我正在尝试创建一个具有 16 个地址 (0-15) 的 8 位宽的寄存器。
给出的警告的以下部分很重要。
Input "addr3:2" is never used.
这里,addr
是四位,ra
声明为reg [7:0] ra [0:3];
。假设 ra
被称为寄存器数组(内存)。这声明了一个 4-byte 的内存。
寻址4个字节,只需要两位就足够了。因此,地址仅为 00,01,10,11。 addr
的 高位 从未 使用,即位 3:2 在任何情况下都未使用。因此发出警告。
对于16-bytes的内存,需要将ra
声明为reg [7:0] ra [0:15];
,通过这个addr
的所有位都将用完并删除警告。
现在进入警告的第二部分。
This port will be preserved and left unconnected if it belongs to a top-level block or it belongs to a sub-block and the hierarchy of this sub-block is preserved.
即使未使用这些位,它们也会被综合工具保留并保持未连接状态。如果这些行在顶部实例化块中可用。这是一件很合理的事情。