-
Notifications
You must be signed in to change notification settings - Fork 0
/
electronicpacket_interface.h
86 lines (57 loc) · 1.66 KB
/
electronicpacket_interface.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
74
75
76
77
78
79
80
81
82
83
/*
* electronicpacket_interface.h
* PhoenixSim
*
* Created by Johnnie Chan on 7/8/11.
* Copyright 2011 Johnnie Chan. All rights reserved.
*
*/
#ifndef __ELECTRONICPACKET_INTERFACE_H__
#define __ELECTRONICPACKET_INTERFACE_H__
#include <string>
#include <queue>
#define SC_INCLUDE_DYNAMIC_PROCESSES
#include "systemc.h"
#include "source_interface.h"
#include "trafficgenerator.h"
#include "address.h"
const int DATA_HEADER_SIZE_ = 0;
namespace PhoenixSim
{
class ElectronicPacket_Interface : public Source_Interface
{
public:
SC_HAS_PROCESS(ElectronicPacket_Interface);
ElectronicPacket_Interface(sc_module_name name, sc_time p_clockPeriod, int p_bufferWidth, int p_bufferDepth, int p_maxPacketSize);
~ElectronicPacket_Interface();
void ProcessorDataReceived(int inputPortId);
void NetworkMessageReceived(int inputPortId);
void CreditReceived(int inputPortId);
private:
int numOfProcessorPorts;
sc_time clockPeriod;
int bufferWidth;
std::queue<ElectronicMessage*> messageQueue;
sc_spawn_options* creditReceivedOptions;
sc_spawn_options* networkMessageReceivedOptions;
sc_spawn_options* processorDataReceivedOptions;
int creditsRemaining;
int bufferDepth;
int maxPacketSize;
sc_event controllerEvent;
void Controller();
ElectronicMessage* currentMessage;
ElectronicMessage* currentPacket;
int currentSequenceId;
int remainingData;
bool requestSuccessful;
bool transmissionComplete;
ElectronicMessage* receivingMessage;
bool Request();
bool Prepare();
sc_time Send();
sc_time channelReadyTime;
void Complete();
};
}
#endif // __ELECTRONICPACKET_INTERFACE_H__