mirror of
https://github.com/lowRISC/ibex.git
synced 2025-04-23 13:27:10 -04:00
Add comment to clarify that ignoring the MSB in the MAC is safe.
It is not obvious that the MSB in the MAC of the multiplier can safely be ignored, and it is tedious to derive this from solely studying the architecture of the multiplier. This comment makes clear that it is indeed safe and also gives some reasoning.
This commit is contained in:
parent
29107c5283
commit
5962df278e
1 changed files with 4 additions and 0 deletions
|
@ -118,6 +118,10 @@ module ibex_multdiv_fast (
|
|||
|
||||
assign multdiv_result_o = div_en_i ? mac_res_q[31:0] : mac_res_n[31:0];
|
||||
|
||||
// The 2 MSBs of mac_res_ext (mac_res_ext[34:33]) are always equal since:
|
||||
// 1. The 2 MSBs of the multiplicants are always equal, and
|
||||
// 2. The 16 MSBs of the addend (accum[33:18]) are always equal.
|
||||
// Thus, it is safe to ignore mac_res_ext[34].
|
||||
assign mac_res_signed = $signed({sign_a, mult_op_a})*$signed({sign_b, mult_op_b}) + $signed(accum);
|
||||
assign mac_res_ext = $unsigned(mac_res_signed);
|
||||
assign mac_res = mac_res_ext[33:0];
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue