-
Notifications
You must be signed in to change notification settings - Fork 0
/
router.h
74 lines (55 loc) · 1.94 KB
/
router.h
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
/*
* router.h
* PhoenixSim
*
* Created by Johnnie Chan on 6/10/11.
* Copyright 2011 Johnnie Chan. All rights reserved.
*
*/
#ifndef __ROUTER_H__
#define __ROUTER_H__
#include <string>
#include "systemc.h"
#include "electronicmessage.h"
#include "routercrossbar.h"
#include "routerbuffer.h"
#include "routerarbiter.h"
#include "OrionPowerParams.h"
namespace PhoenixSim
{
SC_MODULE(Router)
{
// Internal Variables
int numOfInputPorts;
int numOfOutputPorts;
sc_time clockPeriod;
int bufferDepth;
int bufferWidth;
int numOfVirtualChannels;
// Modules
RouterCrossbar* crossbar;
std::vector<RouterBuffer*> buffer;
RouterArbiter* arbiter;
// Ports
std::vector< sc_in<ElectronicMessage*>* > inputPort;
std::vector< sc_out<ElectronicMessage*>* > outputPort;
std::vector< sc_in<int>* > creditInputPort;
std::vector< sc_out<int>* > creditOutputPort;
double GetCumulativePower();
double GetTotalMessagesRouted(){return crossbar->GetTotalMessagesRouted();}
sc_core::sc_module_name routerName;
// Internal Signals
std::vector< sc_buffer<bool>* > sig_bufferPop;
std::vector< sc_buffer<bool>* > sig_dataAvailable;
std::vector< sc_signal<ElectronicMessage*>* > sig_headerData;
std::vector< sc_signal<ElectronicMessage*>* > buf_dataArbiterToSwitch;
std::vector< sc_signal<int>* > sig_controlArbiterToSwitch;
SC_HAS_PROCESS(Router);
Router(sc_module_name name, std::string p_routingPolicy, RoutingParameters* p_routingParameters, unsigned int p_numOfInputPorts, unsigned int p_numOfOutputPorts, unsigned int p_numOfGrants, sc_time p_clockPeriod, unsigned int p_bufferDepth, unsigned int p_bufferWidth, const COrionPowerParams& powerParams, unsigned int p_numOfVirtualChannels = 1);
~Router();
std::vector<sc_spawn_options*> virtualchannel_spawnoptions;
void VirtualChannelSelect(int inputPort);
void sc_trace (sc_trace_file *tf, const std::string &NAME);
};
}
#endif // __ROUTER_H__