## 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.HardwareProfile`
  - `org.eclipse.app4mc.amalthea.validations.standard.MappingProfile`
  - `org.eclipse.app4mc.amalthea.validations.standard.OSProfile`
  - `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 response of the last segment has to be the same as the response of the event chain
    - The stimulus of other segments have to be equal to the response of the previous segment
    - The stimulus of the first segment has to be the same as the stimulus 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)
    - AMALTHEA invariants (generated)
    - EMF extended metadata constraints (generated)

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

- Validations:
  - AM-HW-AccessPath (ERROR – HwAccessPath)
    - HwAccessPath elements must be consistent
    - HwAccessPath ranges and memory size must be consistent
  - AM-HW-Connection (ERROR – HwConnection)
    - HwConnections must be linked to HwPorts of the same Interface
    - HwConnections must refer to two HwPorts
  - 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
    - Delegated connections always connect HwPorts of the same type
    - Inner connections always need one Initiator and one Responder HwPort
  - AM-HW-Module-Definition (WARNING – HwModule)
    - Cache definition must be set
    - ConnectionHandler definition must be set
    - Memory definition must be set
    - ProcessingUnit definition must be set
  - AM-HW-Port-BitWidth (WARNING – HwPort)
    - Bitwidth should be greater than zero
  - AM-HW-Port-Definition (WARNING – HwPort)
    - PortInterface must be set
    - PortType 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 top level 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.OSProfile`
OS Validations

- Validations:
  - AM-OS-Mandatory-Scheduling-Parameters-Set (ERROR – Scheduler)
    - Mandatory scheduling parameters must be set
  - AM-OS-Scheduling-Parameter-Value-Number-Matches-Defined-Multiplicity (ERROR – Entry)
    - The number of values of the specified scheduling parameter must match the defined multiplicity in the scheduling parameter definition
  - AM-OS-Scheduling-Parameter-Value-Type-Matches-Defined-Type (ERROR – Entry)
    - The type of the specified scheduling parameter must match the type defined in the scheduling parameter definition
  - AM-OS-Semaphore-Properties-Conform-Type (ERROR – Semaphore)
    - Semaphore properties conform to semaphore type
  - AM-OS-Scheduling-Parameter-Empty-Overriden-Value (WARNING – Entry)
    - There should be a value if a default value of a scheduling parameter is overridden
  - AM-OS-Standard-Scheduler-Definition-Conformance (WARNING – SchedulerDefinition)
    - Standard schedulers with their parameters should be modeled as defined by the APP4MC standard scheduler library
  - AM-OS-Standard-Scheduling-Parameter-Definition-Conformance (WARNING – SchedulingParameterDefinition)
    - Scheduling parameter definition that are used in a standard scheduler should conform to the parameters defined by the APP4MC standard scheduler library

`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
  - AM-SW-Semaphore-Access (ERROR – SemaphoreAccess)
    - Waiting behaviour must be ‘active’ for spinlock semaphore access

#### 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.SimOsProfile`
  - `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 greater than the upper bound
    - Mean must not be less than the lower bound
  - TA-Basic-DiscreteValueGaussDistribution-mean (ERROR – DiscreteValueGaussDistribution)
    - Mean must not be greater than the upper bound
    - Mean must not be less than the lower bound
  - TA-Basic-TimeGaussDistribution-mean (ERROR – TimeGaussDistribution)
    - Mean must not be greater than the upper bound
    - Mean must not be less than the lower bound
  - Sim-supported-model-elements (WARNING – EObject)
    - Checks that the model elements are supported in APP4MC.sim

`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-ProcessingUnit (ERROR – ProcessingUnit)
    - ProcessingUnit definition must be set
  - Sim-HW-AccessElement (WARNING – HwAccessElement)
    - Either hwAccessPath must be set or at least one of read latency and datarate must be set. Either hwAccessPath must be set or at least one of write latency and datarate must be set.
  - Sim-HW-Connection (WARNING – HwConnection)
    - Either read latency or data rate or both must be set. Either write latency or data rate or both must be set.
  - Sim-HW-MemoryDefinition (WARNING – 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-Scheduler-Allocation-Hierarchy (ERROR – SchedulerAllocation)
    - A child scheduler should only be responsible for a subset of processing units of its ancestors
  - AM-Mapping-Scheduler-Allocation-Top-Level-Responsibility (ERROR – MappingModel)
    - A processing unit should have at most one top level task scheduler and one interrupt controller responsible for it
  - AM-Mapping-Scheduler-ProcessingUnit (ERROR – Scheduler)
    - A top level scheduler should be responsible for at least one processing unit
  - AM-Mapping-Task-Scheduler (ERROR – Task)
    - A task should have an allocation to a task scheduler
  - Sim-Mapping-SchedulerAllocation (WARNING – SchedulerAllocation)
    - Executing processing unit must be set

`org.eclipse.app4mc.amalthea.validations.sim.SimOsProfile`
OS model Validations (APP4MC.sim)

- Validations:
  - AM-OS-Mandatory-Scheduling-Parameters-Set (ERROR – Scheduler)
    - Mandatory scheduling parameters must be set
  - AM-OS-Scheduling-Parameter-Value-Number-Matches-Defined-Multiplicity (ERROR – Entry)
    - The number of values of the specified scheduling parameter must match the defined multiplicity in the scheduling parameter definition
  - AM-OS-Scheduling-Parameter-Value-Type-Matches-Defined-Type (ERROR – Entry)
    - The type of the specified scheduling parameter must match the type defined in the scheduling parameter definition
  - AM-OS-Standard-Scheduler-Definition-Conformance (ERROR – SchedulerDefinition)
    - Standard schedulers with their parameters should be modeled as defined by the APP4MC standard scheduler library
  - AM-OS-Standard-Scheduling-Parameter-Definition-Conformance (ERROR – SchedulingParameterDefinition)
    - Scheduling parameter definition that are used in a standard scheduler should conform to the parameters defined by the APP4MC standard scheduler library
  - Inchron-OS-PU-Allocation-MustBeDisjunct (INFO – OperatingSystem)
    - OS Scheduler to core mapping must be distinct

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

- Validations:
  - Sim-Software-AbstractMemoryElementIsMapped (ERROR – Label)
    - Checks if label is mapped to a memory node
  - 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 – 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-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 – ConditionConjunction)
  - TA-Software-ModeConditionDisjunctionAlwaysTrue (WARNING – ConditionDisjunction)
  - Inchron-SW-Runnable-MustHaveActivityGraph (INFO – Runnable)
    - Runnable must have at least one ActivityGraph

#### 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 greater than the upper bound
    - Mean must not be less than the lower bound
  - TA-Basic-DiscreteValueGaussDistribution-mean (ERROR – DiscreteValueGaussDistribution)
    - Mean must not be greater than the upper bound
    - Mean must not be less than the lower bound
  - TA-Basic-TimeGaussDistribution-mean (ERROR – TimeGaussDistribution)
    - Mean must not be greater than the upper bound
    - Mean must not be less than the lower 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-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 – ConditionConjunction)
  - TA-Software-ModeConditionDisjunctionAlwaysTrue (WARNING – ConditionDisjunction)

`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 – Amalthea)
    - 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