Skip to content

Commit

Permalink
sccharts: Improved handling of signals in dataflow regions
Browse files Browse the repository at this point in the history
  • Loading branch information
a-sr committed Aug 22, 2024
1 parent 27e5ae2 commit df3b732
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
package de.cau.cs.kieler.sccharts.processors

import com.google.inject.Inject
import de.cau.cs.kieler.annotations.extensions.AnnotationsExtensions
import de.cau.cs.kieler.kexpressions.CombineOperator
import de.cau.cs.kieler.kexpressions.OperatorExpression
import de.cau.cs.kieler.kexpressions.OperatorType
Expand Down Expand Up @@ -90,6 +91,10 @@ class Signal extends SCChartsProcessor implements Traceable {
@Inject extension SCChartsStateExtensions
@Inject extension SCChartsActionExtensions
@Inject extension KExpressionsArrayExtensions
@Inject extension AnnotationsExtensions

// Prevents reset from being generated
static public final String NO_RESET_ANNOTATION = "NoReset"

// This prefix is used for naming of all generated signals, states and regions
static public final String GENERATED_PREFIX = "_"
Expand Down Expand Up @@ -300,7 +305,7 @@ class Signal extends SCChartsProcessor implements Traceable {

// Add a during reset action for the presentVariable if it is an output or local variable.
// Do not do this for only-input-variables.
if (!presentVariable.isInput) {
if (!presentVariable.isInput && !presentVariable.hasAnnotation(NO_RESET_ANNOTATION)) {

if (absentDuringAction === null) {
absentDuringAction = state.createDuringAction
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,10 +46,11 @@ import de.cau.cs.kieler.sccharts.extensions.SCChartsScopeExtensions
import de.cau.cs.kieler.sccharts.extensions.SCChartsStateExtensions
import de.cau.cs.kieler.sccharts.extensions.SCChartsTransitionExtensions
import de.cau.cs.kieler.sccharts.processors.SCChartsProcessor
import de.cau.cs.kieler.sccharts.processors.Signal
import org.eclipse.emf.ecore.EObject

import static extension de.cau.cs.kieler.kicool.kitt.tracing.TransformationTracing.*
import static extension de.cau.cs.kieler.kicool.kitt.tracing.TracingEcoreUtil.*
import static extension de.cau.cs.kieler.kicool.kitt.tracing.TransformationTracing.*

/**
* @author ssm
Expand Down Expand Up @@ -391,11 +392,9 @@ class Dataflow extends SCChartsProcessor {
localDeclaration.input = false
localDeclaration.output = false
if (localDeclaration.signal) {
localDeclaration.signal = false
if (localDeclaration.type != ValueType.PURE) {
environment.errors.add("Access to valued signal inputs/outputs in dataflow SCCharts not yet supported", localDeclaration, true)
}
localDeclaration.type = ValueType.BOOL
}

for (valuedObject : declaration.valuedObjects) {
Expand Down Expand Up @@ -521,6 +520,10 @@ class Dataflow extends SCChartsProcessor {
}
}
}

if (assignment.reference !== null && assignment.reference.valuedObject !== null && assignment.reference.valuedObject.signal) {
assignment.reference.valuedObject.addTagAnnotation(Signal.NO_RESET_ANNOTATION)
}
}
lastSequential = eq.value.isSequential
}
Expand Down

0 comments on commit df3b732

Please sign in to comment.