Skip to content

Commit 68f692f

Browse files
committed
Updated version 0.8 docs
1 parent a191911 commit 68f692f

File tree

2 files changed

+9
-5
lines changed

2 files changed

+9
-5
lines changed
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,11 @@
11
target C;
2-
preamble {=
3-
int table[] = {4, 3, 2, 1};
4-
=}
52
reactor A(bank_index:int = 0, value:int = 0) {
63
reaction (startup) {=
74
printf("bank_index: %d, value: %d\n", self->bank_index, self->value);
85
=}
96
}
10-
main reactor {
11-
a = new[4] A(value = {= table[bank_index] =});
7+
main reactor(
8+
table: int[] = {4, 3, 2, 1}
9+
) {
10+
a = new[4] A(value = {= self->table[bank_index] =});
1211
}

versioned_docs/version-0.8.0/writing-reactors/multiports-and-banks.mdx

+5
Original file line numberDiff line numberDiff line change
@@ -204,7 +204,12 @@ import Py_BankIndex from '../assets/code/py/src/BankIndex.lf';
204204

205205
<NoSelectorTargetCodeBlock c={C_BankIndex} py={Py_BankIndex} lf />
206206

207+
<ShowOnly py>
207208
The global `table` defined in the `preamble` is used to initialize the `value` parameter of each bank member. The result of running this is something like:
209+
</ShowOnly>
210+
<ShowOnly c>
211+
The parameter `table` defined in the `main reactor` is used to initialize the `value` parameter of each bank member. The result of running this is something like:
212+
</ShowOnly>
208213

209214
```
210215
bank_index: 0, value: 4

0 commit comments

Comments
 (0)