## Model Validation

### Usage of AMALTHEA Model Validation

The AMALTHEA model validation can be triggered by clicking on the “Validate” button of the Amalthea editor.

The dialog shows a list of profiles allowing the selection of specific validations.

The validation is either applied to all elements of the model (default: folder scope) or only to the elements of the current file.

If an error is found, it is shown in the Problems view of Eclipse. A simple double click on the error will lead you to the affected elements in the AMALTHEA model. The validation distinguishes between three error types: errors, warnings and info.

### Included Validations

#### Amalthea Standard Validations

`org.eclipse.app4mc.amalthea.validations.standard.AmaltheaProfile`
Amalthea Standard Validations
Standard validations for AMALTHEA models to ensure data consistency.

- Profiles:
  - `org.eclipse.app4mc.amalthea.validations.standard.BasicProfile`
  - `org.eclipse.app4mc.amalthea.validations.standard.ConstraintsProfile`
  - `org.eclipse.app4mc.amalthea.validations.standard.EMFProfile`
  - `org.eclipse.app4mc.amalthea.validations.standard.EMFScopeProfile`
  - `org.eclipse.app4mc.amalthea.validations.standard.HardwareProfile`
  - `org.eclipse.app4mc.amalthea.validations.standard.MappingProfile`
  - `org.eclipse.app4mc.amalthea.validations.standard.SoftwareProfile`

`org.eclipse.app4mc.amalthea.validations.standard.BasicProfile`
Basic Validations

- Validations:
  - AM-Basic-Counter (ERROR – Counter)
    - The offset value of a counter must not be negative
  - AM-Basic-Data-Size (ERROR – DataSize)
    - Some data sizes have to fulfill the condition >0 or >=0
  - AM-Basic-Frequency (ERROR – Frequency)
    - Some frequencies have to fulfill the condition >0
  - AM-Basic-Quantity (ERROR – Quantity)
    - Quantity unit has to be set ( undefined is an error)
  - AM-Basic-Time-Range (ERROR – Time)
    - Some time ranges has to fulfill the condition >0 or >=0
  - AM-Basic-CustomProperty-Key (WARNING – IAnnotatable)
    - Custom property keys have to be unique

`org.eclipse.app4mc.amalthea.validations.standard.ConstraintsProfile`
Constraints Validations

- Validations:
  - AM-Constraints-EventChain (ERROR – AbstractEventChain)
    - Stimulus and response shall not reference the same event
    - The stimulus of the first segment has to be the same as the stimulus of the event chain
    - The stimulus of other segments have to be equal to the response of the previous segment
    - The response of the last segment has to be the same as the response of the event chain

`org.eclipse.app4mc.amalthea.validations.standard.EMFProfile`
Amalthea EMF Validations
Standard EMF validations for AMALTHEA models (generated).

- Validations:
  - AM-EMF-INTRINSIC (UNDEFINED – EObject)
    - EMF extended metadata constraints (generated)
    - AMALTHEA invariants (generated)

`org.eclipse.app4mc.amalthea.validations.standard.EMFScopeProfile`
Amalthea Scope Validations
Validations to ensure unique names in folder scope.

- Validations:
  - AM-EMF-SCOPE (ERROR – Amalthea)
    - ID has to be unique in folder scope
    - ID has to be set for objects of type IReferable

`org.eclipse.app4mc.amalthea.validations.standard.HardwareProfile`
Hardware Validations

- Validations:
  - AM-HW-AccessPath (ERROR – HwAccessPath)
    - HwAccessPath ranges and memory size must be consistent
    - HwAccessPath elements must be consistent
  - AM-HW-Connection (ERROR – HwConnection)
    - HwConnections must refer to two HwPorts
    - HwConnections must be linked to HwPorts of the same Interface
  - AM-HW-Definition (ERROR – HwDefinition)
    - Only one feature of a category can be referred
  - AM-HW-Port (ERROR – HwPort)
    - A HwPort can only have one (non internal) HwConnection
  - AM-HW-Structure (ERROR – HwStructure)
    - Connections must only refer to contained HwPorts
    - Inner connections always need one Initiator and one Responder HwPort
    - Delegated connections always connect HwPorts of the same type
  - AM-HW-Module-Definition (WARNING – HwModule)
    - Memory definition must be set
    - ProcessingUnit definition must be set
    - ConnectionHandler definition must be set
    - Cache definition must be set
  - AM-HW-Port-BitWidth (WARNING – HwPort)
    - Bitwidth should be greater than zero
  - AM-HW-Port-Definition (WARNING – HwPort)
    - PortType must be set
    - PortInterface must be set

`org.eclipse.app4mc.amalthea.validations.standard.MappingProfile`
Mapping Validations

