M
Mr. Ken
Guest
Here is my function, which does some custom-made multipliers/division.
NCVerilog simulations for RTL so far shows no problem but design compiler
complains of
this warning.
"Warning: myfile.v:276: Variable 'result' may be read before being
assigned; the synthesized result may not match simulations. (ELAB-391)"
How do I fix this problem?
function [17:0] mult_ck34; // Multiplication for ck3, cl4
input [14:0] sum_row;
input [2:0] multpl_sel;
reg [22:0] result;
begin
case (multpl_sel)
3'b001,
3'b110: begin // 32 + 8 + 2 + 1 // X43>>3
result[20:0] = {{ {sum_row[14]}}, {sum_row}, {5'b0}} + // 32
{{3{sum_row[14]}}, {sum_row}, {3'b0}} + // 8
{{5{sum_row[14]}}, {sum_row}, {1'b0}} + // 2
{{6{sum_row[14]}}, {sum_row}}; // 1
result[22:21] = {2{result[20]}};
end
...
...
endcase
end
mult_ck34 = result[21:4];
endfunction
NCVerilog simulations for RTL so far shows no problem but design compiler
complains of
this warning.
"Warning: myfile.v:276: Variable 'result' may be read before being
assigned; the synthesized result may not match simulations. (ELAB-391)"
How do I fix this problem?
function [17:0] mult_ck34; // Multiplication for ck3, cl4
input [14:0] sum_row;
input [2:0] multpl_sel;
reg [22:0] result;
begin
case (multpl_sel)
3'b001,
3'b110: begin // 32 + 8 + 2 + 1 // X43>>3
result[20:0] = {{ {sum_row[14]}}, {sum_row}, {5'b0}} + // 32
{{3{sum_row[14]}}, {sum_row}, {3'b0}} + // 8
{{5{sum_row[14]}}, {sum_row}, {1'b0}} + // 2
{{6{sum_row[14]}}, {sum_row}}; // 1
result[22:21] = {2{result[20]}};
end
...
...
endcase
end
mult_ck34 = result[21:4];
endfunction