简体   繁体   中英

RISC-V RV32M spec v2.0: Why not zero-check before DIV?

The commentary on integer division exceptions suggests adding a branch after a DIV to check for the divide-by-zero case. Since all divisors are contained in registers, it seems marginally more efficient to check the divisor before the DIV. Why would it be important to do the DIV first?

For a non-superscalar processor, it would in fact be marginally more efficient to check the divisor before issuing the DIV. However, it's potentially quite likely that a DIV instruction could be issued and take some considerable amount of time to finish and its result could be a dependency for a future instruction

On a superscalar processor assuming no structural hazards, the check could issue on the very next cycle after the divsion, thus not delaying its issue/execution, and letting any dependencies/stalls related to that division get resolved a cycle earlier.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM