L
LYY
Guest
Suppose I want to assignan signals between 2 arrays:
reg [datawidth-1:0] a[0:length-1];
reg [datawidth-1:0] b[0:length-1];
always @(posedge clk) begin
b[0] <= a[0];
b[1] <= a[1];
b[2] <= a[2];
............
b[length-1] <= a[length-1];
end
This requires a lot of typing and is not as maintainable as a for-loop
version:
integer i;
reg [datawidth-1:0] a[0:length-1];
reg [datawidth-1:0] b[0:length-1];
always @(posedge clk) begin
for (i = 0; i<datawidth; i=i+1) begin
b <= a;
end
end
However, my concern is whether the 2 versions will produce the same
amount of logic across different synthesis tools. Will the for-loop
version introduce the overhead of a counter?
Will the for-loop version result in sequential logic across the
assignment which cause more delays as compared to the parallel
assignment(1st) version?
YY
reg [datawidth-1:0] a[0:length-1];
reg [datawidth-1:0] b[0:length-1];
always @(posedge clk) begin
b[0] <= a[0];
b[1] <= a[1];
b[2] <= a[2];
............
b[length-1] <= a[length-1];
end
This requires a lot of typing and is not as maintainable as a for-loop
version:
integer i;
reg [datawidth-1:0] a[0:length-1];
reg [datawidth-1:0] b[0:length-1];
always @(posedge clk) begin
for (i = 0; i<datawidth; i=i+1) begin
b <= a;
end
end
However, my concern is whether the 2 versions will produce the same
amount of logic across different synthesis tools. Will the for-loop
version introduce the overhead of a counter?
Will the for-loop version result in sequential logic across the
assignment which cause more delays as compared to the parallel
assignment(1st) version?
YY