Some minor fixes
diff --git a/framework/examples/app4mc.example.transform.m2t/META-INF/MANIFEST.MF b/framework/examples/app4mc.example.transform.m2t/META-INF/MANIFEST.MF
index e1c5aa8..9f2bd48 100644
--- a/framework/examples/app4mc.example.transform.m2t/META-INF/MANIFEST.MF
+++ b/framework/examples/app4mc.example.transform.m2t/META-INF/MANIFEST.MF
@@ -19,6 +19,6 @@
org.osgi.service.component.annotations;version="[1.3.0,2.0.0)";resolution:=optional
Export-Package: app4mc.example.transform.m2t.transformers
Bundle-ClassPath: .
-Service-Component: OSGI-INF/app4mc.example.transform.m2t.M2TTransformationDefinition.xml,
- OSGI-INF/app4mc.example.transform.m2t.ExampleModel2TextTransformer.xml,
+Service-Component: OSGI-INF/app4mc.example.transform.m2t.ExampleModel2TextTransformer.xml,
+ OSGI-INF/app4mc.example.transform.m2t.M2TTransformationDefinition.xml,
OSGI-INF/app4mc.example.transform.m2t.transformers.ExampleGuiceModuleFactory.xml
diff --git a/framework/examples/app4mc.example.transform.product/Transformation.product b/framework/examples/app4mc.example.transform.product/Transformation.product
index b13e16a..ebadfc7 100644
--- a/framework/examples/app4mc.example.transform.product/Transformation.product
+++ b/framework/examples/app4mc.example.transform.product/Transformation.product
@@ -41,23 +41,36 @@
<plugin id="org.apache.felix.gogo.runtime"/>
<plugin id="org.apache.felix.gogo.shell"/>
<plugin id="org.apache.felix.scr"/>
+ <plugin id="org.apache.log4j"/>
<plugin id="org.eclipse.app4mc.amalthea.model"/>
<plugin id="org.eclipse.app4mc.transformation"/>
<plugin id="org.eclipse.app4mc.transformation.starter"/>
<plugin id="org.eclipse.app4mc.util.sessionlog"/>
<plugin id="org.eclipse.app4mc.util.sessionlog.console"/>
<plugin id="org.eclipse.app4mc.util.sessionlog.file"/>
+ <plugin id="org.eclipse.core.contenttype"/>
+ <plugin id="org.eclipse.core.jobs"/>
+ <plugin id="org.eclipse.core.runtime"/>
<plugin id="org.eclipse.emf.common"/>
<plugin id="org.eclipse.emf.ecore"/>
<plugin id="org.eclipse.emf.ecore.xcore.lib"/>
<plugin id="org.eclipse.emf.ecore.xmi"/>
+ <plugin id="org.eclipse.equinox.app"/>
<plugin id="org.eclipse.equinox.cm"/>
<plugin id="org.eclipse.equinox.common"/>
<plugin id="org.eclipse.equinox.console"/>
<plugin id="org.eclipse.equinox.event"/>
+ <plugin id="org.eclipse.equinox.preferences"/>
+ <plugin id="org.eclipse.equinox.region" fragment="true"/>
+ <plugin id="org.eclipse.equinox.registry"/>
+ <plugin id="org.eclipse.equinox.supplement"/>
+ <plugin id="org.eclipse.equinox.transforms.hook" fragment="true"/>
+ <plugin id="org.eclipse.equinox.weaving.hook" fragment="true"/>
<plugin id="org.eclipse.osgi"/>
+ <plugin id="org.eclipse.osgi.compatibility.state" fragment="true"/>
<plugin id="org.eclipse.osgi.services"/>
<plugin id="org.eclipse.osgi.util"/>
+ <plugin id="org.eclipse.xtext.logging" fragment="true"/>
<plugin id="org.eclipse.xtext.xbase.lib"/>
<plugin id="org.slf4j.api"/>
</plugins>
diff --git a/simulation_generator/app4mc.sim/plugins/org.eclipse.app4mc.amlt2systemc.m2t/src/org/eclipse/app4mc/amlt2systemc/m2t/transformers/AmaltheaModel2TextTransformer.java b/simulation_generator/app4mc.sim/plugins/org.eclipse.app4mc.amlt2systemc.m2t/src/org/eclipse/app4mc/amlt2systemc/m2t/transformers/AmaltheaModel2TextTransformer.java
index cf1178e..bd8b854 100644
--- a/simulation_generator/app4mc.sim/plugins/org.eclipse.app4mc.amlt2systemc.m2t/src/org/eclipse/app4mc/amlt2systemc/m2t/transformers/AmaltheaModel2TextTransformer.java
+++ b/simulation_generator/app4mc.sim/plugins/org.eclipse.app4mc.amlt2systemc.m2t/src/org/eclipse/app4mc/amlt2systemc/m2t/transformers/AmaltheaModel2TextTransformer.java
@@ -19,6 +19,7 @@
import java.nio.file.Path;
import java.nio.file.Paths;
import java.util.ArrayList;
+import java.util.Collection;
import org.eclipse.app4mc.amalthea.model.Amalthea;
import org.eclipse.app4mc.amlt2systemc.m2t.module.BaseTransformer;
@@ -45,20 +46,26 @@
this.outputBuffer.configureFiletype("INC", ".h", "// This code was generated for simulation with app4mc.sim\n\n#pragma once\n\n", null);
this.outputBuffer.configureFiletype("OTHER", "", "", "");
- ArrayList<Amalthea> amaltheas = new ArrayList<Amalthea>();
+ // collect Amalthea models
+ // for APP4MC > 1.1.0 the AmaltheaLoader has a method collectAmaltheaModels(ResourceSet resourceSet)
+
+ Collection<Amalthea> models = new ArrayList<>();
for (final Resource resource : inputResourceSet.getResources()) {
for (final EObject model : resource.getContents()) {
logger.info("Processing file : {0}", resource.getURI());
-
+
if ((model instanceof Amalthea)) {
- amaltheas.add((Amalthea) model);
+ models.add((Amalthea) model);
}
}
}
+ // if you want to check consistency of model structure:
+ // for APP4MC > 1.1.0 the method ModelStructureCheck.checkModels(...) can be used
+
//transform models
- this.amaltheaTransformer.transform(amaltheas.toArray(new Amalthea[amaltheas.size()]));
+ this.amaltheaTransformer.transform(models.toArray(new Amalthea[models.size()]));
logger.info("Generating cmake");
diff --git a/simulation_generator/app4mc.sim/plugins/org.eclipse.app4mc.amlt2systemc.m2t/src/org/eclipse/app4mc/amlt2systemc/m2t/transformers/AmaltheaTransformer.xtend b/simulation_generator/app4mc.sim/plugins/org.eclipse.app4mc.amlt2systemc.m2t/src/org/eclipse/app4mc/amlt2systemc/m2t/transformers/AmaltheaTransformer.xtend
index cd42f79..e6037f5 100644
--- a/simulation_generator/app4mc.sim/plugins/org.eclipse.app4mc.amlt2systemc.m2t/src/org/eclipse/app4mc/amlt2systemc/m2t/transformers/AmaltheaTransformer.xtend
+++ b/simulation_generator/app4mc.sim/plugins/org.eclipse.app4mc.amlt2systemc.m2t/src/org/eclipse/app4mc/amlt2systemc/m2t/transformers/AmaltheaTransformer.xtend
@@ -46,9 +46,9 @@
@Inject ProcessingUnitTransformer processingUnitTransformer
@Inject MemoryTransformer memoryTransformer
-
+
@Inject SessionLogger logger;
-
+
static def getModulePath() {
return "amaltheaTop"
}
@@ -62,9 +62,9 @@
logger.error("Input Amalthea model(s) invalid (received null).")
return
}
-
- //make sure all submodels are present in at least one input model
- //Note: chose index 0 at will, any list element would do just fine
+
+ // make sure all submodels are present in at least one input model
+ // Note: chose index 0 at will, any list element would do just fine
adjustModel(amaltheas.get(0))
swModelTransformer.transform(amaltheas.map[it.swModel])
@@ -75,9 +75,9 @@
stimuliModelTransformer.transform(amaltheas.map[it.stimuliModel])
outputBuffer.appendTo("INC", getModuleName(), toH())
- outputBuffer.appendTo("SRC", getModuleName(), toCpp())//swModels, hwModels, mappingModels, osModels, eventModels, stimuliModels))
+ outputBuffer.appendTo("SRC", getModuleName(), toCpp()) // swModels, hwModels, mappingModels, osModels, eventModels, stimuliModels))
outputBuffer.appendTo("OTHER", getModulePath() + "/CMakeLists.txt", getCMake());
-
+
}
private def void adjustModel(Amalthea amalthea) {
@@ -94,7 +94,7 @@
//top level header
'''
- private def String toCpp()'''
+ private def String toCpp() '''
#include "APP4MCsim.h"
#include "Tracer/Tracer.h"
#include "Tracer/BTFTracer.h"
@@ -122,10 +122,10 @@
//include processing units and memories for tracing -----
- «FOR tu: processingUnitTransformer.cache.values»
+ «FOR tu : processingUnitTransformer.cache.values»
#include "«tu.module».h"
«ENDFOR»
- «FOR tu: memoryTransformer.cache.values»
+ «FOR tu : memoryTransformer.cache.values»
#include "«tu.module».h"
«ENDFOR»
// tracing includes -----------------
@@ -141,27 +141,27 @@
VLOG(0) << "build simulation model";
/* Software */
«FOR obj : TuSort.byModule(swModelTransformer.cache.values)»
- «obj.call»;
+ «obj.call»;
«ENDFOR»
/* Hardware */
«FOR obj : TuSort.byModule(hwModelTransformer.cache.values)»
- «obj.call»;
+ «obj.call»;
«ENDFOR»
/* OS */
«FOR obj : TuSort.byModule(osModelTransformer.cache.values)»
- «obj.call»;
+ «obj.call»;
«ENDFOR»
/* Mapping */
«FOR obj : TuSort.byModule(mappingModelTransformer.cache.values)»
- «obj.call»;
+ «obj.call»;
«ENDFOR»
/* Event */
«FOR obj : TuSort.byModule(eventModelTransformer.cache.values)»
- «obj.call»;
+ «obj.call»;
«ENDFOR»
/* Stimuli */
«FOR obj : TuSort.byModule(stimuliModelTransformer.cache.values)»
- «obj.call»;
+ «obj.call»;
«ENDFOR»
VLOG(0) << "simulation model complete";
@@ -173,10 +173,10 @@
sc_core::sc_trace_file *tf = sc_core::sc_create_vcd_trace_file("trace");
//trace processing units and memories -----
- «FOR tu: processingUnitTransformer.cache.values»
+ «FOR tu : processingUnitTransformer.cache.values»
sc_trace(tf, &*«tu.call»(), "«tu.module.replaceAll("/", "_")»");
«ENDFOR»
- «FOR tu: memoryTransformer.cache.values»
+ «FOR tu : memoryTransformer.cache.values»
sc_trace(tf, &*«tu.call»(), "«tu.module.replaceAll("/", "_")»");
«ENDFOR»
@@ -202,15 +202,13 @@
}
'''
-
-
def String getCMake() '''
include_directories(${PROJECT_SOURCE_DIR})
add_executable («getProperty(PropertyKeys.PROJECT_NAME)»
"${PROJECT_SOURCE_DIR}/«getModuleName()».cpp"
)
-
+
target_link_libraries(«getProperty(PropertyKeys.PROJECT_NAME)» app4mc.sim_lib)
target_include_directories(«getProperty(PropertyKeys.PROJECT_NAME)» PUBLIC app4mc.sim_lib)
@@ -222,10 +220,10 @@
add_subdirectory ("./osModel")
«IF Integer.parseInt(super.getProperty("CmakeUnityBuildTUPerCore","0")) > 0»
- # set the unity-batch-size to a Processorcount dependend value, for more efficient compiling
- if(COMMAND calc_unity_batch_size)
- calc_unity_batch_size(«getProperty(PropertyKeys.PROJECT_NAME)» «super.getProperty("CmakeUnityBuildTUPerCore")»)
- endif()
+ # set the unity-batch-size to a Processorcount dependend value, for more efficient compiling
+ if(COMMAND calc_unity_batch_size)
+ calc_unity_batch_size(«getProperty(PropertyKeys.PROJECT_NAME)» «super.getProperty("CmakeUnityBuildTUPerCore")»)
+ endif()
«ENDIF»
# use /bigobj to ensure big models to build with MSVC (e.g. FMTV WATERS Challenge 2017)
@@ -239,8 +237,8 @@
endif()
add_custom_target(model_execution
- COMMAND «getProperty(PropertyKeys.PROJECT_NAME)»
- WORKING_DIRECTORY "${MODEL_WORKING_DIR}"
+ COMMAND «getProperty(PropertyKeys.PROJECT_NAME)»
+ WORKING_DIRECTORY "${MODEL_WORKING_DIR}"
)
'''