diff options
author | Yann Herklotz <git@yannherklotz.com> | 2020-11-19 22:32:17 +0000 |
---|---|---|
committer | Yann Herklotz <git@yannherklotz.com> | 2020-11-19 22:32:17 +0000 |
commit | 9ef3587cdb6f58e8f28c6b8ac98ca43255db0d6b (patch) | |
tree | 43320f6ea340c395360405f2e89e4725c12b6dbb /algorithm.tex | |
parent | 7693bd9c9ba215fa132b696a0de77881ba59c214 (diff) | |
download | oopsla21_fvhls-9ef3587cdb6f58e8f28c6b8ac98ca43255db0d6b.tar.gz oopsla21_fvhls-9ef3587cdb6f58e8f28c6b8ac98ca43255db0d6b.zip |
Small beauty fixes
Diffstat (limited to 'algorithm.tex')
-rw-r--r-- | algorithm.tex | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/algorithm.tex b/algorithm.tex index c4f59c5..c590b00 100644 --- a/algorithm.tex +++ b/algorithm.tex @@ -274,7 +274,7 @@ But dividing by a constant can often be optimised to a more efficient operation, \texttt{Oshrximm } x\ y = x \div 2^{y} \end{equation*} -As these are the semantics of the \texttt{Oshrximm} instruction, it means that the Verilog statement that is supposed to implement this instruction needs to have the exact same semantics. The na\"{i}ve, implementation would be to just implement it using the Verilog division operator and rely on the hardware synthesis tool to convert that to an efficient implementation. It is quite rare that this will succeed with signed division though, as it cannot be implemented using a single simple shift instruction and the synthesis tool will often fall back to using a division circuit. However, the observation can be made that signed division can be implemented using shifts as shown below, where $>>$ stands for a logical right shift: +As these are the semantics of the \texttt{Oshrximm} instruction, it means that the Verilog statement that is supposed to implement this instruction needs to have the exact same semantics. The na\"{i}ve, implementation would be to just implement it using the Verilog division operator and rely on the hardware synthesis tool to convert that to an efficient implementation. It is quite rare that this will succeed with signed division though, as it cannot be implemented using a single simple shift instruction and the synthesis tool will often fall back to using a division circuit. However, the observation can be made that signed division can be implemented using shifts as shown below, where $\gg$ stands for a logical right shift: \begin{remark} @@ -283,8 +283,8 @@ As these are the semantics of the \texttt{Oshrximm} instruction, it means that t \begin{equation*} x \div 2^y = \begin{cases} - \left\lfloor \frac{x}{2^y} \right\rfloor = x >> y,& \text{if } x \geq 0\\ - \left\lceil \frac{x}{2^y} \right\rceil = - \left\lfloor \frac{-x}{2^y} \right\rfloor = - ( - x >> y ),& \text{otherwise}. + \left\lfloor \frac{x}{2^y} \right\rfloor = x \gg y,& \text{if } x \geq 0\\ + \left\lceil \frac{x}{2^y} \right\rceil = - \left\lfloor \frac{-x}{2^y} \right\rfloor = - ( - x \gg y ),& \text{otherwise}. \end{cases}\\ \end{equation*} \end{remark} |