Skip to content

Commit

Permalink
Revise code gen for state machines
Browse files Browse the repository at this point in the history
  • Loading branch information
bocchino committed Sep 3, 2024
1 parent 1efdbe5 commit 9e67d33
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ case class ComponentStateMachines(
val smName = s.writeSymbol(smi.symbol)
val enumName = s.getName(smi.symbol)

Line.blank ::
lines(
s"""|case STATE_MACHINE_${smi.getName.toUpperCase}: {
| // Deserialize the state machine signal
Expand Down Expand Up @@ -66,8 +67,7 @@ case class ComponentStateMachines(
|
| this->m_stateMachine_${smi.getName}.update(stateMachineId, signal, data);
| break;
|}
"""
|}"""
)
}
)
Expand Down Expand Up @@ -100,6 +100,7 @@ case class ComponentStateMachines(
)
}

/** Writes the dispatch case, if any, for state machine instances */
def writeDispatch: List[Line] = {
lazy val caseBody = List.concat(
lines(
Expand All @@ -117,7 +118,7 @@ case class ComponentStateMachines(
)
lazy val caseStmt =
Line.blank ::
line(s"// Handle state machine signals ") ::
line(s"// Handle state machine signals") ::
wrapInScope(
s"case $stateMachineCppConstantName: {",
caseBody,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -487,7 +487,7 @@ namespace M {

switch (msgType) {

// Handle state machine signals
// Handle state machine signals
case STATEMACHINE_SENDSIGNALS: {

FwEnumStoreType desMsg = 0;
Expand All @@ -498,6 +498,7 @@ namespace M {
);
SmId stateMachineId = static_cast<SmId>(desMsg);
switch (stateMachineId) {

case STATE_MACHINE_SM1: {
// Deserialize the state machine signal
FwEnumStoreType desMsg = 0;
Expand Down Expand Up @@ -527,7 +528,7 @@ namespace M {
this->m_stateMachine_sm1.update(stateMachineId, signal, data);
break;
}

case STATE_MACHINE_SM2: {
// Deserialize the state machine signal
FwEnumStoreType desMsg = 0;
Expand Down Expand Up @@ -557,7 +558,7 @@ namespace M {
this->m_stateMachine_sm2.update(stateMachineId, signal, data);
break;
}

case STATE_MACHINE_SM3: {
// Deserialize the state machine signal
FwEnumStoreType desMsg = 0;
Expand Down Expand Up @@ -587,7 +588,7 @@ namespace M {
this->m_stateMachine_sm3.update(stateMachineId, signal, data);
break;
}

case STATE_MACHINE_SM4: {
// Deserialize the state machine signal
FwEnumStoreType desMsg = 0;
Expand Down Expand Up @@ -617,7 +618,7 @@ namespace M {
this->m_stateMachine_sm4.update(stateMachineId, signal, data);
break;
}

case STATE_MACHINE_SM5: {
// Deserialize the state machine signal
FwEnumStoreType desMsg = 0;
Expand Down Expand Up @@ -647,7 +648,7 @@ namespace M {
this->m_stateMachine_sm5.update(stateMachineId, signal, data);
break;
}

case STATE_MACHINE_SM6: {
// Deserialize the state machine signal
FwEnumStoreType desMsg = 0;
Expand Down Expand Up @@ -677,7 +678,6 @@ namespace M {
this->m_stateMachine_sm6.update(stateMachineId, signal, data);
break;
}

}

break;
Expand Down

0 comments on commit 9e67d33

Please sign in to comment.