m2isar.metamodel.utils.expr_simplifier

A transformation module for simplifying M2-ISA-R behavior expressions. The following simplifications are done:

  • Resolvable m2isar.metamodel.arch.Constant s are replaced by m2isar.metamodel.arch.IntLiteral s representing their value

  • Fully resolvable arithmetic operations are carried out and their results represented as a matching m2isar.metamodel.arch.IntLiteral

  • Conditions and loops with fully resolvable conditions are either discarded entirely or transformed into code blocks without any conditions

  • Ternaries with fully resolvable conditions are transformed into only the matching part

  • Type conversions of m2isar.metamodel.arch.IntLiteral s apply the desired type directly to the IntLiteral and discard the type conversion

Functions

operation(self, context)

binary_operation(self, context)

slice_operation(self, context)

concat_operation(self, context)

number_literal(self, context)

int_literal(self, context)

scalar_definition(self, context)

break_(self, context)

assignment(self, context)

conditional(self, context)

loop(self, context)

ternary(self, context)

return_(self, context)

unary_operation(self, context)

named_reference(self, context)

indexed_reference(self, context)

type_conv(self, context)

callable_(self, context)

group(self, context)

Module Contents

operation(self: m2isar.metamodel.behav.Operation, context)[source]
binary_operation(self: m2isar.metamodel.behav.BinaryOperation, context)[source]
slice_operation(self: m2isar.metamodel.behav.SliceOperation, context)[source]
concat_operation(self: m2isar.metamodel.behav.ConcatOperation, context)[source]
number_literal(self: m2isar.metamodel.behav.IntLiteral, context)[source]
int_literal(self: m2isar.metamodel.behav.IntLiteral, context)[source]
scalar_definition(self: m2isar.metamodel.behav.ScalarDefinition, context)[source]
break_(self: m2isar.metamodel.behav.Break, context)[source]
assignment(self: m2isar.metamodel.behav.Assignment, context)[source]
conditional(self: m2isar.metamodel.behav.Conditional, context)[source]
loop(self: m2isar.metamodel.behav.Loop, context)[source]
ternary(self: m2isar.metamodel.behav.Ternary, context)[source]
return_(self: m2isar.metamodel.behav.Return, context)[source]
unary_operation(self: m2isar.metamodel.behav.UnaryOperation, context)[source]
named_reference(self: m2isar.metamodel.behav.NamedReference, context)[source]
indexed_reference(self: m2isar.metamodel.behav.IndexedReference, context)[source]
type_conv(self: m2isar.metamodel.behav.TypeConv, context)[source]
callable_(self: m2isar.metamodel.behav.Callable, context)[source]
group(self: m2isar.metamodel.behav.Group, context)[source]