Repository navigation
Expand file tree
/
Copy pathrouterarbiter.h
More file actions
86 lines (63 loc) · 2.48 KB
/
Copy pathrouterarbiter.h
File metadata and controls
86 lines (63 loc) · 2.48 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
/*
* routerarbiter.h
* PhoenixSim
*
* Created by Johnnie Chan on 6/10/11.
* Copyright 2011 Johnnie Chan. All rights reserved.
*
*/
#ifndef __ROUTERARBITER_H__
#define __ROUTERARBITER_H__
#define SC_INCLUDE_DYNAMIC_PROCESSES
#include <vector>
#include <list>
#include <string>
#include "systemc.h"
#include "electronicmessage.h"
#include "routingpolicy.h"
#include "orion/ORION_Arbiter.h"
#include "OrionPowerParams.h"
namespace PhoenixSim
{
SC_MODULE(RouterArbiter)
{
int numOfGrants; // number of grants to issue per clock cycle, maximum is the number of inputs, think of it as functional units
std::vector<int> inputConnectedTo; // index labels input port, value indicates connected output (-1 for no connection)
std::vector<int> outputConnectedTo; // index labels output port, value indicates connected input (-1 for no connection)
std::vector<sc_time> inputEndTime; // index labels input port, time marks when packet finishes traversal
std::vector<sc_time> outputEndTime; // index labels output port, time marks when packet finishes traversal
std::vector< sc_out<bool>* > bufferPopOutputPort;
std::vector< sc_out<int>* > crossbarControlOutputPort;
std::vector<int> varCrossbarControlOutput;
std::vector< sc_in<bool>* > bufferDataAvailablePort;
std::vector< sc_in<ElectronicMessage*>* > dataInputPort;
std::vector< sc_out<ElectronicMessage*>* > dataOutputPort;
std::vector< sc_in<int>* > creditInputPort;
std::vector< sc_out<int>* > creditOutputPort;
std::vector<ElectronicMessage*> varDataOutput;
bool needToWriteOutput;
std::vector<int> remainingCredits;
SC_HAS_PROCESS(RouterArbiter);
RouterArbiter(sc_module_name name, std::string p_routingPolicy, RoutingParameters* p_routingParameters, int p_numOfInputPorts, int p_numOfOutputPorts, int p_numOfGrants, sc_time p_clockPeriod, int p_bufferDepth, int p_bufferWidth, const COrionPowerParams& powerParams, int p_numOfVirtualChannels = 1);
~RouterArbiter();
double GetCumulativePower();
private:
int numOfInputPorts;
int numOfOutputPorts;
sc_time clockPeriod;
int bufferDepth;
int bufferWidth;
int numOfVirtualChannels;
RoutingPolicy* routingPolicy;
int routerId;
sc_event updateEvent, popEvent;
void RoutePacket();
void SetUpdateDelay();
std::vector<sc_spawn_options*> spawnOptions;
void receiveCredit(int portId);
std::list<int>* selectBuffer();
int nextBufferToCheck;
std::map<int, ORION_Arbiter*> power_;
};
}
#endif // __ROUTERARBITER_H__