pulp-platform / fpu

Other
37 stars 21 forks source link

Confusion about how LZA module works? #12

Open qleenju opened 2 years ago

qleenju commented 2 years ago

hello: I have some questions about how LZA module works? As leading zero anticipator, it serves to predict the leading zero counts of result while adding, so that normalization can be directly implemented after addition is completed. However, in the module "fmac.sv", the input of LZA is A_LZA_D and B_LZA_D, instead of Csa_sum_D and Csa_carry_D. What's more, the value of A_LZA_D is always consistent with Sum_pos_D, which is the sum of Csa_sum_D and Csa_carry_D, and the value of B_LZA_D is always 0. In this case, the leading zero anticipation can not play a role at all, even though the out of fmac is correct. I would also like to ask about the exact role of "LZA" module, since I found that it is not always accurate in predicting the leading zero of the sum of two inputs.
Looking forward to your response. Best wishes! Qiong Li, a student from Nanjing University.

qleenju commented 2 years ago

Regarding the LZA module, I have found that as long as the results do not overflow, the leading zero anticipation of the sum of two inputs is generally correct, with occasional deviations of 1, which can be corrected in the process of normalization.

MaoPann commented 1 year ago

How did you correct it? I encountered the same problem, 37-11 * 3 calculation error。

MaoPann commented 1 year ago

@qleenju