Skip to content

Commit

Permalink
LZA (Leading zeros anticipation) (#741)
Browse files Browse the repository at this point in the history
  • Loading branch information
tilk committed Dec 14, 2024
1 parent 05c0641 commit f717301
Show file tree
Hide file tree
Showing 47 changed files with 1,127 additions and 1,026 deletions.
Binary file modified .doctrees/api.doctree
Binary file not shown.
Binary file modified .doctrees/auto_graph.doctree
Binary file not shown.
Binary file modified .doctrees/coreblocks.func_blocks.fu.fpu.doctree
Binary file not shown.
Binary file modified .doctrees/current-graph.doctree
Binary file not shown.
Binary file modified .doctrees/environment.pickle
Binary file not shown.
654 changes: 327 additions & 327 deletions _sources/auto_graph.rst.txt

Large diffs are not rendered by default.

8 changes: 8 additions & 0 deletions _sources/coreblocks.func_blocks.fu.fpu.rst.txt
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,14 @@ coreblocks.func\_blocks.fu.fpu.fpu\_rounding\_module module
:undoc-members:
:show-inheritance:

coreblocks.func\_blocks.fu.fpu.lza module
-----------------------------------------

.. automodule:: coreblocks.func_blocks.fu.fpu.lza
:members:
:undoc-members:
:show-inheritance:

Module contents
---------------

Expand Down
2 changes: 1 addition & 1 deletion api.html
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,7 @@ <h2>coreblocks<a class="headerlink" href="#coreblocks" title="Permalink to this

<div role="contentinfo">
<p>&#169; Copyright Kuźnia Rdzeni, 2024.
<span class="lastupdated">Last updated on 22:30 2024-12-10.
<span class="lastupdated">Last updated on 10:39 2024-12-14.
</span></p>
</div>

Expand Down
2 changes: 1 addition & 1 deletion assumptions.html
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ <h1>List of assumptions made during development<a class="headerlink" href="#list

<div role="contentinfo">
<p>&#169; Copyright Kuźnia Rdzeni, 2024.
<span class="lastupdated">Last updated on 22:30 2024-12-10.
<span class="lastupdated">Last updated on 10:39 2024-12-14.
</span></p>
</div>

Expand Down
656 changes: 328 additions & 328 deletions auto_graph.html

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion components/icache.html
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ <h2>Address mapping example<a class="headerlink" href="#address-mapping-example"

<div role="contentinfo">
<p>&#169; Copyright Kuźnia Rdzeni, 2024.
<span class="lastupdated">Last updated on 22:30 2024-12-10.
<span class="lastupdated">Last updated on 10:39 2024-12-14.
</span></p>
</div>

Expand Down
2 changes: 1 addition & 1 deletion coreblocks.arch.html
Original file line number Diff line number Diff line change
Expand Up @@ -3948,7 +3948,7 @@ <h2>Submodules<a class="headerlink" href="#submodules" title="Permalink to this

<div role="contentinfo">
<p>&#169; Copyright Kuźnia Rdzeni, 2024.
<span class="lastupdated">Last updated on 22:30 2024-12-10.
<span class="lastupdated">Last updated on 10:39 2024-12-14.
</span></p>
</div>

Expand Down
2 changes: 1 addition & 1 deletion coreblocks.backend.html
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ <h2>Submodules<a class="headerlink" href="#submodules" title="Permalink to this

<div role="contentinfo">
<p>&#169; Copyright Kuźnia Rdzeni, 2024.
<span class="lastupdated">Last updated on 22:30 2024-12-10.
<span class="lastupdated">Last updated on 10:39 2024-12-14.
</span></p>
</div>

Expand Down
2 changes: 1 addition & 1 deletion coreblocks.cache.html
Original file line number Diff line number Diff line change
Expand Up @@ -240,7 +240,7 @@ <h2>Submodules<a class="headerlink" href="#submodules" title="Permalink to this

<div role="contentinfo">
<p>&#169; Copyright Kuźnia Rdzeni, 2024.
<span class="lastupdated">Last updated on 22:30 2024-12-10.
<span class="lastupdated">Last updated on 10:39 2024-12-14.
</span></p>
</div>

Expand Down
2 changes: 1 addition & 1 deletion coreblocks.core_structs.html
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ <h2>Submodules<a class="headerlink" href="#submodules" title="Permalink to this

<div role="contentinfo">
<p>&#169; Copyright Kuźnia Rdzeni, 2024.
<span class="lastupdated">Last updated on 22:30 2024-12-10.
<span class="lastupdated">Last updated on 10:39 2024-12-14.
</span></p>
</div>

Expand Down
2 changes: 1 addition & 1 deletion coreblocks.frontend.decoder.html
Original file line number Diff line number Diff line change
Expand Up @@ -312,7 +312,7 @@ <h2>Submodules<a class="headerlink" href="#submodules" title="Permalink to this

<div role="contentinfo">
<p>&#169; Copyright Kuźnia Rdzeni, 2024.
<span class="lastupdated">Last updated on 22:30 2024-12-10.
<span class="lastupdated">Last updated on 10:39 2024-12-14.
</span></p>
</div>

Expand Down
2 changes: 1 addition & 1 deletion coreblocks.frontend.fetch.html
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,7 @@ <h2>Submodules<a class="headerlink" href="#submodules" title="Permalink to this

<div role="contentinfo">
<p>&#169; Copyright Kuźnia Rdzeni, 2024.
<span class="lastupdated">Last updated on 22:30 2024-12-10.
<span class="lastupdated">Last updated on 10:39 2024-12-14.
</span></p>
</div>

Expand Down
2 changes: 1 addition & 1 deletion coreblocks.frontend.html
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@ <h2>Submodules<a class="headerlink" href="#submodules" title="Permalink to this

<div role="contentinfo">
<p>&#169; Copyright Kuźnia Rdzeni, 2024.
<span class="lastupdated">Last updated on 22:30 2024-12-10.
<span class="lastupdated">Last updated on 10:39 2024-12-14.
</span></p>
</div>

Expand Down
71 changes: 70 additions & 1 deletion coreblocks.func_blocks.fu.fpu.html
Original file line number Diff line number Diff line change
Expand Up @@ -284,6 +284,75 @@ <h2>Submodules<a class="headerlink" href="#submodules" title="Permalink to this

</dd></dl>

</div>
<div class="section" id="module-coreblocks.func_blocks.fu.fpu.lza">
<span id="coreblocks-func-blocks-fu-fpu-lza-module"></span><h2>coreblocks.func_blocks.fu.fpu.lza module<a class="headerlink" href="#module-coreblocks.func_blocks.fu.fpu.lza" title="Permalink to this heading"></a></h2>
<dl class="py class">
<dt class="sig sig-object py" id="coreblocks.func_blocks.fu.fpu.lza.LZAMethodLayout">
<em class="property"><span class="pre">class</span><span class="w"> </span></em><span class="sig-prename descclassname"><span class="pre">coreblocks.func_blocks.fu.fpu.lza.</span></span><span class="sig-name descname"><span class="pre">LZAMethodLayout</span></span><a class="headerlink" href="#coreblocks.func_blocks.fu.fpu.lza.LZAMethodLayout" title="Permalink to this definition"></a></dt>
<dd><p>Bases: <a class="reference external" href="https://docs.python.org/3/library/functions.html#object" title="(in Python v3.13)"><code class="xref py py-class docutils literal notranslate"><span class="pre">object</span></code></a></p>
<p>LZA module layouts for methods</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><dl class="simple">
<dt><strong>fpu_params: FPUParams</strong></dt><dd><p>FPU parameters</p>
</dd>
</dl>
</dd>
</dl>
<dl class="py method">
<dt class="sig sig-object py" id="coreblocks.func_blocks.fu.fpu.lza.LZAMethodLayout.__init__">
<span class="sig-name descname"><span class="pre">__init__</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="o"><span class="pre">*</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">fpu_params</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><a class="reference internal" href="#coreblocks.func_blocks.fu.fpu.fpu_common.FPUParams" title="coreblocks.func_blocks.fu.fpu.fpu_common.FPUParams"><span class="pre">FPUParams</span></a></span></em><span class="sig-paren">)</span><a class="headerlink" href="#coreblocks.func_blocks.fu.fpu.lza.LZAMethodLayout.__init__" title="Permalink to this definition"></a></dt>
<dd><p>sig_a - significand of a
sig_b - significand of b
carry - indicates if we want to predict result of a+b or a+b+1
shift_amount - position to shift needed to normalize number
is_zero - indicates if result is zero</p>
</dd></dl>

</dd></dl>

<dl class="py class">
<dt class="sig sig-object py" id="coreblocks.func_blocks.fu.fpu.lza.LZAModule">
<em class="property"><span class="pre">class</span><span class="w"> </span></em><span class="sig-prename descclassname"><span class="pre">coreblocks.func_blocks.fu.fpu.lza.</span></span><span class="sig-name descname"><span class="pre">LZAModule</span></span><a class="headerlink" href="#coreblocks.func_blocks.fu.fpu.lza.LZAModule" title="Permalink to this definition"></a></dt>
<dd><p>Bases: <code class="xref py py-class docutils literal notranslate"><span class="pre">Elaboratable</span></code></p>
<p>LZA module
Based on: <a class="reference external" href="https://userpages.cs.umbc.edu/phatak/645/supl/lza/lza-survey-arith01.pdf">https://userpages.cs.umbc.edu/phatak/645/supl/lza/lza-survey-arith01.pdf</a>
After performing subtracion, we may have to normalize floating point numbers and
For that, we have to know the number of leading zeros.
The most basic approach includes using LZC (leading zero counter) after subtracion,
a more advanced approach includes using LZA (Leading Zero Anticipator) to predict the number of
leading zeroes. It is worth noting that this LZA module works under assumptions that
significands are in two’s complement and that before complementation sig_a was greater
or equal to sig_b. Another thing worth noting is that LZA works with error = 1.
That means that if ‘n’ is the result of the LZA module, in reality, to normalize
number we may have to shift left by ‘n’ or ‘n+1’. There are few techniques of
dealing with that error like specially designed shifters or predicting the error
but the most basic approach is to just use multiplexer after shifter to perform
one more shift left if necessary.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><dl class="simple">
<dt><strong>fpu_params: FPUParams</strong></dt><dd><p>FPU rounding module parameters</p>
</dd>
</dl>
</dd>
<dt class="field-even">Attributes</dt>
<dd class="field-even"><dl class="simple">
<dt><strong>predict_request: Method</strong></dt><dd><p>Transactional method for initiating leading zeros prediction.
Takes ‘predict_in_layout’ as argument
Returns shift amount as ‘predict_out_layout’</p>
</dd>
</dl>
</dd>
</dl>
<dl class="py method">
<dt class="sig sig-object py" id="coreblocks.func_blocks.fu.fpu.lza.LZAModule.__init__">
<span class="sig-name descname"><span class="pre">__init__</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="o"><span class="pre">*</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">fpu_params</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><a class="reference internal" href="#coreblocks.func_blocks.fu.fpu.fpu_common.FPUParams" title="coreblocks.func_blocks.fu.fpu.fpu_common.FPUParams"><span class="pre">FPUParams</span></a></span></em><span class="sig-paren">)</span><a class="headerlink" href="#coreblocks.func_blocks.fu.fpu.lza.LZAModule.__init__" title="Permalink to this definition"></a></dt>
<dd></dd></dl>

</dd></dl>

</div>
<div class="section" id="module-coreblocks.func_blocks.fu.fpu">
<span id="module-contents"></span><h2>Module contents<a class="headerlink" href="#module-coreblocks.func_blocks.fu.fpu" title="Permalink to this heading"></a></h2>
Expand All @@ -302,7 +371,7 @@ <h2>Submodules<a class="headerlink" href="#submodules" title="Permalink to this

<div role="contentinfo">
<p>&#169; Copyright Kuźnia Rdzeni, 2024.
<span class="lastupdated">Last updated on 22:30 2024-12-10.
<span class="lastupdated">Last updated on 10:39 2024-12-14.
</span></p>
</div>

Expand Down
3 changes: 2 additions & 1 deletion coreblocks.func_blocks.fu.html
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,7 @@ <h2>Subpackages<a class="headerlink" href="#subpackages" title="Permalink to thi
<li class="toctree-l2"><a class="reference internal" href="coreblocks.func_blocks.fu.fpu.html#module-coreblocks.func_blocks.fu.fpu.fpu_common">coreblocks.func_blocks.fu.fpu.fpu_common module</a></li>
<li class="toctree-l2"><a class="reference internal" href="coreblocks.func_blocks.fu.fpu.html#module-coreblocks.func_blocks.fu.fpu.fpu_error_module">coreblocks.func_blocks.fu.fpu.fpu_error_module module</a></li>
<li class="toctree-l2"><a class="reference internal" href="coreblocks.func_blocks.fu.fpu.html#module-coreblocks.func_blocks.fu.fpu.fpu_rounding_module">coreblocks.func_blocks.fu.fpu.fpu_rounding_module module</a></li>
<li class="toctree-l2"><a class="reference internal" href="coreblocks.func_blocks.fu.fpu.html#module-coreblocks.func_blocks.fu.fpu.lza">coreblocks.func_blocks.fu.fpu.lza module</a></li>
<li class="toctree-l2"><a class="reference internal" href="coreblocks.func_blocks.fu.fpu.html#module-coreblocks.func_blocks.fu.fpu">Module contents</a></li>
</ul>
</li>
Expand Down Expand Up @@ -893,7 +894,7 @@ <h2>Submodules<a class="headerlink" href="#submodules" title="Permalink to this

<div role="contentinfo">
<p>&#169; Copyright Kuźnia Rdzeni, 2024.
<span class="lastupdated">Last updated on 22:30 2024-12-10.
<span class="lastupdated">Last updated on 10:39 2024-12-14.
</span></p>
</div>

Expand Down
2 changes: 1 addition & 1 deletion coreblocks.func_blocks.fu.lsu.html
Original file line number Diff line number Diff line change
Expand Up @@ -289,7 +289,7 @@ <h2>Submodules<a class="headerlink" href="#submodules" title="Permalink to this

<div role="contentinfo">
<p>&#169; Copyright Kuźnia Rdzeni, 2024.
<span class="lastupdated">Last updated on 22:30 2024-12-10.
<span class="lastupdated">Last updated on 10:39 2024-12-14.
</span></p>
</div>

Expand Down
2 changes: 1 addition & 1 deletion coreblocks.func_blocks.fu.unsigned_multiplication.html
Original file line number Diff line number Diff line change
Expand Up @@ -259,7 +259,7 @@ <h2>Submodules<a class="headerlink" href="#submodules" title="Permalink to this

<div role="contentinfo">
<p>&#169; Copyright Kuźnia Rdzeni, 2024.
<span class="lastupdated">Last updated on 22:30 2024-12-10.
<span class="lastupdated">Last updated on 10:39 2024-12-14.
</span></p>
</div>

Expand Down
3 changes: 2 additions & 1 deletion coreblocks.func_blocks.html
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,7 @@ <h2>Subpackages<a class="headerlink" href="#subpackages" title="Permalink to thi
<li class="toctree-l4"><a class="reference internal" href="coreblocks.func_blocks.fu.fpu.html#module-coreblocks.func_blocks.fu.fpu.fpu_common">coreblocks.func_blocks.fu.fpu.fpu_common module</a></li>
<li class="toctree-l4"><a class="reference internal" href="coreblocks.func_blocks.fu.fpu.html#module-coreblocks.func_blocks.fu.fpu.fpu_error_module">coreblocks.func_blocks.fu.fpu.fpu_error_module module</a></li>
<li class="toctree-l4"><a class="reference internal" href="coreblocks.func_blocks.fu.fpu.html#module-coreblocks.func_blocks.fu.fpu.fpu_rounding_module">coreblocks.func_blocks.fu.fpu.fpu_rounding_module module</a></li>
<li class="toctree-l4"><a class="reference internal" href="coreblocks.func_blocks.fu.fpu.html#module-coreblocks.func_blocks.fu.fpu.lza">coreblocks.func_blocks.fu.fpu.lza module</a></li>
<li class="toctree-l4"><a class="reference internal" href="coreblocks.func_blocks.fu.fpu.html#module-coreblocks.func_blocks.fu.fpu">Module contents</a></li>
</ul>
</li>
Expand Down Expand Up @@ -157,7 +158,7 @@ <h2>Subpackages<a class="headerlink" href="#subpackages" title="Permalink to thi

<div role="contentinfo">
<p>&#169; Copyright Kuźnia Rdzeni, 2024.
<span class="lastupdated">Last updated on 22:30 2024-12-10.
<span class="lastupdated">Last updated on 10:39 2024-12-14.
</span></p>
</div>

Expand Down
2 changes: 1 addition & 1 deletion coreblocks.func_blocks.interface.html
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ <h2>Submodules<a class="headerlink" href="#submodules" title="Permalink to this

<div role="contentinfo">
<p>&#169; Copyright Kuźnia Rdzeni, 2024.
<span class="lastupdated">Last updated on 22:30 2024-12-10.
<span class="lastupdated">Last updated on 10:39 2024-12-14.
</span></p>
</div>

Expand Down
2 changes: 1 addition & 1 deletion coreblocks.html
Original file line number Diff line number Diff line change
Expand Up @@ -272,7 +272,7 @@ <h2>Submodules<a class="headerlink" href="#submodules" title="Permalink to this

<div role="contentinfo">
<p>&#169; Copyright Kuźnia Rdzeni, 2024.
<span class="lastupdated">Last updated on 22:30 2024-12-10.
<span class="lastupdated">Last updated on 10:39 2024-12-14.
</span></p>
</div>

Expand Down
2 changes: 1 addition & 1 deletion coreblocks.params.html
Original file line number Diff line number Diff line change
Expand Up @@ -831,7 +831,7 @@ <h2>Submodules<a class="headerlink" href="#submodules" title="Permalink to this

<div role="contentinfo">
<p>&#169; Copyright Kuźnia Rdzeni, 2024.
<span class="lastupdated">Last updated on 22:30 2024-12-10.
<span class="lastupdated">Last updated on 10:39 2024-12-14.
</span></p>
</div>

Expand Down
2 changes: 1 addition & 1 deletion coreblocks.peripherals.html
Original file line number Diff line number Diff line change
Expand Up @@ -745,7 +745,7 @@ <h2>Submodules<a class="headerlink" href="#submodules" title="Permalink to this

<div role="contentinfo">
<p>&#169; Copyright Kuźnia Rdzeni, 2024.
<span class="lastupdated">Last updated on 22:30 2024-12-10.
<span class="lastupdated">Last updated on 10:39 2024-12-14.
</span></p>
</div>

Expand Down
2 changes: 1 addition & 1 deletion coreblocks.priv.csr.html
Original file line number Diff line number Diff line change
Expand Up @@ -305,7 +305,7 @@ <h2>Submodules<a class="headerlink" href="#submodules" title="Permalink to this

<div role="contentinfo">
<p>&#169; Copyright Kuźnia Rdzeni, 2024.
<span class="lastupdated">Last updated on 22:30 2024-12-10.
<span class="lastupdated">Last updated on 10:39 2024-12-14.
</span></p>
</div>

Expand Down
2 changes: 1 addition & 1 deletion coreblocks.priv.html
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ <h2>Subpackages<a class="headerlink" href="#subpackages" title="Permalink to thi

<div role="contentinfo">
<p>&#169; Copyright Kuźnia Rdzeni, 2024.
<span class="lastupdated">Last updated on 22:30 2024-12-10.
<span class="lastupdated">Last updated on 10:39 2024-12-14.
</span></p>
</div>

Expand Down
2 changes: 1 addition & 1 deletion coreblocks.priv.traps.html
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,7 @@ <h2>Submodules<a class="headerlink" href="#submodules" title="Permalink to this

<div role="contentinfo">
<p>&#169; Copyright Kuźnia Rdzeni, 2024.
<span class="lastupdated">Last updated on 22:30 2024-12-10.
<span class="lastupdated">Last updated on 10:39 2024-12-14.
</span></p>
</div>

Expand Down
2 changes: 1 addition & 1 deletion coreblocks.scheduler.html
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,7 @@ <h2>Submodules<a class="headerlink" href="#submodules" title="Permalink to this

<div role="contentinfo">
<p>&#169; Copyright Kuźnia Rdzeni, 2024.
<span class="lastupdated">Last updated on 22:30 2024-12-10.
<span class="lastupdated">Last updated on 10:39 2024-12-14.
</span></p>
</div>

Expand Down
Loading

0 comments on commit f717301

Please sign in to comment.