Skip to content

Commit

Permalink
Trial and error...
Browse files Browse the repository at this point in the history
  • Loading branch information
erlingrj committed Sep 25, 2024
1 parent 5a2f8cd commit 08762b6
Showing 1 changed file with 12 additions and 13 deletions.
25 changes: 12 additions & 13 deletions core/src/main/java/org/lflang/generator/c/CGenerator.java
Original file line number Diff line number Diff line change
Expand Up @@ -1375,10 +1375,6 @@ private void recordBuiltinTriggers(ReactorInstance instance) {
}
}

/**
* Generate code to set up the tables used in _lf_start_time_step to decrement reference counts
* and mark outputs absent between time steps. This function puts the code into startTimeStep.
*/
/**
* Generate code to set up the tables used in _lf_start_time_step to decrement reference counts
* and mark outputs absent between time steps. This function puts the code into startTimeStep.
Expand Down Expand Up @@ -1465,11 +1461,17 @@ private void generateStartTimeStep(ReactorInstance instance) {

for (ActionInstance action : instance.actions) {
foundOne = true;
temp.startScopedBlock();
temp.pr("int count = 0; SUPPRESS_UNUSED_WARNING(count);");
temp.startScopedBlock(instance);
temp.pr(
String.join(
"\n",
"// Add action " + action.getFullName() + " to array of is_present fields.",
enclaveStruct + ".is_present_fields[" + CUtil.bankIndex(instance) + " + " + enclaveInfo.numIsPresentFields + "] ",
enclaveStruct
+ ".is_present_fields["
+ enclaveInfo.numIsPresentFields
+ " + count] ",
" = (bool *) &"
+ containerSelfStructName
+ "->_lf__"
Expand All @@ -1485,17 +1487,18 @@ private void generateStartTimeStep(ReactorInstance instance) {
"// Add action " + action.getFullName() + " to array of intended_tag fields.",
enclaveStruct
+ "._lf_intended_tag_fields["
+ CUtil.bankIndex(instance)
+ " + "
+ enclaveInfo.numIsPresentFields
+ "]",
+ " + count]",
" = &"
+ containerSelfStructName
+ "->_lf_"
+ action.getName()
+ ".intended_tag;")));

enclaveInfo.numIsPresentFields += action.getParent().getTotalWidth();
temp.pr("count++;");
temp.endScopedBlock();
temp.endScopedBlock();
enclaveInfo.numIsPresentFields += action.getParent().getTotalWidth();
}
if (foundOne) startTimeStep.pr(temp.toString());
temp = new CodeBuilder();
Expand All @@ -1518,8 +1521,6 @@ private void generateStartTimeStep(ReactorInstance instance) {
temp.pr(
enclaveStruct
+ ".is_present_fields["
+ CUtil.bankIndex(instance)
+ " + "
+ enclaveInfo.numIsPresentFields
+ " + count] = &"
+ CUtil.portRef(output)
Expand All @@ -1534,8 +1535,6 @@ private void generateStartTimeStep(ReactorInstance instance) {
"// Add port " + output.getFullName() + " to array of intended_tag fields.",
enclaveStruct
+ "._lf_intended_tag_fields["
+ CUtil.bankIndex(instance)
+ " + "
+ enclaveInfo.numIsPresentFields
+ " + count] = &"
+ CUtil.portRef(output)
Expand Down

0 comments on commit 08762b6

Please sign in to comment.