Commit 773b3c35 authored by Anton Hattendorf's avatar Anton Hattendorf
Browse files

removed old plugin infrastructure

parent b22bbd61
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>ADMIN-org.fortiss.af3.multicore</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
</buildSpec>
<natures>
</natures>
</projectDescription>
Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: Multicore
Bundle-SymbolicName: org.fortiss.af3.multicore; singleton:=true
Bundle-Version: 1.0.0.qualifier
Bundle-Activator: org.fortiss.af3.multicore.Activator
Require-Bundle: org.eclipse.ui,
org.eclipse.emf.ecore,
org.eclipse.xtend;bundle-version="1.0.0",
org.eclipse.xpand;bundle-version="1.0.0",
org.eclipse.emf.ecore.xmi;bundle-version="2.5.0",
org.eclipse.emf.edit.ui;bundle-version="2.6.0",
org.antlr.runtime;bundle-version="3.0.0",
com.ibm.icu.source;bundle-version="4.2.1",
org.eclipse.emf.mwe.activities;bundle-version="1.0.0",
org.eclipse.emf.mwe.ui;bundle-version="1.0.0",
org.eclipse.emf.mwe.ui.simpleEditor;bundle-version="1.0.0",
org.eclipse.emf.mwe.utils;bundle-version="1.0.0",
org.eclipse.emf.mwe2.language;bundle-version="1.0.0",
org.eclipse.emf.mwe2.language.ui;bundle-version="1.0.0",
org.eclipse.emf.mwe2.launch;bundle-version="1.0.0",
org.eclipse.jface.text;bundle-version="3.6.0",
org.eclipse.xtend.typesystem.emf;bundle-version="1.0.0",
org.eclipse.xtend.typesystem.emf.ui;bundle-version="1.0.0",
org.eclipse.xtend.check.ui;bundle-version="1.0.0",
org.eclipse.xtend.profiler;bundle-version="1.0.0",
org.eclipse.xtend.shared.ui;bundle-version="1.0.0",
org.eclipse.xtend.ui;bundle-version="1.0.0",
edu.tum.cs.ccts.editor.base;bundle-version="0.3.0",
edu.tum.cs.ccts.execution;bundle-version="0.3.0",
edu.tum.cs.ccts.library.base;bundle-version="0.3.0",
edu.tum.cs.ccts.model.base;bundle-version="0.3.0",
edu.tum.cs.ccts.operatorpanel;bundle-version="0.3.0",
edu.tum.cs.ccts.typesystem;bundle-version="0.3.0",
edu.tum.cs.ccts.common.architecture;bundle-version="0.3.0",
org.eclipse.xpand.activities;bundle-version="1.0.0",
org.eclipse.xpand.ui;bundle-version="1.0.0",
org.junit4;bundle-version="4.8.1",
org.eclipse.emf.ecore.xmi.source;bundle-version="2.5.0",
org.eclipse.jface.databinding.source;bundle-version="1.4.0",
org.eclipse.jface.source;bundle-version="3.6.0",
org.eclipse.jface.text.source;bundle-version="3.6.0",
org.eclipse.xtext.xtend;bundle-version="1.0.0",
org.eclipse.xtext.xtend.source;bundle-version="1.0.0",
edu.tum.cs.af3.generator;bundle-version="0.3.0",
edu.tum.cs.af3.generator.embedded.c;bundle-version="0.3.0",
org.apache.commons.logging;bundle-version="1.1.1",
org.fortiss.core;bundle-version="1.0.0",
org.fortiss.emf;bundle-version="1.0.0",
org.fortiss.m2m;bundle-version="1.0.0",
org.eclipse.core.runtime
Bundle-ActivationPolicy: lazy
Bundle-RequiredExecutionEnvironment: JavaSE-1.6
Import-Package: org.eclipse.cdt.core,
org.eclipse.cdt.core.formatter
source.. = src/,\
src-gen/
output.. = bin/
bin.includes = META-INF/,\
.,\
plugin.xml
# <copyright>
# </copyright>
#
# $Id$
pluginName = Multicore Model
providerName = www.example.org
<?xml version="1.0" encoding="UTF-8"?>
<?eclipse version="3.0"?>
<!--
<copyright>
</copyright>
$Id$
-->
<plugin>
<extension point="org.eclipse.emf.ecore.generated_package">
<package
uri="www.fortiss.org/multicore"
class="multicore.MulticorePackage"/>
</extension>
</plugin>
<?xml version="1.0" encoding="UTF-8"?>
<!--
the ant build file
Author: Anton Hattendorf, Chuanxin Liu (fortiss GmbH)
$Id: build.xml 759 2011-06-14 07:39:39Z hattendorf $
-->
<project name="From Metamodel to Code Generation" default="02 model tasks" basedir="./../..">
<!-- Name of the project -->
<property name="project" value="org.fortiss.af3.multicore"/>
<!-- Application Name -->
<!--property name="projectName" value="LEDBlinking"/-->
<property name="projectName" value="SimpleTrafficLights"/>
<!--property name="projectName" value="NoiseEliminator"/-->
<!-- Used model transformation model -->
<property name="modeltransformation" value="model/Transformation.modeltransformation"/>
<!-- Used platform model -->
<property name="multicore" value="model/NiosSP4.xmi"/>
<!-- Common paths -->
<property name="application" value="model/${projectName}.xmi"/>
<property name="production" value="src-gen/model/Production_${projectName}.xmi"/>
<property name="mapping" value="extend::map_${projectName}"/>
<property name="codegen" value="src-gen/code/${projectName}"/>
<property name="codetemplate" value="template::GenMain::GenMain"/>
<!-- Version of java output from emf -->
<property name="jdklevel" value="6.0"/>
<!-- Import common defines -->
<!--import file="${fortiss.emf_defines}"/-->
<import file="/home/hattendorf/eclipse/plugins/org.fortiss.emf_1.0.0.v201102220824/ant_tasks/ant/emf_defines.xml"/>
<!-- Location of org.fortiss.m2m plugin -->
<pluginLocation pluginID="org.fortiss.m2m" result="org.fortiss.m2m.location"/>
<!-- Location of org.fortiss.emf plugin -->
<pluginLocation pluginID="org.fortiss.emf" result="org.fortiss.emf.location"/>
<!-- Location of org.fortiss.core plugin -->
<pluginLocation pluginID="org.fortiss.core" result="org.fortiss.core.location"/>
<!-- Class path -->
<path id="deps.classpath">
<pathelement location="${basedir}/../plugins/edu.tum.cs.ccts.typesystem/build"/>
<pathelement location="${basedir}/bin"/>
<pathelement location="${org.fortiss.m2m.location}"/>
<pathelement location="${org.fortiss.emf.location}"/>
<pathelement location="${eclipse.home}/plugins/org.fortiss.emf_1.0.0.v201102220824"/>
<!--pathelement location="${eclipse.home}/plugins/org.fortiss.emf_*"/--><!-- TODO -->
<pathelement location="${org.fortiss.core.location}"/>
<pathelement location="${basedir}/../plugins/edu.tum.cs.af3.application/build"/>
<pathelement location="${basedir}/../plugins/edu.tum.cs.af3.deployment/build"/>
<pathelement location="${basedir}/../plugins/edu.tum.cs.af3.filters/build"/>
<pathelement location="${basedir}/../plugins/edu.tum.cs.af3.functionalarchitecture/build"/>
<pathelement location="${basedir}/../plugins/edu.tum.cs.af3.generator/build"/>
<pathelement location="${basedir}/../plugins/edu.tum.cs.af3.generator.embedded.c/build"/>
<pathelement location="${basedir}/../plugins/edu.tum.cs.af3.model/build"/>
<pathelement location="${basedir}/../plugins/edu.tum.cs.af3.modes/build"/>
<pathelement location="${basedir}/../plugins/edu.tum.cs.af3.msc/build"/>
<pathelement location="${basedir}/../plugins/edu.tum.cs.af3.topology/build"/>
<pathelement location="${basedir}/../plugins/edu.tum.cs.ccts.common.architecture/build"/>
<pathelement location="${basedir}/../plugins/edu.tum.cs.ccts.commons/bin"/>
<pathelement location="${basedir}/../plugins/edu.tum.cs.ccts.editor.base/build"/>
<pathelement location="${basedir}/../plugins/edu.tum.cs.ccts.errormodel/build"/>
<pathelement location="${basedir}/../plugins/edu.tum.cs.ccts.execution/build"/>
<pathelement location="${basedir}/../plugins/edu.tum.cs.ccts.generator/build"/>
<pathelement location="${basedir}/../plugins/edu.tum.cs.ccts.library.base/build"/>
<pathelement location="${basedir}/../plugins/edu.tum.cs.ccts.model.base/build"/>
<pathelement location="${basedir}/../plugins/edu.tum.cs.ccts.operatorpanel/build"/>
<pathelement location="${basedir}/../plugins/edu.tum.cs.ccsm.dev_tools/build"/>
<pathelement location="${basedir}/../plugins/edu.tum.cs.ccsm.emf_tools/build"/>
<pathelement location="${basedir}/../plugins/edu.tum.cs.rateclipse/build"/>
<pathelement location="${basedir}/../plugins/edu.tum.cs.af3.model/bin"/>
<fileset dir="${eclipse.home}/plugins">
<include name="org.eclipse.xpand*.jar"/>
<include name="org.eclipse.xtend*.jar"/>
<include name="org.eclipse.emf.*.jar"/>
<include name="org.eclipse.uml2.*.jar"/>
<include name="org.eclipse.ant.*.jar"/>
<include name="org.apache.commons.*.jar"/>
<include name="org.eclipse.text*.jar"/>
<include name="org.eclipse.jface.text*.jar"/>
<include name="org.eclipse.equinox.common*.jar"/>
<include name="org.antlr.runtime*.jar"/>
<include name="com.ibm.icu*.jar"/>
<include name="edu.tum.cs*.jar"/>
<include name="org.fortiss.core_*.jar"/>
<include name="org.fortiss.m2m_*.jar"/>
<!-- for CBeautifier -->
<include name="org.ogsi.*.jar"/>
<include name="org.eclipse.core.resources*.jar"/>
<include name="org.eclipse.core.runtime*.jar"/>
<include name="org.eclipse.core.runtime.compatibility.registry_*/*.jar"/>
<include name="org.eclipse.core.jobs_*.jar"/>
<include name="org.eclipse.cdt*.jar"/>
<include name="org.eclipse.osgi*.jar"/>
<include name="org.eclipse.ui.workbench*.jar"/>
</fileset>
<fileset dir="${basedir}/../ccts-std-env/buckminster/target-platform/plugins">
<include name="org.conqat.ide.*.jar"/>
</fileset>
</path>
<target name="00 all" depends="01 metamodel tasks, 02 model tasks"></target>
<target name="01 metamodel tasks" depends="A1 clean all, A3 generate modelcode, A4 mm2mm"></target>
<target name="02 model tasks" depends="B1 clean models, B3 m2m, B4 automaton code, B5 m2c, B6 clean automatons"></target>
<!-- Removes all generated files -->
<target name="A1 clean all" >
<!--delete dir="${basedir}/src/production"/-->
<!--delete dir="${basedir}/src/multicore"/-->
<delete dir="${basedir}/src-gen/production"/>
<delete dir="${basedir}/src-gen/code"/>
<delete dir="${basedir}/src-gen/multicore"/>
<delete dir="${basedir}/src-gen/metamodel"/>
<delete dir="${basedir}/src-gen/model"/>
</target>
<!-- Generate the genmodel and Model Code for the Metamodel(ECore)(application, platform) -->
<target name="A3 generate modelcode">
<emf.Ecore2Java
model="src/metamodel/multicore.ecore"
genModel="src-gen/metamodel/multicore.genmodel"
modelProject="/${project}"
modelProjectFragmentPath="src-gen"
generateJavaCode="true"
jdklevel="${jdklevel}">
<arg line="-package www.fortiss.org/multicore"/>
</emf.Ecore2Java>
</target>
<!-- Transforms metamodels -->
<target name="A4 mm2mm">
<!-- production.ecore is generated by the workflow: workflow_transform_metamodels.mwe, and production.genmodel is not generated from this workflow -->
<java
classname="org.eclipse.emf.mwe.core.WorkflowRunner"
classpathref="deps.classpath"
fork = "true"
dir="${basedir}">
<arg value="${basedir}/src/workflow/workflow_transform_metamodels.mwe"/>
<arg value="-pbasedir=${basedir}"/>
<arg value="-pmodeltransformation=${modeltransformation}"/>
<arg value="-ptransformed=src-gen/metamodel/production.ecore"/>
<arg value="--ant"/>
</java>
<!-- workflow prepare package should be called before generate the "Model Code" for the generated model -->
<java
classname="org.eclipse.emf.mwe.core.WorkflowRunner"
classpathref="deps.classpath"
fork = "true"
dir="${basedir}">
<arg value="${basedir}/src/workflow/workflow_prepare_package.mwe"/>
<arg value="-pbasedir=${basedir}"/>
<arg value="-pname=production"/>
<arg value="-pecore=src-gen/metamodel/production.ecore"/>
<arg value="--ant"/>
</java>
<!-- the production.genmodel and the Model code in the production directory are generated from production.ecore by using or emf.Ecore2Java-->
<emf.Ecore2Java
model="src-gen/metamodel/production.ecore"
genModel="src-gen/metamodel/production.genmodel"
modelProject="/${project}"
modelProjectFragmentPath="src-gen"
generateJavaCode="true"
jdklevel="${jdklevel}">
<arg line="-package www.fortiss.org/production"/>
</emf.Ecore2Java>
</target>
<!-- Removes generated files of production model -->
<target name="B1 clean models" >
<delete dir="${basedir}/${codegen}"/>
<delete file="${basedir}/${production}"/>
</target>
<!-- Transforms models -->
<target name="B3 m2m">
<java
classname="org.eclipse.emf.mwe.core.WorkflowRunner"
classpathref="deps.classpath"
fork = "true"
dir="${basedir}">
<!--jvmarg value="-Xdebug"/>
<jvmarg value="-Xnoagent"/>
<jvmarg value="-Djava.compiler=NONE"/>
<jvmarg value="-Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000"/-->
<arg value="${basedir}/src/workflow/workflow_transform_models.mwe"/>
<arg value="-pbasedir=${basedir}"/>
<arg value="-pplatform=${multicore}"/>
<arg value="-papplication=${application}"/>
<arg value="-pproduction=${production}"/>
<arg value="-pmapping=${mapping}"/>
<arg value="-pmodeltransformation=${modeltransformation}"/>
<arg value="--ant"/>
</java>
</target>
<!-- Generate code for automaton -->
<target name="B4 automaton code" >
<java
classname="org.eclipse.emf.mwe.core.WorkflowRunner"
classpathref="deps.classpath"
fork = "true"
dir="${basedir}">
<!--jvmarg value="-Xdebug"/>
<jvmarg value="-Xnoagent"/>
<jvmarg value="-Djava.compiler=NONE"/>
<jvmarg value="-Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000"/-->
<arg value="${basedir}/src/workflow/workflow_generate_code_automaton.mwe"/>
<arg value="-pbasedir=${basedir}"/>
<arg value="-papplication=${application}"/>
<arg value="-pcodegen=${codegen}"/>
<arg value="--ant"/>
</java>
</target>
<!-- Generate code -->
<target name="B5 m2c">
<java
classname="org.eclipse.emf.mwe.core.WorkflowRunner"
classpathref="deps.classpath"
fork = "true"
dir="${basedir}">
<!--jvmarg value="-Xdebug"/>
<jvmarg value="-Xnoagent"/>
<jvmarg value="-Djava.compiler=NONE"/>
<jvmarg value="-Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000"/-->
<arg value="${basedir}/src/workflow/workflow_generate_code.mwe"/>
<arg value="-pbasedir=${basedir}"/>
<arg value="-pproduction=${production}"/>
<arg value="-pcodegen=${codegen}"/>
<arg value="-pcodetemplate=${codetemplate}"/>
<arg value="-pprojectname=${projectName}"/>
<arg value="--ant"/>
</java>
</target>
<!-- Removes all AF3 automatons -->
<target name="B6 clean automatons" >
<delete dir="${basedir}/${codegen}/af3automaton"/>
</target>
</project>
// code generation utilities
// Author: Anton Hattendorf, Chuanxin Liu (fortiss GmbH)
// $Id$
import production;
import production::multicore;
import production::logical_architecture_model;
// These function return the in channels for core
List[Channel] returnInChannels(PE core, List[Channel] channels):
(channels.isEmpty)?{}:(
((channels.first().sourcePort.component.runningOnPE != core) && (channels.first().destinationPort.component.runningOnPE == core))?
(returnInChannels(core, channels.withoutFirst()).add(channels.first())):
(returnInChannels(core, channels.withoutFirst()))
);
// These function return the out channels for core
List[Channel] returnOutChannels(PE core, List[Channel] channels):
(channels.isEmpty)?{}:(
((channels.first().sourcePort.component.runningOnPE == core) && (channels.first().destinationPort.component.runningOnPE != core))?
(returnOutChannels(core, channels.withoutFirst()).add(channels.first())):
(returnOutChannels(core, channels.withoutFirst()))
);
// These function return the internal channels for core
List[Channel] returnInternalChannels(PE core, List[Channel] channels):
(channels.isEmpty)?{}:(
((channels.first().sourcePort.component.runningOnPE == core) && (channels.first().destinationPort.component.runningOnPE == core))?
(returnInternalChannels(core, channels.withoutFirst()).add(channels.first())):
(returnInternalChannels(core, channels.withoutFirst()))
);
// return the contents of the given file as string
String printCTemplate(String fileName):
JAVA org.fortiss.af3.multicore.CGUtil.printCTemplate(java.lang.String);
// return the contents of the given file as string
String printFile(String fileName):
JAVA org.fortiss.af3.multicore.CGUtil.printFile(java.lang.String);
// return the contents of the given file as string
String printCTemplateIfExists(String fileName):
JAVA org.fortiss.af3.multicore.CGUtil.printCTemplateIfExists(java.lang.String);
// return the contents of the given file as string
String printFileIfExists(String fileName):
JAVA org.fortiss.af3.multicore.CGUtil.printFileIfExists(java.lang.String);
\ No newline at end of file
// automaton code generation functions
// Author: Anton Hattendorf, Chuanxin Liu (fortiss GmbH)
// $Id$
generateComponent2C(model::Component component): JAVA org.fortiss.af3.multicore.CodeGeneration.generateComponent2C(edu.tum.cs.af3.logicalarchitecture.model.Component);
generateDD2C(model::Project project): JAVA org.fortiss.af3.multicore.CodeGeneration.generateDD2C(edu.tum.cs.af3.model.Project);
String getFile(String f): JAVA org.fortiss.af3.multicore.CodeGeneration.getFile(java.lang.String);
clean(): JAVA org.fortiss.af3.multicore.CodeGeneration.clean();
// m2m
// Author: Anton Hattendorf, Chuanxin Liu (fortiss GmbH)
// $Id$
import modeltransformation;
import production;
import production::multicore;
import production::logical_architecture_model;
import production::af3_model;
extension extend::m2m;
create Production this unionModels(multicore::HierarchicalComponent multicore, model::Project project, ModelTransformation transformation):
// This part is must, you have to first initialize the transformation, and then set the platform and the application
initM2MTransformation(transformation) ->
this.setHierarchicalComponent((HierarchicalComponent)transformObject(multicore)) ->
this.setComponent((Component)transformObject(project.components.first())) ->
//Transformation code goes here
this.component.setRunningOnHierarchicalComponent(this.hierarchicalComponent)->
this.hierarchicalComponent.setRuns(this.component) ->
finiM2MTransformation();
\ No newline at end of file
// maps LEDBlinking application to cores
// Author: Anton Hattendorf, Chuanxin Liu (fortiss GmbH)
// $Id$
import production;
import production::multicore;
import production::logical_architecture_model;
// return PE which has the appointed name
PE returnNameMatchedPE(List[HComponentBase] componentBases, String string):
(componentBases.isEmpty)?{}:
(componentBases.first().name == string ?
componentBases.first():
returnNameMatchedPE(componentBases.withoutFirst(), string)
);
// get PE manually basing on component name
PE getPEBasingOnComponentName(Component component, HierarchicalComponent hierarchicalComponent):
(component.name == "P1")? hierarchicalComponent.components.typeSelect(PE).returnNameMatchedPE("cpu1"):( // else of if expression 1
(component.name == "P2")? hierarchicalComponent.components.typeSelect(PE).returnNameMatchedPE("cpu2"):( // else of if expression 2
(component.name == "P3")? hierarchicalComponent.components.typeSelect(PE).returnNameMatchedPE("cpu2"):( // else of if expression 3
(component.name == "P4")? hierarchicalComponent.components.typeSelect(PE).returnNameMatchedPE("cpu3"): // else
{}
) //end of if expresion 1
)//end of if expresion 2
);//end of if expresion 3
// get PE Manually
Void getPEManually(Component component, HierarchicalComponent hierarchicalComponent):
getPEBasingOnComponentName(component, hierarchicalComponent);
// locate components to PEs
Void locateComponents2PEs(List[Component] components, HierarchicalComponent hierarchicalComponent):
( !components.isEmpty)?{locateComponents2PEs(components.withoutFirst(), hierarchicalComponent) ->
(components.first()).setRunningOnPE( getPEManually(components.first(), hierarchicalComponent))}:
//else
{};
Component returnComponentBasedOnName(String name, List[Component] components):
(components.isEmpty)?{}:
((name == components.first().name)?
components.first():
returnComponentBasedOnName(name, components.withoutFirst()))
;
List[Component] returnComponentsBasedonNames(List[String] names, List[Component] components):
(names.isEmpty)?{}:
returnComponentsBasedonNames(names.withoutFirst(), components).add((names.first().returnComponentBasedOnName(components)));
// locate PEs to components
Void locatePEs2Components(List[Component] components, HierarchicalComponent hierarchicalComponent):
(hierarchicalComponent.components.typeSelect(PE).returnNameMatchedPE("cpu1").setRuns(returnComponentsBasedonNames( {"P1"} ,components)))->
(hierarchicalComponent.components.typeSelect(PE).returnNameMatchedPE("cpu2").setRuns(returnComponentsBasedonNames( {"P2", "P3"} ,components)))->
(hierarchicalComponent.components.typeSelect(PE).returnNameMatchedPE("cpu3").setRuns(returnComponentsBasedonNames( {"P4"} ,components)));
Production mapApplication(Production p):
// locate components to PEs
locateComponents2PEs(p.component.components, p.hierarchicalComponent) ->
// locate PEs to components
locatePEs2Components(p.component.components, p.hierarchicalComponent) ->
p;
// maps NoiseEliminator application to cores
// Author: Anton Hattendorf, Chuanxin Liu (fortiss GmbH)
// $Id$
import production;
import production::multicore;
import production::logical_architecture_model;
// return PE which has the appointed name
PE returnNameMatchedPE(List[HComponentBase] componentBases, String string):
(componentBases.isEmpty)?{}:
(componentBases.first().name == string ?
componentBases.first():
returnNameMatchedPE(componentBases.withoutFirst(), string)
);
// get PE manually basing on component name
PE getPEBasingOnComponentName(Component component, HierarchicalComponent hierarchicalComponent):
(component.name == "Init_1")? hierarchicalComponent.components.typeSelect(PE).returnNameMatchedPE("cpu1"):( // else of if expression 1
(component.name == "ReadSamples_1")? hierarchicalComponent.components.typeSelect(PE).returnNameMatchedPE("cpu1"):( // else of if expression 2
(component.name == "Processing_1")? hierarchicalComponent.components.typeSelect(PE).returnNameMatchedPE("cpu1"):( // else of if expression 3
(component.name == "WriteSamples_1")? hierarchicalComponent.components.typeSelect(PE).returnNameMatchedPE("cpu1"):( // else of if expression 4
(component.name == "Init_2")? hierarchicalComponent.components.typeSelect(PE).returnNameMatchedPE("cpu2"):( // else of if expression 5
(component.name == "ReadSamples_2")? hierarchicalComponent.components.typeSelect(PE).returnNameMatchedPE("cpu2"):( // else of if expression 6
(component.name == "Processing_2")? hierarchicalComponent.components.typeSelect(PE).returnNameMatchedPE("cpu2"):( // else of if expression 7
(component.name == "WriteSamples_2")? hierarchicalComponent.components.typeSelect(PE).returnNameMatchedPE("cpu2"): // else
{}
) //end of if expresion 1
)//end of if expresion 2
)//end of if expresion 3
)//end of if expresion 4
)//end of if expresion 5
)//end of if expresion 6
);//end of if expresion 7
// get PE Manually
Void getPEManually(Component component, HierarchicalComponent hierarchicalComponent):
getPEBasingOnComponentName(component, hierarchicalComponent);
// locate components to PEs
Void locateComponents2PEs(List[Component] components, HierarchicalComponent hierarchicalComponent):
( !components.isEmpty)?{locateComponents2PEs(components.withoutFirst(), hierarchicalComponent) ->
(components.first()).setRunningOnPE( getPEManually(components.first(), hierarchicalComponent))}:
//else
{};
Component returnComponentBasedOnName(String name, List[Component] components):
(components.isEmpty)?{}:
((name == components.first().name)?
components.first():
returnComponentBasedOnName(name, components.withoutFirst()))
;
List[Component] returnComponentsBasedonNames(List[String] names, List[Component] components):
(names.isEmpty)?{}:
returnComponentsBasedonNames(names.withoutFirst(), components).add((names.first().returnComponentBasedOnName(components)));
// locate PEs to components
Void locatePEs2Components(List[Component] components, HierarchicalComponent hierarchicalComponent):
(hierarchicalComponent.components.typeSelect(PE).returnNameMatchedPE("cpu1").setRuns(returnComponentsBasedonNames( {"WriteSamples_1", "Processing_1", "ReadSamples_1","Init_1"} ,components)))->
(hierarchicalComponent.components.typeSelect(PE).returnNameMatchedPE("cpu2").setRuns(returnComponentsBasedonNames( {"WriteSamples_2", "Processing_2", "ReadSamples_2","Init_2"} ,components)));
Production mapApplication(Production p):
// locate components to PEs
locateComponents2PEs(p.component.components, p.hierarchicalComponent) ->
// locate PEs to components
locatePEs2Components(p.component.components, p.hierarchicalComponent) ->
p;
// maps SimpleTest application to cores
// Author: Anton Hattendorf, Chuanxin Liu (fortiss GmbH)
// $Id$
import production;
import production::multicore;
import production::logical_architecture_model;
// return PE which has the appointed name
PE returnNameMatchedPE(List[HComponentBase] componentBases, String string):
(componentBases.isEmpty)?{}:
(componentBases.first().name == string ?