diff --git a/docs/assets/code/c/src/BankIndex.lf b/docs/assets/code/c/src/BankIndex.lf index 6a0d32cb9..4c6481c1e 100644 --- a/docs/assets/code/c/src/BankIndex.lf +++ b/docs/assets/code/c/src/BankIndex.lf @@ -1,12 +1,11 @@ target C; -preamble {= - int table[] = {4, 3, 2, 1}; -=} reactor A(bank_index:int = 0, value:int = 0) { reaction (startup) {= printf("bank_index: %d, value: %d\n", self->bank_index, self->value); =} } -main reactor { - a = new[4] A(value = {= table[bank_index] =}); +main reactor( + table: int[] = {4, 3, 2, 1} +) { + a = new[4] A(value = {= self->table[bank_index] =}); } diff --git a/docs/assets/code/py/src/BankIndex.lf b/docs/assets/code/py/src/BankIndex.lf index 2c3dc2c37..102731ac6 100644 --- a/docs/assets/code/py/src/BankIndex.lf +++ b/docs/assets/code/py/src/BankIndex.lf @@ -1,12 +1,11 @@ target Python; -preamble {= - table = [4, 3, 2, 1] -=} reactor A(bank_index = 0, value = 0) { reaction (startup) {= print("bank_index: {:d}, value: {:d}".format(self.bank_index, self.value)) =} } -main reactor { - a = new[4] A(value = {= table[bank_index] =}) +main reactor( + table = [4, 3, 2, 1] +) { + a = new[4] A(value = {= self.table[bank_index] =}) } diff --git a/docs/writing-reactors/multiports-and-banks.mdx b/docs/writing-reactors/multiports-and-banks.mdx index 0cf169b36..4dc97459f 100644 --- a/docs/writing-reactors/multiports-and-banks.mdx +++ b/docs/writing-reactors/multiports-and-banks.mdx @@ -199,7 +199,7 @@ import Py_BankIndex from '../assets/code/py/src/BankIndex.lf'; -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: +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: ``` bank_index: 0, value: 4 diff --git a/versioned_docs/version-0.8.0/assets/code/c/src/BankIndex.lf b/versioned_docs/version-0.8.0/assets/code/c/src/BankIndex.lf index 6a0d32cb9..4c6481c1e 100644 --- a/versioned_docs/version-0.8.0/assets/code/c/src/BankIndex.lf +++ b/versioned_docs/version-0.8.0/assets/code/c/src/BankIndex.lf @@ -1,12 +1,11 @@ target C; -preamble {= - int table[] = {4, 3, 2, 1}; -=} reactor A(bank_index:int = 0, value:int = 0) { reaction (startup) {= printf("bank_index: %d, value: %d\n", self->bank_index, self->value); =} } -main reactor { - a = new[4] A(value = {= table[bank_index] =}); +main reactor( + table: int[] = {4, 3, 2, 1} +) { + a = new[4] A(value = {= self->table[bank_index] =}); } diff --git a/versioned_docs/version-0.8.0/writing-reactors/multiports-and-banks.mdx b/versioned_docs/version-0.8.0/writing-reactors/multiports-and-banks.mdx index 91e12e0dd..f04a045ba 100644 --- a/versioned_docs/version-0.8.0/writing-reactors/multiports-and-banks.mdx +++ b/versioned_docs/version-0.8.0/writing-reactors/multiports-and-banks.mdx @@ -199,7 +199,12 @@ import Py_BankIndex from '../assets/code/py/src/BankIndex.lf'; + 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: + + +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: + ``` bank_index: 0, value: 4