- Validations:
  - AM-Mapping-ISR-Scheduler (WARNING – ISR)
    - An ISR should have an allocation to an interrupt controller
  - AM-Mapping-Scheduler-Allocation-Hierarchy (WARNING – SchedulerAllocation)
    - A child scheduler should only be responsible for a subset of processing units of its ancestors
  - AM-Mapping-Scheduler-Allocation-Top-Level-Responsibility (WARNING – MappingModel)
    - A processing unit should have at most one top level task scheduler and one interrupt controller responsible for it
  - AM-Mapping-Scheduler-ProcessingUnit (WARNING – Scheduler)
    - A scheduler should be responsible for at least one processing unit
  - AM-Mapping-Task-Scheduler (WARNING – Task)
    - A task should have an allocation to a task scheduler

`org.eclipse.app4mc.amalthea.validations.standard.SoftwareProfile`
Software Validations

- Validations:
  - AM-SW-CallArgument (ERROR – CallArgument)
    - The referred runnable must contain the referred parameter
  - AM-SW-DataDependency (ERROR – DataDependency)
    - A data dependency can only be defined for specific types of label accesses, parameters and call arguments
    - A data dependency can only refer to specific types of parameters and call arguments
  - AM-SW-Group (ERROR – Group)
    - The uninterruptible group must not contain nested groups

#### APP4MC.sim Validations

`org.eclipse.app4mc.amalthea.validations.sim.App4mcSimProfile`
APP4MC.sim Validations
Validations for AMALTHEA models used in a APP4MC.sim simulation.

- Profiles:
  - `org.eclipse.app4mc.amalthea.validations.sim.SimBasicProfile`
  - `org.eclipse.app4mc.amalthea.validations.sim.SimHardwareProfile`
  - `org.eclipse.app4mc.amalthea.validations.sim.SimMappingProfile`
  - `org.eclipse.app4mc.amalthea.validations.sim.SimSoftwareProfile`
  - `org.eclipse.app4mc.amalthea.validations.standard.AmaltheaProfile`

`org.eclipse.app4mc.amalthea.validations.sim.SimBasicProfile`
Basic Validations (APP4MC.sim)

- Validations:
  - Sim-Basic-Identifiers (ERROR – IReferable)
    - All names of IReferable objects must be valid C++ identifier names
  - TA-Basic-ContinuousValueGaussDistribution-mean (ERROR – ContinuousValueGaussDistribution)
    - Mean must not be less than the lower bound
    - Mean must not be greater than the upper bound
  - TA-Basic-DiscreteValueGaussDistribution-mean (ERROR – DiscreteValueGaussDistribution)
    - Mean must not be less than the lower bound
    - Mean must not be greater than the upper bound
  - TA-Basic-TimeGaussDistribution-mean (ERROR – TimeGaussDistribution)
    - Mean must not be less than the lower bound
    - Mean must not be greater than the upper bound

`org.eclipse.app4mc.amalthea.validations.sim.SimHardwareProfile`
Hardware Validations (APP4MC.sim)

- Validations:
  - Inchron-HWModule-MissingClockReference (ERROR – HwModule)
    - HW Module must have ‘Frequency Domain’ reference
  - Sim-HW-Connection (ERROR – HwConnection)
    - Either read AND write latency, or datarate, or both must be set
  - Sim-HW-MemoryDefinition (INFO – MemoryDefinition)
    - Either access latency or datarate (or both) must be set

`org.eclipse.app4mc.amalthea.validations.sim.SimMappingProfile`
Mapping Validations (APP4MC.sim)

- Validations:
  - AM-Mapping-ISR-Scheduler (ERROR – ISR)
    - An ISR should have an allocation to an interrupt controller
  - AM-Mapping-Task-Scheduler (ERROR – Task)
    - A task should have an allocation to a task scheduler
  - Sim-Mapping-SchedulerAllocation (ERROR – SchedulerAllocation)
    - Executing processing unit must be set
  - Sim-Mapping-TaskPriorityNegative (ERROR – SchedulingParameters)
    - Scheduling parameter priority cannot negative
  - Sim-Mapping-TaskPriorityIsSet (WARNING – TaskAllocation)
    - Task priority must be set in task allocation’s scheduling parameters

`org.eclipse.app4mc.amalthea.validations.sim.SimSoftwareProfile`
Software Validations (APP4MC.sim)

- Validations:
  - Sim-Software-AbstractMemoryElementIsMapped (ERROR – LabelAccess)
    - Checks if label access type is set
  - Sim-Software-AbstractMemoryElementIsMapped (ERROR – ModeLabelAccess)
    - Checks if modeLabel access type is valid
  - Sim-Software-AbstractMemoryElementIsMapped (ERROR – Label)
    - Checks if label is mapped to a memory node
  - Sim-Software-AbstractMemoryElementIsMapped (ERROR – Channel)
    - Checks if channel is mapped to a Memory
  - Sim-Software-ChannelAccessFeasibility (ERROR – ChannelAccess)
    - Checks if a channel access can be performed from certain runnable
  - Sim-Software-ChannelElements (ERROR – ChannelAccess)
    - Checks if channel access’s property elements is greater 0
  - Sim-Software-LabelAccessFeasibility (ERROR – LabelAccess)
    - Checks if a label access can be performed from certain runnable
  - Sim-Software-Process (ERROR – Process)
    - At least one stimulus must be set
  - Inchron-SW-Runnable-MustHaveActivityGraph (WARNING – Runnable)
    - Runnable must have at least one ActivityGraph
  - Inchron-SW-Task-MustHaveActivityGraph (WARNING – Task)
    - Task must have atleast one ActivityGraph
  - Sim-Software-AbstractMemoryElementIsMapped (WARNING – ModeLabel)
    - Checks if modeLabel is mapped to a Memory
  - Sim-Software-ModeLabelAccessFeasibility (WARNING – ModeLabelAccess)
    - Checks if a modeLabel access can be performed from certain runnable
  - TA-Software-ModeConditionConjunctionAlwaysFalse (WARNING – ModeConditionConjunction)
  - TA-Software-ModeConditionDisjunctionAlwaysTrue (WARNING – ModeConditionDisjunction)

#### Timing Architects Validations

`org.eclipse.app4mc.amalthea.validations.ta.TimingArchitectsProfile`
Timing Architects Validations
Validations for AMALTHEA models used in a Timing Architects Simulation.

- Validations:
  - TA-Misc-Semaphore (ERROR – Semaphore)
    - Initial value must not be negative
    - Max value must be positive
    - Max value must not be smaller than the initial value
- Profiles:
  - `org.eclipse.app4mc.amalthea.validations.standard.AmaltheaProfile`
  - `org.eclipse.app4mc.amalthea.validations.ta.TABasicProfile`
  - `org.eclipse.app4mc.amalthea.validations.ta.TAConstraintsProfile`
  - `org.eclipse.app4mc.amalthea.validations.ta.TAHardwareProfile`
  - `org.eclipse.app4mc.amalthea.validations.ta.TASoftwareProfile`
  - `org.eclipse.app4mc.amalthea.validations.ta.TAStimuliProfile`

`org.eclipse.app4mc.amalthea.validations.ta.TABasicProfile`
Basic Validations (Timing Architects)

- Validations:
  - TA-Basic-ContinuousValueGaussDistribution-mean (ERROR – ContinuousValueGaussDistribution)
    - Mean must not be less than the lower bound
    - Mean must not be greater than the upper bound
  - TA-Basic-DiscreteValueGaussDistribution-mean (ERROR – DiscreteValueGaussDistribution)
    - Mean must not be less than the lower bound
    - Mean must not be greater than the upper bound
  - TA-Basic-TimeGaussDistribution-mean (ERROR – TimeGaussDistribution)
    - Mean must not be less than the lower bound
    - Mean must not be greater than the upper bound

`org.eclipse.app4mc.amalthea.validations.ta.TAConstraintsProfile`
Constraints Validations (Timing Architects)

- Validations:
  - TA-Constraints-DataAgeTime (ERROR – DataAgeTime)
    - Maximum time must not be smaller than minimum time
  - TA-Constraints-DelayConstraint (ERROR – DelayConstraint)
    - Upper bound must not be smaller than lower bound
  - TA-Constraints-ECLConstraint (ERROR – EventChainLatencyConstraint)
    - Maximum must not be smaller than minimum
  - TA-Constraints-EDFTaskMustHaveDeadline (ERROR – Task)
    - EDF tasks must have a deadline requirement
  - TA-Constraints-RTLimitMustBePositive (ERROR – TimeRequirementLimit)
    - Response time must be positive
  - TA-Constraints-RepetitionConstraint (ERROR – RepetitionConstraint)
    - Upper bound must not be smaller than lower bound

`org.eclipse.app4mc.amalthea.validations.ta.TAHardwareProfile`
Hardware Validations (Timing Architects)

- Validations:
  - TA-Hardware-HWFIPCMustBePositive (ERROR – HwFeature)
    - IPC (instructions per cycle) must be positive
  - TA-Hardware-PUDIPCMissing (INFO – ProcessingUnitDefinition)
    - IPC (instructions per cycle) should be set, otherwise default (1.0) will be assumed
    - Only one IPC HwFeature should be specified for a processing unit definition

`org.eclipse.app4mc.amalthea.validations.ta.TASoftwareProfile`
Software Validations (Timing Architects)

