Commit 3a5e0b95 authored by Malte Heithoff's avatar Malte Heithoff
Browse files

Add standard library

parent acc75b80
......@@ -4,9 +4,9 @@ package de.monticore.lang.monticar.semantics.library.arithmetic;
component Add<T,N1 n=2> {
port
in T summand[n],
out T sum;
out T sum1;
implementation Math{
sum == sum(summand);
sum1 = sum(summand);
}
}
......@@ -6,6 +6,6 @@ component Constant<T>(T cvalue) {
out T value;
implementation Math{
value == cvalue;
value = cvalue;
}
}
......@@ -7,6 +7,6 @@ component Gain<T>(T gainValue) {
out T output;
implementation Math{
output == input * gainValue;
output = input * gainValue;
}
}
......@@ -4,9 +4,9 @@ package de.monticore.lang.monticar.semantics.library.arithmetic;
component Multiplication<T,N1 n=2> {
port
in T factor[n],
out T product;
out T product1;
implementation Math{
product == product(factor);
product1 == product(factor);
}
}
/* (c) https://github.com/MontiCore/monticore */
package de.monticore.lang.monticar.semantics.library.basicLibrary;
component Delay<T>(T dvalue = 0) {
non-df component Delay<T>(T dvalue = 0) {
port
in T input,
out T output;
......
......@@ -7,7 +7,7 @@ component Derivation<T>(T dvalue = 0) {
out T output;
implementation Math{
in1(t=0) = dvalue;
diff(input) == output;
input(t=0) = dvalue;
diff(input) == output;
}
}
......@@ -7,7 +7,7 @@ component Integrator<T>(T dvalue = 0) {
out T output;
implementation Math{
out1(t=0) = dvalue;
output(t=0) = dvalue;
diff(output) == input;
}
}
/* (c) https://github.com/MontiCore/monticore */
package de.monticore.lang.monticar.semantics.library.specification;
import de.monticore.lang.monticar.semantics.arithmetic.Difference;
component Equality<T> {
port
in T in1,
in T in2;
instance Difference diff1, diff2;
connect in1 -> diff1.in1;
connect in2 -> diff2.in1;
connect diff1.out1 -> diff2.in2;
connect diff2.out1 -> diff1.in2;
}
\ No newline at end of file
/* (c) https://github.com/MontiCore/monticore */
package de.monticore.lang.monticar.semantics.library.specification;
import de.monticore.lang.monticar.semantics.library.arithmetic.Gain;
component Variable<T> {
port
out T out1;
instance Gain<T>(1) gain;
connect gain.out1 -> gain.in1, out1;
}
\ No newline at end of file
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment