Commit 837ba17f authored by Maxime Perrotin's avatar Maxime Perrotin
Browse files

Support multiple instance with local context

parent 2e60d725
......@@ -36,6 +36,7 @@
#pragma once
#include "dataview-uniq.h"
#include "@_LOWER:Name_@_state.h"
class @_LOWER:Name_@ {
@@TABLE@@
......@@ -48,6 +49,9 @@ class @_LOWER:Name_@ {
RESET_@_Timers_@_ptr RESET_@_Timers_@;
@@END_TABLE@@
// the ctxt member allows you to define your per-instance global data
@_LOWER:Name_@_state ctxt;
public:
@@IF@@ @_List_Of_RIs'Length_@ = 0 and @_Timers'Length_@ = 0
@_LOWER:Name_@() {}
......
......@@ -28,6 +28,7 @@ PUBLIC
WITH interfaceview::IV::Worker;
WITH interfaceview::IV::Son;
WITH interfaceview::IV::Daugther;
WITH interfaceview::IV::Twin;
WITH ocarina_processors_x86;
WITH deploymentview::DV::Node1;
WITH Taste;
......@@ -48,6 +49,9 @@ SUBCOMPONENTS
IV_Daugther : SYSTEM interfaceview::IV::Daugther::Daugther.others {
Taste::FunctionName => "Daugther";
};
IV_Twin : SYSTEM interfaceview::IV::Twin::Twin.others {
Taste::FunctionName => "Twin";
};
demo : PROCESS deploymentview::DV::Node1::demo.others {
Taste::coordinates => "109723 74124 143183 93800";
Deployment::Port_Number => 0;
......@@ -59,6 +63,7 @@ PROPERTIES
Taste::APLC_Binding => (reference (demo)) APPLIES TO IV_Worker;
Taste::APLC_Binding => (reference (demo)) APPLIES TO IV_Son;
Taste::APLC_Binding => (reference (demo)) APPLIES TO IV_Daugther;
Taste::APLC_Binding => (reference (demo)) APPLIES TO IV_Twin;
Actual_Processor_Binding => (reference (x86_linux)) APPLIES TO demo;
END Node1.others;
......@@ -77,6 +82,6 @@ PROPERTIES
Taste::coordinates => "0 0 297000 210000";
Taste::version => "2.3";
Taste::interfaceView => "InterfaceView.aadl";
Taste::HWLibraries => ("../../../../tool-inst/share/ocarina/AADLv2/ocarina_components.aadl");
Taste::HWLibraries => ("/home/taste/tool-inst/share/ocarina/AADLv2/ocarina_components.aadl");
END deploymentview::DV;
......@@ -45,7 +45,7 @@ FEATURES
};
RI_DoSomething : REQUIRES SUBPROGRAM ACCESS interfaceview::IV::Mother::RI_DoSomething.others {
Taste::coordinates => "91651 65510";
Taste::RCMoperationKind => unprotected;
Taste::RCMoperationKind => protected;
Taste::InterfaceName => "DoSomething";
Taste::labelInheritance => "false";
};
......@@ -87,7 +87,7 @@ SYSTEM Worker
FEATURES
PI_DoSomething : PROVIDES SUBPROGRAM ACCESS interfaceview::IV::Worker::PI_DoSomething.others {
Taste::coordinates => "154169 98581";
Taste::RCMoperationKind => unprotected;
Taste::RCMoperationKind => protected;
Taste::RCMperiod => 0 ms;
Taste::Deadline => 0 ms;
Taste::InterfaceName => "DoSomething";
......@@ -143,7 +143,7 @@ FEATURES
};
RI_DoSomething : REQUIRES SUBPROGRAM ACCESS interfaceview::IV::Worker::PI_DoSomething.others {
Taste::coordinates => "120942 98544";
Taste::RCMoperationKind => unprotected;
Taste::RCMoperationKind => protected;
Taste::InterfaceName => "DoSomething";
Taste::labelInheritance => "false";
};
......@@ -166,6 +166,8 @@ WITH Taste;
WITH DataView;
WITH TASTE_IV_Properties;
SUBPROGRAM PI_Pulse
PROPERTIES
Taste::Associated_Queue_Size => 1;
END PI_Pulse;
SUBPROGRAM IMPLEMENTATION PI_Pulse.others
......@@ -192,11 +194,12 @@ FEATURES
Taste::coordinates => "147083 52282";
Taste::RCMoperationKind => cyclic;
Taste::RCMperiod => 1000 ms;
Taste::Deadline => 0 ms;
Taste::InterfaceName => "Pulse";
};
RI_DoSomething : REQUIRES SUBPROGRAM ACCESS interfaceview::IV::Father::RI_DoSomething.others {
Taste::coordinates => "131020 65353";
Taste::RCMoperationKind => unprotected;
Taste::RCMoperationKind => protected;
Taste::InterfaceName => "DoSomething";
Taste::labelInheritance => "false";
};
......@@ -219,6 +222,8 @@ WITH Taste;
WITH DataView;
WITH TASTE_IV_Properties;
SUBPROGRAM PI_Pulse
PROPERTIES
Taste::Associated_Queue_Size => 1;
END PI_Pulse;
SUBPROGRAM IMPLEMENTATION PI_Pulse.others
......@@ -245,11 +250,12 @@ FEATURES
Taste::coordinates => "135587 75747";
Taste::RCMoperationKind => cyclic;
Taste::RCMperiod => 1000 ms;
Taste::Deadline => 0 ms;
Taste::InterfaceName => "Pulse";
};
RI_DoSomething : REQUIRES SUBPROGRAM ACCESS interfaceview::IV::Worker::PI_DoSomething.others {
Taste::coordinates => "132595 86298";
Taste::RCMoperationKind => unprotected;
Taste::RCMoperationKind => protected;
Taste::InterfaceName => "DoSomething";
Taste::labelInheritance => "false";
};
......@@ -265,6 +271,63 @@ END Daugther.others;
END interfaceview::IV::Daugther;
PACKAGE interfaceview::IV::Twin
PUBLIC
WITH interfaceview::IV::Worker;
WITH Taste;
WITH DataView;
WITH TASTE_IV_Properties;
SUBPROGRAM PI_Pulse
PROPERTIES
Taste::Associated_Queue_Size => 1;
END PI_Pulse;
SUBPROGRAM IMPLEMENTATION PI_Pulse.others
PROPERTIES
Compute_Execution_Time => 0 ms .. 0 ms;
END PI_Pulse.others;
SUBPROGRAM RI_DoSomething
FEATURES
a : IN PARAMETER DataView::T_Int32 {
Taste::encoding => NATIVE;
};
b : OUT PARAMETER DataView::T_Int32 {
Taste::encoding => NATIVE;
};
END RI_DoSomething;
SUBPROGRAM IMPLEMENTATION RI_DoSomething.others
END RI_DoSomething.others;
SYSTEM Twin
FEATURES
PI_Pulse : PROVIDES SUBPROGRAM ACCESS interfaceview::IV::Twin::PI_Pulse.others {
Taste::coordinates => "116987 111581";
Taste::RCMoperationKind => cyclic;
Taste::RCMperiod => 1000 ms;
Taste::Deadline => 0 ms;
Taste::InterfaceName => "Pulse";
};
RI_DoSomething : REQUIRES SUBPROGRAM ACCESS interfaceview::IV::Worker::PI_DoSomething.others {
Taste::coordinates => "129976 113528";
Taste::RCMoperationKind => protected;
Taste::InterfaceName => "DoSomething";
Taste::labelInheritance => "false";
};
PROPERTIES
Source_Language => (CPP);
Taste::Active_Interfaces => any;
Taste::is_Instance_Of => "interfaceview::IV::Father::Father.others";
Taste::is_Instance_Of2 => classifier(interfaceview::IV::Father::Father.others);
END Twin;
SYSTEM IMPLEMENTATION Twin.others
END Twin.others;
END interfaceview::IV::Twin;
PACKAGE interfaceview::IV
PUBLIC
......@@ -273,6 +336,7 @@ WITH interfaceview::IV::Worker;
WITH interfaceview::IV::Son;
WITH interfaceview::IV::Father;
WITH interfaceview::IV::Daugther;
WITH interfaceview::IV::Twin;
WITH Taste;
WITH DataView;
WITH TASTE_IV_Properties;
......@@ -299,6 +363,9 @@ SUBCOMPONENTS
Daugther : SYSTEM interfaceview::IV::Daugther::Daugther.others {
Taste::coordinates => "112911 75747 151650 86298";
};
Twin : SYSTEM interfaceview::IV::Twin::Twin.others {
Taste::coordinates => "103468 111581 129976 126160";
};
CONNECTIONS
Worker_PI_DoSomething_Son_RI_DoSomething : SUBPROGRAM ACCESS Worker.PI_DoSomething -> Son.RI_DoSomething {
Taste::coordinates => "120942 98544 142201 98544 142201 98581 154169 98581";
......@@ -306,6 +373,9 @@ CONNECTIONS
Worker_PI_DoSomething_Daugther_RI_DoSomething : SUBPROGRAM ACCESS Worker.PI_DoSomething -> Daugther.RI_DoSomething {
Taste::coordinates => "132595 86298 132595 98581 154169 98581";
};
Worker_PI_DoSomething_Twin_RI_DoSomething : SUBPROGRAM ACCESS Worker.PI_DoSomething -> Twin.RI_DoSomething {
Taste::coordinates => "129976 113528 142072 113528 142072 98581 154169 98581";
};
END interfaceview.others;
PROPERTIES
......
......@@ -21,9 +21,9 @@ void father::startup()
void father::Pulse(void)
{
asn1SccT_Int32 a = 1, b=5;
RI_DoSomething(&a, &b);
printf("[C++] %lld\n", b);
RI_DoSomething(&ctxt.a, &ctxt.b);
printf("[C++] %lld\n",ctxt.b );
ctxt.a++;
}
......
// Fill in this class with your context data (internal state):
// list all the variables you want global (per function instance)
#include "dataview-uniq.h"
class father_state {
public:
asn1SccT_Int32 a=1, b;
};
......@@ -24,9 +24,9 @@ void worker_PI_DoSomething
asn1SccT_Int32 *OUT_b)
{
static asn1SccT_Int32 prev = 0;
*OUT_b = *IN_a + prev;
prev = *IN_a;
//static asn1SccT_Int32 prev = 0;
*OUT_b = *IN_a + 1; //prev;
//prev = *IN_a;
}
......
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