- Validations:
  - TA-Software-RunnableCall (ERROR – RunnableCall)
  - TA-Software-ServerCall (ERROR – ServerCall)
  - TA-Stimuli-ArrivalCurveStimulus (ERROR – OsEvent)
  - TA-Software-ModeConditionConjunctionAlwaysFalse (WARNING – ModeConditionConjunction)
  - TA-Software-ModeConditionDisjunctionAlwaysTrue (WARNING – ModeConditionDisjunction)

`org.eclipse.app4mc.amalthea.validations.ta.TAStimuliProfile`
Stimuli Validations (Timing Architects)

- Validations:
  - TA-Stimuli-VariableRateStimulusScenario (ERROR – VariableRateStimulus)
    - Scenario must be set

#### Inchron Validations

`org.eclipse.app4mc.amalthea.validations.inchron.InchronProfile`
Inchron Validations
Validation for Amalthea models used in Inchron Toolsuite

- Profiles:
  - `org.eclipse.app4mc.amalthea.validations.inchron.InchronConstraintsProfile`
  - `org.eclipse.app4mc.amalthea.validations.inchron.InchronHWProfile`
  - `org.eclipse.app4mc.amalthea.validations.inchron.InchronOsProfile`
  - `org.eclipse.app4mc.amalthea.validations.inchron.InchronSoftwareProfile`
  - `org.eclipse.app4mc.amalthea.validations.inchron.InchronStimuliProfile`
  - `org.eclipse.app4mc.amalthea.validations.standard.AmaltheaProfile`

`org.eclipse.app4mc.amalthea.validations.inchron.InchronConstraintsProfile`
Constraints Validations (INCHRON)

- Validations:
  - Inchron-Constraints-LoadRequirementMissingResource (ERROR – CPUPercentageRequirementLimit)
    - CPU load requirement must have hardware context

`org.eclipse.app4mc.amalthea.validations.inchron.InchronHWProfile`
Hardware Validations (INCHRON)

- Validations:
  - AM-HW-Port-BitWidth (ERROR – HwPort)
    - Bitwidth should be greater than zero
  - Inchron-HW-Memory-PortTypeResponder (ERROR – Memory)
    - HW ports of memory should be of type responder
  - Inchron-HW-PU-PortTypeInitiator (ERROR – ProcessingUnit)
    - HW ports of processing Unit should be of type initiator
  - Inchron-HWModule-InconsistentPortWidths (ERROR – HwModule)
    - HW Module cannot have ports with unequal bitwidth
  - Inchron-HWModule-MissingClockReference (ERROR – HwModule)
    - HW Module must have ‘Frequency Domain’ reference
- Profiles:
  - `org.eclipse.app4mc.amalthea.validations.standard.HardwareProfile`

`org.eclipse.app4mc.amalthea.validations.inchron.InchronOsProfile`
Operating Systems Validations (INCHRON)

- Validations:
  - Inchron-OS-PU-Allocation-MustBeDisjunct (ERROR – OperatingSystem)
    - OS Scheduler to core mapping must be distinct
  - Inchron-OS-Scheduler-Allocation-DifferentCPU (ERROR – Scheduler)
    - OS Task scheduler should not be allocated to more than one HwStructure
  - Inchron-OS-UserSpecificSchedulerCheck (ERROR – UserSpecificSchedulingAlgorithm)
    - User specific task scheduler needs at least one task allocation

`org.eclipse.app4mc.amalthea.validations.inchron.InchronSoftwareProfile`
Software Validations (INCHRON)

- Validations:
  - Inchron-SW-Runnable-MustHaveActivityGraph (ERROR – Runnable)
    - Runnable must have at least one ActivityGraph
  - Inchron-SW-Runnable-NotAllocated-DifferentOS (ERROR – Runnable)
    - Runnable cannot be scheduled by more than one OS
  - Inchron-SW-RunnableAllocation-Present (ERROR – RunnableAllocation)
    - Runnable allocation is not supported
  - Inchron-SW-Task-EnforcedMigrationCheck (ERROR – Task)
    - Invalid Enforced Migration of a task to a task Scheduler
  - Inchron-SW-Task-MustHaveActivityGraph (ERROR – Task)
    - Task must have atleast one ActivityGraph
  - Inchron-SW-Task-NotAllocated-DifferentSchedulers (ERROR – Task)
    - Task cannot be scheduled by more than one OS
- Profiles:
  - `org.eclipse.app4mc.amalthea.validations.standard.SoftwareProfile`

`org.eclipse.app4mc.amalthea.validations.inchron.InchronStimuliProfile`
Stimuli Validations (INCHRON)

- Validations:
  - Inchron-Stimuli-TypeCheck (ERROR – Stimulus)
    - Unsupported stimuli types