-
Notifications
You must be signed in to change notification settings - Fork 1
/
CRU.h
57 lines (50 loc) · 1.39 KB
/
CRU.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
#ifndef _CONSUMER_H
#define _CONSUMER_H
#include <systemc.h>
#include "GlobalConstants.h"
#include "Packet.h"
#include <queue>
#include <map>
#include <string>
using namespace std;
SC_MODULE(CRU)
{
int numberOfSamplesReceived;
queue<Packet> input_fifos[constants::SAMPA_NUMBER_INPUT_PORTS * constants::NUMBER_OF_SAMPA_CHIPS]; // 160 for 1 FEC, 1920 for 12 FEC
queue<Packet> output_fifos[8];
queue<Packet> sentData;
map<int, int> mappingTable;
void sendDataThroughSerialLink(int _link);
void t_sink_0(void);
void t_sink_1(void);
void t_sink_2(void);
void t_sink_3(void);
void t_sink_4(void);
void t_sink_5(void);
void t_sink_6(void);
void t_sink_7(void);
void prepareMappingTable(void);
void readInput(void);
void sendOutput(void);
void write_log_to_file_source(Packet _currentPacket, int _portnr, int _numberOfSamplesReceived);
void write_log_to_file_sink(Packet _currentPacket, int _fifonr);
sc_port < sc_fifo_in_if< Packet> > porter[constants::NUMBER_OF_CHANNELS_BETWEEN_GBT_AND_CRU * (constants::NUMBER_OF_GBT_CHIPS/constants::NUMBER_OF_CRU_CHIPS)];
// Constructor
SC_CTOR(CRU)
{
prepareMappingTable();
SC_THREAD(readInput);
SC_THREAD(sendOutput);
SC_THREAD(t_sink_0);
SC_THREAD(t_sink_1);
SC_THREAD(t_sink_2);
SC_THREAD(t_sink_3);
SC_THREAD(t_sink_4);
SC_THREAD(t_sink_5);
SC_THREAD(t_sink_6);
SC_THREAD(t_sink_7);
}
private:
bool output = false;
};
#endif