Minor updates
diff --git a/eclipse-tools/model-transformation/examples/amlt2inchron/org.eclipse.app4mc.transform.to.inchron.m2m/src/templates/m2m/hw/FrequencyDomainTransformer.xtend b/eclipse-tools/model-transformation/examples/amlt2inchron/org.eclipse.app4mc.transform.to.inchron.m2m/src/templates/m2m/hw/FrequencyDomainTransformer.xtend
index ff87af9..79c210c 100644
--- a/eclipse-tools/model-transformation/examples/amlt2inchron/org.eclipse.app4mc.transform.to.inchron.m2m/src/templates/m2m/hw/FrequencyDomainTransformer.xtend
+++ b/eclipse-tools/model-transformation/examples/amlt2inchron/org.eclipse.app4mc.transform.to.inchron.m2m/src/templates/m2m/hw/FrequencyDomainTransformer.xtend
@@ -4,6 +4,7 @@
import javax.inject.Inject
import org.eclipse.app4mc.amalthea.model.FrequencyDomain
import templates.AbstractAmaltheaInchronTransformer
+import templates.m2m.utils.FrequencyTransformer
import templates.utils.AmltCacheModel
class FrequencyDomainTransformer extends AbstractAmaltheaInchronTransformer {
diff --git a/eclipse-tools/model-transformation/examples/amlt2inchron/org.eclipse.app4mc.transform.to.inchron.m2m/src/templates/m2m/stimuli/StimuliTransformer.xtend b/eclipse-tools/model-transformation/examples/amlt2inchron/org.eclipse.app4mc.transform.to.inchron.m2m/src/templates/m2m/stimuli/StimuliTransformer.xtend
index 3beb82d..de16557 100644
--- a/eclipse-tools/model-transformation/examples/amlt2inchron/org.eclipse.app4mc.transform.to.inchron.m2m/src/templates/m2m/stimuli/StimuliTransformer.xtend
+++ b/eclipse-tools/model-transformation/examples/amlt2inchron/org.eclipse.app4mc.transform.to.inchron.m2m/src/templates/m2m/stimuli/StimuliTransformer.xtend
@@ -6,14 +6,14 @@
import org.eclipse.app4mc.amalthea.model.StimuliModel
import org.eclipse.app4mc.amalthea.model.Stimulus
import templates.AbstractAmaltheaInchronTransformer
-import templates.m2m.utils.TimeUtilsTransformer
import templates.utils.AmltCacheModel
+import templates.m2m.utils.TimeTransformer
class StimuliTransformer extends AbstractAmaltheaInchronTransformer {
var AmltCacheModel cacheModel
- @Inject TimeUtilsTransformer timeUtilsTransformer
+ @Inject TimeTransformer timeUtilsTransformer
def transformStimuliModel(StimuliModel amltStimuliModel, Model inchronModel) {
diff --git a/eclipse-tools/model-transformation/examples/amlt2inchron/org.eclipse.app4mc.transform.to.inchron.m2m/src/templates/m2m/sw/SWTransformer.xtend b/eclipse-tools/model-transformation/examples/amlt2inchron/org.eclipse.app4mc.transform.to.inchron.m2m/src/templates/m2m/sw/SWTransformer.xtend
index c37a8a7..9053c49 100644
--- a/eclipse-tools/model-transformation/examples/amlt2inchron/org.eclipse.app4mc.transform.to.inchron.m2m/src/templates/m2m/sw/SWTransformer.xtend
+++ b/eclipse-tools/model-transformation/examples/amlt2inchron/org.eclipse.app4mc.transform.to.inchron.m2m/src/templates/m2m/sw/SWTransformer.xtend
@@ -31,54 +31,48 @@
val inchronScheduler_amltSchedulerMap = cacheModel.getInchronScheduler_amltSchedulerMap()
- inchronScheduler_amltSchedulerMap.keySet.forEach [ inchronScheduler |
- {
- var amltScheduler = inchronScheduler_amltSchedulerMap.get(inchronScheduler)
+ inchronScheduler_amltSchedulerMap.forEach [ inchronScheduler, amltScheduler |
- if (amltScheduler !== null) {
+ if (amltScheduler !== null) {
- var amltOS = amltScheduler.eContainer as OperatingSystem
+ var amltOS = amltScheduler.eContainer as OperatingSystem
+ val inchronComponent = cacheModel.getInchronComponent(amltOS.name + "_SWC")
- val inchronComponent = cacheModel.getInchronComponent(amltOS.name + "_SWC")
+ if (amltScheduler instanceof TaskScheduler) {
+ amltScheduler.taskAllocations.forEach [ amltTaskAllocation |
- if (amltScheduler instanceof TaskScheduler) {
- amltScheduler.taskAllocations.forEach [ amltTaskAllocation |
+ var amltTask = amltTaskAllocation.task
- var amltTask = amltTaskAllocation.task
+ val inchronProcess = taskTransformer.createProcess(amltTask, inchronComponent)
- val inchronProcess = taskTransformer.createProcess(amltTask, inchronComponent)
+ amltProcess_inchronProcessMap.put(amltTask, inchronProcess)
- amltProcess_inchronProcessMap.put(amltTask, inchronProcess)
-
- amltTaskAllocation.affinity.forEach [ amltPU |
- {
- var inchronCpuCore = cacheModel.getInchronCpuCore(amltPU.name)
- if (inchronCpuCore !== null) {
- inchronProcess.cpuCores.add(inchronCpuCore)
- }
+ amltTaskAllocation.affinity.forEach [ amltPU |
+ {
+ var inchronCpuCore = cacheModel.getInchronCpuCore(amltPU.name)
+ if (inchronCpuCore !== null) {
+ inchronProcess.cpuCores.add(inchronCpuCore)
}
- ]
-
- inchronScheduler.schedulables.add(inchronProcess)
+ }
]
- } else if (amltScheduler instanceof InterruptController) {
- amltScheduler.isrAllocations.forEach [ amltISRAllocation |
- var amltISR = amltISRAllocation.isr
- val inchronProcess = isrTransformer.createProcess(amltISR, inchronComponent)
+ inchronScheduler.schedulables.add(inchronProcess)
+ ]
+ } else if (amltScheduler instanceof InterruptController) {
- amltProcess_inchronProcessMap.put(amltISR, inchronProcess)
+ amltScheduler.isrAllocations.forEach [ amltISRAllocation |
+ var amltISR = amltISRAllocation.isr
+ val inchronProcess = isrTransformer.createProcess(amltISR, inchronComponent)
- inchronScheduler.schedulables.add(inchronProcess)
- ]
- }
+ amltProcess_inchronProcessMap.put(amltISR, inchronProcess)
+
+ inchronScheduler.schedulables.add(inchronProcess)
+ ]
}
}
-
]
- for (amltProcess : amltProcess_inchronProcessMap.keySet) {
- var inchronProcess = amltProcess_inchronProcessMap.get(amltProcess)
+ amltProcess_inchronProcessMap.forEach [ amltProcess, inchronProcess |
amltProcess?.callGraph?.graphEntries?.forEach [ amltGraphEntry |
graphEntryBaseTransformer.transformGraphEntryBase(amltGraphEntry, amltProcess,
@@ -94,9 +88,9 @@
inchronActivateProcess.target = amltProcess_inchronProcessMap.get(amltProcess)
inchronActivationConnection?.activations?.add(inchronActivateProcess)
-
]
- }
+ ]
}
+
}
diff --git a/eclipse-tools/model-transformation/examples/amlt2inchron/org.eclipse.app4mc.transform.to.inchron.m2m/src/templates/m2m/sw/runnableItem/TicksTransformer.xtend b/eclipse-tools/model-transformation/examples/amlt2inchron/org.eclipse.app4mc.transform.to.inchron.m2m/src/templates/m2m/sw/runnableItem/TicksTransformer.xtend
index 07f902d..054203c 100644
--- a/eclipse-tools/model-transformation/examples/amlt2inchron/org.eclipse.app4mc.transform.to.inchron.m2m/src/templates/m2m/sw/runnableItem/TicksTransformer.xtend
+++ b/eclipse-tools/model-transformation/examples/amlt2inchron/org.eclipse.app4mc.transform.to.inchron.m2m/src/templates/m2m/sw/runnableItem/TicksTransformer.xtend
@@ -13,7 +13,7 @@
import org.eclipse.app4mc.amalthea.model.util.RuntimeUtil.TimeType
import org.eclipse.emf.ecore.util.EcoreUtil
import templates.AbstractAmaltheaInchronTransformer
-import templates.m2m.utils.TimeUtilsTransformer
+import templates.m2m.utils.TimeTransformer
class TicksTransformer extends AbstractAmaltheaInchronTransformer {
@@ -27,7 +27,7 @@
def create inchronModelFactory.createTimeDistribution createTimeDistribution(Process amltTask, Ticks amltTicks) {
- val timeUtils = new TimeUtilsTransformer
+ val timeUtils = new TimeTransformer
var amltCores = DeploymentUtil.getAssignedCoreForProcess(amltTask,
EcoreUtil.getRootContainer(amltTask) as Amalthea);
diff --git a/eclipse-tools/model-transformation/examples/amlt2inchron/org.eclipse.app4mc.transform.to.inchron.m2m/src/templates/m2m/hw/FrequencyTransformer.xtend b/eclipse-tools/model-transformation/examples/amlt2inchron/org.eclipse.app4mc.transform.to.inchron.m2m/src/templates/m2m/utils/FrequencyTransformer.xtend
similarity index 60%
rename from eclipse-tools/model-transformation/examples/amlt2inchron/org.eclipse.app4mc.transform.to.inchron.m2m/src/templates/m2m/hw/FrequencyTransformer.xtend
rename to eclipse-tools/model-transformation/examples/amlt2inchron/org.eclipse.app4mc.transform.to.inchron.m2m/src/templates/m2m/utils/FrequencyTransformer.xtend
index c57a9c4..4ab8ca9 100644
--- a/eclipse-tools/model-transformation/examples/amlt2inchron/org.eclipse.app4mc.transform.to.inchron.m2m/src/templates/m2m/hw/FrequencyTransformer.xtend
+++ b/eclipse-tools/model-transformation/examples/amlt2inchron/org.eclipse.app4mc.transform.to.inchron.m2m/src/templates/m2m/utils/FrequencyTransformer.xtend
@@ -1,4 +1,4 @@
-package templates.m2m.hw
+package templates.m2m.utils
import com.inchron.realtime.root.model.FrequencyUnit
import org.eclipse.app4mc.amalthea.model.Frequency
@@ -6,9 +6,9 @@
class FrequencyTransformer extends AbstractAmaltheaInchronTransformer {
- public def create inchronModelFactory.createFrequency createFrequency(Frequency amltFrequency) {
+ def create inchronModelFactory.createFrequency createFrequency(Frequency amltFrequency) {
- it.value = amltFrequency?.value.floatValue
+ it.value = if(amltFrequency !== null) amltFrequency.value.floatValue else 0
it.unit = FrequencyUnit.getByName(amltFrequency?.unit.getName)
diff --git a/eclipse-tools/model-transformation/examples/amlt2inchron/org.eclipse.app4mc.transform.to.inchron.m2m/src/templates/m2m/utils/TimeTransformer.xtend b/eclipse-tools/model-transformation/examples/amlt2inchron/org.eclipse.app4mc.transform.to.inchron.m2m/src/templates/m2m/utils/TimeTransformer.xtend
new file mode 100644
index 0000000..bffb83c
--- /dev/null
+++ b/eclipse-tools/model-transformation/examples/amlt2inchron/org.eclipse.app4mc.transform.to.inchron.m2m/src/templates/m2m/utils/TimeTransformer.xtend
@@ -0,0 +1,29 @@
+package templates.m2m.utils;
+
+import org.eclipse.app4mc.amalthea.model.Time
+import templates.AbstractAmaltheaInchronTransformer
+
+class TimeTransformer extends AbstractAmaltheaInchronTransformer {
+
+ def create inchronModelFactory.createTime createTime(Time amltTime) {
+
+ val amltValue = amltTime?.value
+ it.value = if(amltValue !== null) amltValue.longValue else 0;
+
+ switch (amltTime?.unit) {
+ case S:
+ it.unit = com.inchron.realtime.root.model.TimeUnit.S
+ case MS:
+ it.unit = com.inchron.realtime.root.model.TimeUnit.MS
+ case US:
+ it.unit = com.inchron.realtime.root.model.TimeUnit.US
+ case NS:
+ it.unit = com.inchron.realtime.root.model.TimeUnit.NS
+ case PS:
+ it.unit = com.inchron.realtime.root.model.TimeUnit.PS
+ case _UNDEFINED_:
+ it.unit = com.inchron.realtime.root.model.TimeUnit.PS
+ }
+ }
+
+}
diff --git a/eclipse-tools/model-transformation/examples/amlt2inchron/org.eclipse.app4mc.transform.to.inchron.m2m/src/templates/m2m/utils/TimeUtilsTransformer.xtend b/eclipse-tools/model-transformation/examples/amlt2inchron/org.eclipse.app4mc.transform.to.inchron.m2m/src/templates/m2m/utils/TimeUtilsTransformer.xtend
deleted file mode 100644
index 61658b5..0000000
--- a/eclipse-tools/model-transformation/examples/amlt2inchron/org.eclipse.app4mc.transform.to.inchron.m2m/src/templates/m2m/utils/TimeUtilsTransformer.xtend
+++ /dev/null
@@ -1,32 +0,0 @@
-package templates.m2m.utils;
-
-import com.inchron.realtime.root.model.TimeUnit
-import org.eclipse.app4mc.amalthea.model.Time
-import templates.AbstractAmaltheaInchronTransformer
-
-class TimeUtilsTransformer extends AbstractAmaltheaInchronTransformer {
-
- def create inchronModelFactory.createTime createTime(Time amltTime) {
-
- it.value = amltTime?.value?.longValue
-
- switch (amltTime?.unit.getName) {
- case "s": {
- it.unit = TimeUnit.S
- }
- case "ms": {
- it.unit = TimeUnit.MS
- }
- case "us": {
- it.unit = TimeUnit.US
- }
- case "ns": {
- it.unit = TimeUnit.NS
- }
- case "ps": {
- it.unit = TimeUnit.PS
- }
- }
- }
-
-}