| /** |
| * ******************************************************************************* |
| * Copyright (c) 2019 Robert Bosch GmbH and others. |
| * |
| * This program and the accompanying materials are made |
| * available under the terms of the Eclipse Public License 2.0 |
| * which is available at https://www.eclipse.org/legal/epl-2.0/ |
| * |
| * SPDX-License-Identifier: EPL-2.0 |
| * |
| * Contributors: |
| * Robert Bosch GmbH - initial API and implementation |
| * ******************************************************************************* |
| */ |
| |
| package templates.m2m.hw |
| |
| import com.google.inject.Inject |
| import com.inchron.realtime.root.model.Model |
| import org.eclipse.app4mc.amalthea.model.Cache |
| import org.eclipse.app4mc.amalthea.model.HWModel |
| import org.eclipse.app4mc.amalthea.model.Memory |
| import org.eclipse.app4mc.amalthea.model.StructureType |
| import templates.AbstractAmaltheaInchronTransformer |
| import com.google.inject.Singleton |
| |
| @Singleton |
| class HWStructure_SystemTransformer extends AbstractAmaltheaInchronTransformer { |
| |
| @Inject HWStructure_ECUTransformer ecuTransformer |
| |
| @Inject HWStructure_MicroControllerTransformer microControllerTransformer |
| |
| @Inject MemoryTransformer memoryTransformer |
| |
| @Inject CacheTransformer cacheTransformer |
| |
| def transformHWSystem(HWModel amltHWModel, Model inchronModel) { |
| val amltHWStructures = amltHWModel.structures |
| |
| amltHWStructures.forEach [ amltHWStructure | |
| if (amltHWStructure.structureType == StructureType.SYSTEM) { |
| |
| amltHWStructure.modules.forEach [ amltHwModule | |
| if (amltHwModule instanceof Memory) { |
| inchronModel.memories.add(memoryTransformer.createMemory(amltHwModule)) |
| } else if (amltHwModule instanceof Cache) { |
| inchronModel.memories.add(cacheTransformer.createCache(amltHwModule)) |
| } |
| ] |
| |
| amltHWStructure.structures.forEach [ subStructure | |
| if (subStructure.structureType == StructureType.ECU) { |
| |
| ecuTransformer.transformHWECU(subStructure, inchronModel) |
| } else if (subStructure.structureType == StructureType.MICROCONTROLLER) { |
| |
| inchronModel.cpus.add(microControllerTransformer.createCpu(subStructure)) |
| } |
| ] |
| } else if (amltHWStructure.structureType == StructureType.ECU) { |
| ecuTransformer.transformHWECU(amltHWStructure, inchronModel) |
| } else if (amltHWStructure.structureType == StructureType.MICROCONTROLLER) { |
| |
| inchronModel.cpus.add(microControllerTransformer.createCpu(amltHWStructure)) |
| } |
| ] |
| |
| } |
| } |