Child: [65cd22] (diff)

Download this file

AE.cc    100 lines (76 with data), 2.6 kB

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Lesser General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public License
// along with this program. If not, see http://www.gnu.org/licenses/.
//
#include "AE.h"
Define_Module(AE);
AE::AE() {
}
AE::~AE() {
}
void AE::initSignalsAndListeners() {
//cModule* catcher = this->getParentModule()->getParentModule();
//Signals that this module is emitting
sigAEAllocReq = registerSignal(SIG_AE_AllocateRequest);
sigAEDeallocReq = registerSignal(SIG_AE_DeallocateRequest);
//Signals that this module is processing
}
void AE::initialize() {
//Init pointers
initPointers();
//Source info
initNamingInfo();
//Setup signals
initSignalsAndListeners();
//Watchers
WATCH_LIST(flows);
}
void AE::handleMessage(cMessage* msg) {
}
void AE::createBinding(Flow& flow) {
EV << this->getFullPath() << " created bindings and registered a new flow" << endl;
//Create new gates
cGate* g1i;
cGate* g1o;
Irm->getOrCreateFirstUnconnectedGatePair(GATE_AEIO, false, true, *&g1i, *&g1o);
//cGate* g0i;
//cGate* g0o;
//this->getOrCreateFirstUnconnectedGatePair("southIo", true, true, *&g0i, *&g0o);
//Get AE gates
cGate* g2i;
cGate* g2o;
this->getOrCreateFirstUnconnectedGatePair(GATE_DATAIO, false, true, *&g2i, *&g2o);
//Connect gates together
g1o->connectTo(g2i);
g2o->connectTo(g1i);
//Set north-half of the routing in ConnectionTable
ConTab->setNorthGates(&flow, g1i, g1o);
}
void AE::initPointers() {
Irm = ModuleAccess<IRM>(MOD_IRM).get();
ConTab = ModuleAccess<ConnectionTable>(MOD_CONNTABLE).get();
}
void AE::signalizeAllocateRequest(Flow* flow) {
emit(sigAEAllocReq, flow);
}
void AE::insertFlow(Flow& flow) {
//Add a new flow to the end of the Flow list
flows.push_back(flow);
//Create a new record in ConnectionTable
ConTab->insertNew(&flows.back());
//Interconnect IRM and AE
createBinding(flows.back());
}
void AE::signalizeDeallocateRequest(Flow* flow) {
emit(sigAEDeallocReq, flow);
}