//每个输出值的计算 always@(posedge clk or negedge rst) begin if(!rst) begin mult_state <= 5'd0; dataa_r <= 0; datab_r <= 0; sum <= 0;end else begin case(mult_state) 5'd0: begin dataa_r <= data_add[1]; datab_r <= h0; dataout <= sum; sum <= 0; mult_state <= 5'd1; end 5'd1: begin dataa_r <= data_add[2]; datab_r <= h1; sum <= sum + {result[21],result}; mult_state <= 5'd2; end 5'd2: begin dataa_r <= data_add[3]; datab_r <= h2; sum <= sum + {result[21],result}; mult_state <= 5'd3; end 5'd3: begin dataa_r <= data_add[4]; datab_r <= h3; sum <= sum + {result[21],result}; mult_state <= 5'd4; end 5'd4: begin dataa_r <= data_add[5]; datab_r <= h4; sum <= sum + {result[21],result}; mult_state <= 5'd5; end 5'd5: begin dataa_r <= data_add[6]; datab_r <= h5; sum <= sum + {result[21],result}; mult_state <= 5'd6; end 5'd6: begin dataa_r <= data_add[7]; datab_r <= h6; sum <= sum + {result[21],result}; mult_state <= 5'd7; end 5'd7: begin dataa_r <= data_add[8]; datab_r <= h7; sum <= sum + {result[21],result}; mult_state <= 5'd8; end 5'd8: begin dataa_r <= data_add[9]; datab_r <= h8; sum <= sum + {result[21],result}; mult_state <= 5'd9; end 5'd9: begin dataa_r <= data_add[10]; datab_r <= h9; sum <= sum + {result[21],result}; mult_state <= 5'd10; end 5'd10: begin mult_state <= 5'd0; sum <= sum + {result[21],result}; end default: begin dataa_r <= 0; datab_r <= 0; sum <= 0; end endcase end end
40763529_613887482 2011-12-23 16:52