hallovipin
Member level 1
input [11:0] adc_data_in;
reg [15:0] sum, check_for_loop;
reg [7:0] j;
reg crossed_sum_threshold;
always @(posedge clk) begin
if(sum>15'b001111111111111) begin
sum=0;
crossed_sum_threshold=~crossed_sum_threshold;
end
else
sum=sum+adc_data_in;
end
always @(crossed_sum_threshold)
for(j=8'd0;j<8'd128;j=j+1) begin
check_for_loop = check_for_loop + sum +j; ///// problem lies here
end
As per SYNTHESIS RULES for loop can only accumulate constants not variable
like:
check_for_loop=check_for_loop+15'd6;
It can not accumulate variables.
What should I do to acheicve this accumulation. Always block can accumulate variable also but always blocks can not be nested (I cant put one always block inside other). One always block has already been used for detecting that sum value has crossed threshold.
Can anybody suggest something
reg [15:0] sum, check_for_loop;
reg [7:0] j;
reg crossed_sum_threshold;
always @(posedge clk) begin
if(sum>15'b001111111111111) begin
sum=0;
crossed_sum_threshold=~crossed_sum_threshold;
end
else
sum=sum+adc_data_in;
end
always @(crossed_sum_threshold)
for(j=8'd0;j<8'd128;j=j+1) begin
check_for_loop = check_for_loop + sum +j; ///// problem lies here
end
As per SYNTHESIS RULES for loop can only accumulate constants not variable
like:
check_for_loop=check_for_loop+15'd6;
It can not accumulate variables.
What should I do to acheicve this accumulation. Always block can accumulate variable also but always blocks can not be nested (I cant put one always block inside other). One always block has already been used for detecting that sum value has crossed threshold.
Can anybody suggest something