Skip to content

Commit

Permalink
fix(docs): Fix number of locals and typos
Browse files Browse the repository at this point in the history
  • Loading branch information
PhilippGackstatter committed Sep 23, 2024
1 parent dcde6d1 commit 2ef9705
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
6 changes: 3 additions & 3 deletions docs/src/user_docs/assembly/flow_control.md
Original file line number Diff line number Diff line change
Expand Up @@ -82,9 +82,9 @@ where `instructions` can be a sequence of any instructions, including nested con

1. Pops the top item from the stack.
2. If the value of the item is $1$, `instructions` in the loop body are executed.
a. After the body is executed, the stack is popped again, and if the popped value is $1$, the body is executed again.
b. If the popped value is $0$, the loop is exited.
c. If the popped value is not binary, the execution fails.
1. After the body is executed, the stack is popped again, and if the popped value is $1$, the body is executed again.
2. If the popped value is $0$, the loop is exited.
3. If the popped value is not binary, the execution fails.
3. If the value of the item is $0$, execution of loop body is skipped.
4. If the value is not binary, the execution fails.

Expand Down
4 changes: 2 additions & 2 deletions docs/src/user_docs/assembly/io_operations.md
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ Memory is guaranteed to be initialized to zeros. Thus, when reading from memory
| mem_storew <br> - *(1 cycle)* <br> mem_storew.*a* <br> - *(2-3 cycles)* | [a, A, ... ] | [A, ... ] | $A \rightarrow mem[a]$ <br> Stores the top four elements of the stack in memory at address $a$. If $a$ is provided via the stack, it is removed from the stack first. <br> Fails if $a \ge 2^{32}$ |
| mem_stream <br> - *(1 cycle)* | [C, B, A, a, ... ] | [E, D, A, a', ... ] | $[E, D] \leftarrow [mem[a], mem[a+1]]$ <br> $a' \leftarrow a + 2$ <br> Read two sequential words from memory starting at address $a$ and overwrites the first two words in the operand stack. |

The second way to access memory is via procedure locals using the instructions listed below. These instructions are available only in procedure context. The number of locals available to a given procedure must be specified at [procedure declaration](./code_organization.md#procedures) time, and trying to access more locals than was declared will result in a compile-time error. The number of locals per procedure is not limited, but the total number of locals available to all procedures at runtime must be smaller than $2^{32}$.
The second way to access memory is via procedure locals using the instructions listed below. These instructions are available only in procedure context. The number of locals available to a given procedure must be specified at [procedure declaration](./code_organization.md#procedures) time, and trying to access more locals than was declared will result in a compile-time error. A procedure can have at most $2^{16}$ locals, and the total number of locals available to all procedures at runtime is limited to $2^{30}$.

| Instruction | Stack_input | Stack_output | Notes |
| ------------------------------------ | ------------------ | ------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
Expand All @@ -85,4 +85,4 @@ The second way to access memory is via procedure locals using the instructions l

Unlike regular memory, procedure locals are not guaranteed to be initialized to zeros. Thus, when working with locals, one must assume that before a local memory address has been written to, it contains "garbage".

Internally in the VM, procedure locals are stored at memory offset stating at $2^{30}$. Thus, every procedure local has an absolute address in regular memory. The `locaddr.i` instruction is provided specifically to map an index of a procedure's local to an absolute address so that it can be passed to downstream procedures, when needed.
Internally in the VM, procedure locals are stored at memory offset starting at $2^{30}$. Thus, every procedure local has an absolute address in regular memory. The `locaddr.i` instruction is provided specifically to map an index of a procedure's local to an absolute address so that it can be passed to downstream procedures, when needed.

0 comments on commit 2ef9705

Please sign in to comment.