added HWModel transformation (Amalthea to Inchron)
diff --git a/eclipse-tools/model-transformation/examples/amlt2inchron/org.eclipse.app4mc.transform.to.inchron.m2m/src/templates/m2m/hw/HWStructure_MicroControllerTransformer.xtend b/eclipse-tools/model-transformation/examples/amlt2inchron/org.eclipse.app4mc.transform.to.inchron.m2m/src/templates/m2m/hw/HWStructure_MicroControllerTransformer.xtend
index da4a555..03bf32a 100644
--- a/eclipse-tools/model-transformation/examples/amlt2inchron/org.eclipse.app4mc.transform.to.inchron.m2m/src/templates/m2m/hw/HWStructure_MicroControllerTransformer.xtend
+++ b/eclipse-tools/model-transformation/examples/amlt2inchron/org.eclipse.app4mc.transform.to.inchron.m2m/src/templates/m2m/hw/HWStructure_MicroControllerTransformer.xtend
@@ -4,7 +4,9 @@
import org.eclipse.app4mc.amalthea.model.Cache
import org.eclipse.app4mc.amalthea.model.HwStructure
import org.eclipse.app4mc.amalthea.model.Memory
+import org.eclipse.app4mc.amalthea.model.ProcessingUnit
import templates.AbstractAmaltheaInchronTransformer
+import templates.utils.AmltCacheModel
class HWStructure_MicroControllerTransformer extends AbstractAmaltheaInchronTransformer{
@@ -12,10 +14,14 @@
@Inject CacheTransformer cacheTransformer
+ @Inject ProcessingUnitTransformer processingUnitTransformer
+
public def create inchronModelFactory.createCpu createCpu(HwStructure amltHWMicroController){
it.name=amltHWMicroController.name
+ val AmltCacheModel cacheModel=customObjsStore.getInstance(AmltCacheModel)
+
amltHWMicroController.modules.forEach[
amltHwModule|{
if(amltHwModule instanceof Memory){
@@ -48,5 +54,25 @@
+
+
+ //Creation of Cores
+
+ val amltModules = amltHWMicroController.modules
+
+ amltModules.forEach[amltHwModule|
+ {
+ if(amltHwModule instanceof ProcessingUnit){
+ it.cores.add(processingUnitTransformer.createCpuCore(amltHwModule))
+ //TODO: creation of dummy Clock (Frequency) and associating it to Cpu
+
+ it.clock=cacheModel.getInchronClock(amltHwModule?.frequencyDomain?.name)
+
+ }
+
+ }
+ ]
+
+
}
}
\ No newline at end of file
diff --git a/eclipse-tools/model-transformation/examples/amlt2inchron/org.eclipse.app4mc.transform.to.inchron.m2m/src/templates/m2m/hw/MemoryTransformer.xtend b/eclipse-tools/model-transformation/examples/amlt2inchron/org.eclipse.app4mc.transform.to.inchron.m2m/src/templates/m2m/hw/MemoryTransformer.xtend
index 05d1654..81f0e58 100644
--- a/eclipse-tools/model-transformation/examples/amlt2inchron/org.eclipse.app4mc.transform.to.inchron.m2m/src/templates/m2m/hw/MemoryTransformer.xtend
+++ b/eclipse-tools/model-transformation/examples/amlt2inchron/org.eclipse.app4mc.transform.to.inchron.m2m/src/templates/m2m/hw/MemoryTransformer.xtend
@@ -1,6 +1,5 @@
package templates.m2m.hw
-import com.google.inject.Inject
import java.math.BigInteger
import org.eclipse.app4mc.amalthea.model.AmaltheaServices
import org.eclipse.app4mc.amalthea.model.Memory
@@ -9,7 +8,7 @@
class MemoryTransformer extends AbstractAmaltheaInchronTransformer{
- @Inject FrequencyDomainTransformer frequencyDomainTransformer
+// @Inject FrequencyDomainTransformer frequencyDomainTransformer
public def create inchronmemoryFactory.createMemory createMemory(Memory amltMemory ){
@@ -31,7 +30,7 @@
it.prescaler=1d
- //DataRate element is ignored
+ cacheModel.addInchronMemory(it)
}
//TODO: set the right type of the Memory
}
\ No newline at end of file
diff --git a/eclipse-tools/model-transformation/examples/amlt2inchron/org.eclipse.app4mc.transform.to.inchron.m2m/src/templates/m2m/hw/ProcessingUnitTransformer.xtend b/eclipse-tools/model-transformation/examples/amlt2inchron/org.eclipse.app4mc.transform.to.inchron.m2m/src/templates/m2m/hw/ProcessingUnitTransformer.xtend
index 754b628..df8a9bb 100644
--- a/eclipse-tools/model-transformation/examples/amlt2inchron/org.eclipse.app4mc.transform.to.inchron.m2m/src/templates/m2m/hw/ProcessingUnitTransformer.xtend
+++ b/eclipse-tools/model-transformation/examples/amlt2inchron/org.eclipse.app4mc.transform.to.inchron.m2m/src/templates/m2m/hw/ProcessingUnitTransformer.xtend
@@ -1,7 +1,18 @@
package templates.m2m.hw
+import org.eclipse.app4mc.amalthea.model.ProcessingUnit
import templates.AbstractAmaltheaInchronTransformer
+import templates.utils.AmltCacheModel
class ProcessingUnitTransformer extends AbstractAmaltheaInchronTransformer{
+ public def create inchronModelFactory.createCpuCore createCpuCore(ProcessingUnit amltProcessingUnit){
+ val AmltCacheModel cacheModel=customObjsStore.getInstance(AmltCacheModel)
+
+ it.name=amltProcessingUnit.name
+
+ it.prescaler=1
+
+ cacheModel.addInchronCpuCore(it)
+ }
}
\ No newline at end of file
diff --git a/eclipse-tools/model-transformation/examples/amlt2inchron/org.eclipse.app4mc.transform.to.inchron.m2m/src/templates/utils/AmltCacheModel.java b/eclipse-tools/model-transformation/examples/amlt2inchron/org.eclipse.app4mc.transform.to.inchron.m2m/src/templates/utils/AmltCacheModel.java
index ed08b39..36ee47c 100644
--- a/eclipse-tools/model-transformation/examples/amlt2inchron/org.eclipse.app4mc.transform.to.inchron.m2m/src/templates/utils/AmltCacheModel.java
+++ b/eclipse-tools/model-transformation/examples/amlt2inchron/org.eclipse.app4mc.transform.to.inchron.m2m/src/templates/utils/AmltCacheModel.java
@@ -15,7 +15,6 @@
package templates.utils;
import java.util.ArrayList;
-import java.util.Collection;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@@ -33,14 +32,22 @@
import com.inchron.realtime.root.model.ActivationConnection;
import com.inchron.realtime.root.model.Clock;
+import com.inchron.realtime.root.model.CpuCore;
import com.inchron.realtime.root.model.GenericSystem;
import com.inchron.realtime.root.model.Semaphore;
+import com.inchron.realtime.root.model.memory.Memory;
public class AmltCacheModel {
private Map<String, Clock> inchronClocksMap = new HashMap<>();
+ private Map<String,Memory> inchronMemoriesMap = new HashMap<>();
+
+ private Map<String,CpuCore> inchronCpuCoresMap = new HashMap<>();
+
+
+
private Map<HwStructure, GenericSystem> mappingAmltMicroController_GenericSystem = new HashMap<>();
private Map<Scheduler, SchedulerAllocation> taskScheduler_schedulerAllocationMap=new HashMap<Scheduler, SchedulerAllocation>();
@@ -219,11 +226,32 @@
}
- public void addInchronClock(Clock inchronClock) {
- inchronClocksMap.put(inchronClock.getName(), inchronClock);
+ public void addInchronClock(Clock obj) {
+ inchronClocksMap.put(obj.getName(), obj);
}
public Clock getInchronClock(String name) {
return inchronClocksMap.get(name);
}
+
+
+
+
+
+ public void addInchronMemory(Memory inchronMemory) {
+ inchronMemoriesMap.put(inchronMemory.getName(), inchronMemory);
+ }
+
+ public Memory getInchronMemory(String name) {
+ return inchronMemoriesMap.get(name);
+ }
+
+
+ public void addInchronCpuCore(CpuCore cpuCore) {
+ inchronCpuCoresMap.put(cpuCore.getName(), cpuCore);
+ }
+
+ public CpuCore getInchronCpuCore(String name) {
+ return inchronCpuCoresMap.get(name);
+ }
}