Skip to content

Commit

Permalink
deploy: e2e604e
Browse files Browse the repository at this point in the history
  • Loading branch information
bobbinth committed Sep 22, 2023
1 parent 7ad943f commit c219143
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 4 deletions.
7 changes: 6 additions & 1 deletion print.html
Original file line number Diff line number Diff line change
Expand Up @@ -677,7 +677,7 @@ <h4 id="re-exporting-procedures"><a class="header" href="#re-exporting-procedure
</code></pre>
<p>In addition to the locally-defined procedure <code>foo</code>, the above module also exports procedures <code>add</code> and <code>mul64</code> implementations of which will be identical to <code>add</code> and <code>mul</code> procedures from the <code>std::math::u64</code> module respectively.</p>
<h3 id="constants"><a class="header" href="#constants">Constants</a></h3>
<p>Miden assembly supports constant declarations. These constants are scoped to the module they are defined in and can be used as immediate parameters for Miden assembly instructions. Constants are supported as immediate values for the following instructions: <code>push</code>, <code>locaddr</code>, <code>loc_load</code>, <code>loc_loadw</code>, <code>loc_store</code>, <code>loc_storew</code>, <code>mem_load</code>, <code>mem_loadw</code>, <code>mem_store</code>, <code>mem_storew</code>.</p>
<p>Miden assembly supports constant declarations. These constants are scoped to the module they are defined in and can be used as immediate parameters for Miden assembly instructions. Constants are supported as immediate values for the following instructions: <code>push</code>, <code>assert</code>, <code>assertz</code>, <code>asert_eq</code>, <code>assert_eqw</code>, <code>locaddr</code>, <code>loc_load</code>, <code>loc_loadw</code>, <code>loc_store</code>, <code>loc_storew</code>, <code>mem_load</code>, <code>mem_loadw</code>, <code>mem_store</code>, <code>mem_storew</code>.</p>
<p>Constants must be declared right after module imports and before any procedures or program bodies. A constant's name must start with an upper-case letter and can contain any combination of numbers, upper-case ASCII letters, and underscores (<code>_</code>). The number of characters in a constant name cannot exceed 100. </p>
<p>A constant's value must be in the range between <span class="katex"><span class="katex-html" aria-hidden="true"><span class="base"><span class="strut" style="height:0.6444em;"></span><span class="mord">0</span></span></span></span> and <span class="katex"><span class="katex-html" aria-hidden="true"><span class="base"><span class="strut" style="height:0.8974em;vertical-align:-0.0833em;"></span><span class="mord"><span class="mord">2</span><span class="msupsub"><span class="vlist-t"><span class="vlist-r"><span class="vlist" style="height:0.8141em;"><span style="top:-3.063em;margin-right:0.05em;"><span class="pstrut" style="height:2.7em;"></span><span class="sizing reset-size6 size3 mtight"><span class="mord mtight"><span class="mord mtight">64</span></span></span></span></span></span></span></span></span><span class="mspace" style="margin-right:0.2222em;"></span><span class="mbin">−</span><span class="mspace" style="margin-right:0.2222em;"></span></span><span class="base"><span class="strut" style="height:0.8141em;"></span><span class="mord"><span class="mord">2</span><span class="msupsub"><span class="vlist-t"><span class="vlist-r"><span class="vlist" style="height:0.8141em;"><span style="top:-3.063em;margin-right:0.05em;"><span class="pstrut" style="height:2.7em;"></span><span class="sizing reset-size6 size3 mtight"><span class="mord mtight"><span class="mord mtight">32</span></span></span></span></span></span></span></span></span></span></span></span> (both inclusive) and can be defined by an arithmetic expression using <code>+</code>, <code>-</code>, <code>*</code>, <code>/</code>, <code>//</code>, <code>(</code>, <code>)</code> operators and references to the previously defined constants. Here <code>/</code> is a field division and <code>//</code> is an integer division. Note that the arithmetic expression cannot contain spaces.</p>
<pre><code>use.std::math::u64
Expand Down Expand Up @@ -877,6 +877,11 @@ <h3 id="assertions-and-tests"><a class="header" href="#assertions-and-tests">Ass
<tr><td>assert_eqw <br> - <em>(11 cycles)</em></td><td>[B, A, ...]</td><td>[...]</td><td>If <span class="katex"><span class="katex-html" aria-hidden="true"><span class="base"><span class="strut" style="height:0.6833em;"></span><span class="mord mathnormal">A</span><span class="mspace" style="margin-right:0.2778em;"></span><span class="mrel">=</span><span class="mspace" style="margin-right:0.2778em;"></span></span><span class="base"><span class="strut" style="height:0.6833em;"></span><span class="mord mathnormal" style="margin-right:0.05017em;">B</span></span></span></span>, removes them from the stack. <br> Fails if <span class="katex"><span class="katex-html" aria-hidden="true"><span class="base"><span class="strut" style="height:0.8889em;vertical-align:-0.1944em;"></span><span class="mord mathnormal">A</span><span class="mspace" style="margin-right:0.2778em;"></span><span class="mrel"><span class="mrel"><span class="mord vbox"><span class="thinbox"><span class="rlap"><span class="strut" style="height:0.8889em;vertical-align:-0.1944em;"></span><span class="inner"><span class="mord"><span class="mrel"></span></span></span><span class="fix"></span></span></span></span></span><span class="mrel">=</span></span><span class="mspace" style="margin-right:0.2778em;"></span></span><span class="base"><span class="strut" style="height:0.6833em;"></span><span class="mord mathnormal" style="margin-right:0.05017em;">B</span></span></span></span></td></tr>
</tbody></table>
</div>
<p>The aboves instruction can also be parametrized with an error code which can be any 32-bit value specified either directly or via a <a href="user_docs/assembly/./code_organization.html#constants">named constant</a>. For example:</p>
<pre><code>assert.err=123
assert.err=MY_CONSTANT
</code></pre>
<p>If the error code is omitted, the default value of <span class="katex"><span class="katex-html" aria-hidden="true"><span class="base"><span class="strut" style="height:0.6444em;"></span><span class="mord">0</span></span></span></span> is assumed.</p>
<h3 id="arithmetic-and-boolean-operations"><a class="header" href="#arithmetic-and-boolean-operations">Arithmetic and Boolean operations</a></h3>
<div class="table-wrapper"><table><thead><tr><th>Instruction</th><th>Stack_input</th><th>Stack_output</th><th>Notes</th></tr></thead><tbody>
<tr><td>add <br> - <em>(1 cycle)</em> <br> add.<em>b</em> <br> - <em>(1-2 cycle)</em></td><td>[b, a, ...]</td><td>[c, ...]</td><td><span class="katex"><span class="katex-html" aria-hidden="true"><span class="base"><span class="strut" style="height:0.4306em;"></span><span class="mord mathnormal">c</span><span class="mspace" style="margin-right:0.2778em;"></span><span class="mrel">←</span><span class="mspace" style="margin-right:0.2778em;"></span></span><span class="base"><span class="strut" style="height:1em;vertical-align:-0.25em;"></span><span class="mopen">(</span><span class="mord mathnormal">a</span><span class="mspace" style="margin-right:0.2222em;"></span><span class="mbin">+</span><span class="mspace" style="margin-right:0.2222em;"></span></span><span class="base"><span class="strut" style="height:1em;vertical-align:-0.25em;"></span><span class="mord mathnormal">b</span><span class="mclose">)</span><span class="mspace allowbreak"></span><span class="mspace" style="margin-right:0.6667em;"></span></span><span class="base"><span class="strut" style="height:0.8889em;vertical-align:-0.1944em;"></span><span class="mord"><span class="mord"><span class="mord mathrm">mod</span></span></span><span class="mspace" style="margin-right:0.1667em;"></span><span class="mspace" style="margin-right:0.1667em;"></span><span class="mord mathnormal">p</span></span></span></span></td></tr>
Expand Down
2 changes: 1 addition & 1 deletion searchindex.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion searchindex.json

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion user_docs/assembly/code_organization.html
Original file line number Diff line number Diff line change
Expand Up @@ -266,7 +266,7 @@ <h4 id="re-exporting-procedures"><a class="header" href="#re-exporting-procedure
</code></pre>
<p>In addition to the locally-defined procedure <code>foo</code>, the above module also exports procedures <code>add</code> and <code>mul64</code> implementations of which will be identical to <code>add</code> and <code>mul</code> procedures from the <code>std::math::u64</code> module respectively.</p>
<h3 id="constants"><a class="header" href="#constants">Constants</a></h3>
<p>Miden assembly supports constant declarations. These constants are scoped to the module they are defined in and can be used as immediate parameters for Miden assembly instructions. Constants are supported as immediate values for the following instructions: <code>push</code>, <code>locaddr</code>, <code>loc_load</code>, <code>loc_loadw</code>, <code>loc_store</code>, <code>loc_storew</code>, <code>mem_load</code>, <code>mem_loadw</code>, <code>mem_store</code>, <code>mem_storew</code>.</p>
<p>Miden assembly supports constant declarations. These constants are scoped to the module they are defined in and can be used as immediate parameters for Miden assembly instructions. Constants are supported as immediate values for the following instructions: <code>push</code>, <code>assert</code>, <code>assertz</code>, <code>asert_eq</code>, <code>assert_eqw</code>, <code>locaddr</code>, <code>loc_load</code>, <code>loc_loadw</code>, <code>loc_store</code>, <code>loc_storew</code>, <code>mem_load</code>, <code>mem_loadw</code>, <code>mem_store</code>, <code>mem_storew</code>.</p>
<p>Constants must be declared right after module imports and before any procedures or program bodies. A constant's name must start with an upper-case letter and can contain any combination of numbers, upper-case ASCII letters, and underscores (<code>_</code>). The number of characters in a constant name cannot exceed 100. </p>
<p>A constant's value must be in the range between <span class="katex"><span class="katex-html" aria-hidden="true"><span class="base"><span class="strut" style="height:0.6444em;"></span><span class="mord">0</span></span></span></span> and <span class="katex"><span class="katex-html" aria-hidden="true"><span class="base"><span class="strut" style="height:0.8974em;vertical-align:-0.0833em;"></span><span class="mord"><span class="mord">2</span><span class="msupsub"><span class="vlist-t"><span class="vlist-r"><span class="vlist" style="height:0.8141em;"><span style="top:-3.063em;margin-right:0.05em;"><span class="pstrut" style="height:2.7em;"></span><span class="sizing reset-size6 size3 mtight"><span class="mord mtight"><span class="mord mtight">64</span></span></span></span></span></span></span></span></span><span class="mspace" style="margin-right:0.2222em;"></span><span class="mbin"></span><span class="mspace" style="margin-right:0.2222em;"></span></span><span class="base"><span class="strut" style="height:0.8141em;"></span><span class="mord"><span class="mord">2</span><span class="msupsub"><span class="vlist-t"><span class="vlist-r"><span class="vlist" style="height:0.8141em;"><span style="top:-3.063em;margin-right:0.05em;"><span class="pstrut" style="height:2.7em;"></span><span class="sizing reset-size6 size3 mtight"><span class="mord mtight"><span class="mord mtight">32</span></span></span></span></span></span></span></span></span></span></span></span> (both inclusive) and can be defined by an arithmetic expression using <code>+</code>, <code>-</code>, <code>*</code>, <code>/</code>, <code>//</code>, <code>(</code>, <code>)</code> operators and references to the previously defined constants. Here <code>/</code> is a field division and <code>//</code> is an integer division. Note that the arithmetic expression cannot contain spaces.</p>
<pre><code>use.std::math::u64
Expand Down
5 changes: 5 additions & 0 deletions user_docs/assembly/field_operations.html
Original file line number Diff line number Diff line change
Expand Up @@ -182,6 +182,11 @@ <h3 id="assertions-and-tests"><a class="header" href="#assertions-and-tests">Ass
<tr><td>assert_eqw <br> - <em>(11 cycles)</em></td><td>[B, A, ...]</td><td>[...]</td><td>If <span class="katex"><span class="katex-html" aria-hidden="true"><span class="base"><span class="strut" style="height:0.6833em;"></span><span class="mord mathnormal">A</span><span class="mspace" style="margin-right:0.2778em;"></span><span class="mrel">=</span><span class="mspace" style="margin-right:0.2778em;"></span></span><span class="base"><span class="strut" style="height:0.6833em;"></span><span class="mord mathnormal" style="margin-right:0.05017em;">B</span></span></span></span>, removes them from the stack. <br> Fails if <span class="katex"><span class="katex-html" aria-hidden="true"><span class="base"><span class="strut" style="height:0.8889em;vertical-align:-0.1944em;"></span><span class="mord mathnormal">A</span><span class="mspace" style="margin-right:0.2778em;"></span><span class="mrel"><span class="mrel"><span class="mord vbox"><span class="thinbox"><span class="rlap"><span class="strut" style="height:0.8889em;vertical-align:-0.1944em;"></span><span class="inner"><span class="mord"><span class="mrel"></span></span></span><span class="fix"></span></span></span></span></span><span class="mrel">=</span></span><span class="mspace" style="margin-right:0.2778em;"></span></span><span class="base"><span class="strut" style="height:0.6833em;"></span><span class="mord mathnormal" style="margin-right:0.05017em;">B</span></span></span></span></td></tr>
</tbody></table>
</div>
<p>The aboves instruction can also be parametrized with an error code which can be any 32-bit value specified either directly or via a <a href="./code_organization.html#constants">named constant</a>. For example:</p>
<pre><code>assert.err=123
assert.err=MY_CONSTANT
</code></pre>
<p>If the error code is omitted, the default value of <span class="katex"><span class="katex-html" aria-hidden="true"><span class="base"><span class="strut" style="height:0.6444em;"></span><span class="mord">0</span></span></span></span> is assumed.</p>
<h3 id="arithmetic-and-boolean-operations"><a class="header" href="#arithmetic-and-boolean-operations">Arithmetic and Boolean operations</a></h3>
<div class="table-wrapper"><table><thead><tr><th>Instruction</th><th>Stack_input</th><th>Stack_output</th><th>Notes</th></tr></thead><tbody>
<tr><td>add <br> - <em>(1 cycle)</em> <br> add.<em>b</em> <br> - <em>(1-2 cycle)</em></td><td>[b, a, ...]</td><td>[c, ...]</td><td><span class="katex"><span class="katex-html" aria-hidden="true"><span class="base"><span class="strut" style="height:0.4306em;"></span><span class="mord mathnormal">c</span><span class="mspace" style="margin-right:0.2778em;"></span><span class="mrel"></span><span class="mspace" style="margin-right:0.2778em;"></span></span><span class="base"><span class="strut" style="height:1em;vertical-align:-0.25em;"></span><span class="mopen">(</span><span class="mord mathnormal">a</span><span class="mspace" style="margin-right:0.2222em;"></span><span class="mbin">+</span><span class="mspace" style="margin-right:0.2222em;"></span></span><span class="base"><span class="strut" style="height:1em;vertical-align:-0.25em;"></span><span class="mord mathnormal">b</span><span class="mclose">)</span><span class="mspace allowbreak"></span><span class="mspace" style="margin-right:0.6667em;"></span></span><span class="base"><span class="strut" style="height:0.8889em;vertical-align:-0.1944em;"></span><span class="mord"><span class="mord"><span class="mord mathrm">mod</span></span></span><span class="mspace" style="margin-right:0.1667em;"></span><span class="mspace" style="margin-right:0.1667em;"></span><span class="mord mathnormal">p</span></span></span></span></td></tr>
Expand Down

0 comments on commit c219143

Please sign in to comment.