Belle II Software development
FrontEnd.h
1/**************************************************************************
2 * basf2 (Belle II Analysis Software Framework) *
3 * Author: The Belle II Collaboration *
4 * *
5 * See git log for contributors and copyright holders. *
6 * This file is licensed under LGPL-3.0, see LICENSE.md. *
7 **************************************************************************/
8
9//-----------------------------------------------------------------------------
10// Description : A class to represent a CDC front-end board
11//-----------------------------------------------------------------------------
12
13#ifndef TRGCDCFrontEnd_FLAG_
14#define TRGCDCFrontEnd_FLAG_
15
16#include <fstream>
17#include <string>
18#include "trg/trg/Board.h"
19#include "trg/trg/SignalVector.h"
20#include "trg/trg/SignalBundle.h"
21
22#ifdef TRGCDC_SHORT_NAMES
23#define TCFrontEnd TRGCDCFrontEnd
24#endif
25
26namespace Belle2 {
32 class TRGCDCWire;
33
36 : public TRGBoard,
37 public std::vector<const TRGCDCWire*> {
38
39 public:// enum
41 enum boardType {
42 innerInside = 0, // inner of the inner-most super layer
43 innerOutside = 1, // outer of the inner-most super layer
44 outerInside = 2, // inner of the ouer super layer
45 outerOutside = 3, // outer of the ouer super layer
46 unknown = 999
47 };
48
49 public:
50
52 TRGCDCFrontEnd(const std::string& name,
54 const TRGClock& systemClock,
55 const TRGClock& dataClock,
56 const TRGClock& userClock);
57
59 virtual ~TRGCDCFrontEnd();
60
61
62 public:// Selectors
63
65 static std::string version(void);
66
68 boardType type(void) const;
69
70 public:// Modifiers
71
73 void simulate(void);
74
76 // TRGSignalBundle output(void) { return *_osb;};
77 TRGSignalBundle* getOSB(void) const { return _osb; };
78
79
80 public:// VHDL utilities
81
83 static TRGState packerInnerInside(const TRGState& input);
84
86 static TRGState packerInnerOutside(const TRGState& input);
87
89 static TRGState packerOuterInside(const TRGState& input);
90
92 static TRGState packerOuterOutside(const TRGState& input);
93
95 static void unpackerInnerInside(const TRGState& input,
96 const TRGState& output);
97
99 static void unpackerInnerOutside(const TRGState& input,
100 const TRGState& output);
101
103 static void unpackerOuterInside(const TRGState& input,
104 const TRGState& output);
105
107 static void unpackerOuterOutside(const TRGState& input,
108 const TRGState& output);
109
112 static int implementation(const boardType& type, std::ofstream&);
113
115 static int implementationPort(const boardType& type, std::ofstream&);
116
117 public:// Configuration
118
120 void push_back(const TRGCDCWire*);
121
124 void dump(const std::string& message = "",
125 const std::string& pre = "") const;
126
128 void dump_log(void) const;
130 void dump_log_innerInside(void) const;
132 void dump_log_innerOutside(void) const;
134 void dump_log_outerInside(void) const;
136 void dump_log_outerOutside(void) const;
137
138// public: // allow Merger class to access FrontEnd data
139
140 //friend class TRGCDCMerger;
141
142 private:
143
146
149
152 };
153
154//-----------------------------------------------------------------------------
155
157} // namespace Belle2
158
159#endif /* TRGCDCFrontEnd_FLAG_ */
A class to represent a trigger board.
Definition: Board.h:25
A class to represent a CDC front-end board.
Definition: FrontEnd.h:37
TRGSignalBundle * _isb
Input signal bundle.
Definition: FrontEnd.h:148
boardType _type
Board type.
Definition: FrontEnd.h:145
TRGSignalBundle * getOSB(void) const
output from FrontEnd
Definition: FrontEnd.h:77
TRGSignalBundle * _osb
Output signal bundle.
Definition: FrontEnd.h:151
boardType
enum boardType
Definition: FrontEnd.h:41
A class to represent a wire in CDC.
Definition: Wire.h:56
A class to represent a digitized signal. Unit is nano second.
Definition: Clock.h:38
A class to represent a bundle of SignalVectors.
Definition: SignalBundle.h:26
A class to represent a state of multi bits.
Definition: State.h:24
void dump_log_innerOutside(void) const
Dump all the details of _mosb into a .log file, for innerOutside FE.
Definition: FrontEnd.cc:1668
static TRGState packerOuterInside(const TRGState &input)
Makes bit pattern using input bit pattern for the inner FE.
Definition: FrontEnd.cc:923
static int implementationPort(const boardType &type, std::ofstream &)
writes a port map.
Definition: FrontEnd.cc:102
static TRGState packerInnerInside(const TRGState &input)
Makes bit pattern using input bit pattern for the inner FE.
Definition: FrontEnd.cc:341
const std::string & name(void) const
returns name.
Definition: Board.h:109
static void unpackerOuterOutside(const TRGState &input, const TRGState &output)
Unpacks TRGState.
Definition: FrontEnd.cc:1519
void dump_log(void) const
Dump all the details of _mosb into a .log file, do it in the end of simulate()
Definition: FrontEnd.cc:1600
static void unpackerInnerOutside(const TRGState &input, const TRGState &output)
Unpacks TRGState.
Definition: FrontEnd.cc:1368
static TRGState packerInnerOutside(const TRGState &input)
Makes bit pattern using input bit pattern for the outer FE.
Definition: FrontEnd.cc:571
static void unpackerOuterInside(const TRGState &input, const TRGState &output)
Unpacks TRGState.
Definition: FrontEnd.cc:1438
void dump_log_outerInside(void) const
Dump all the details of _mosb into a .log file, for outerInside FE.
Definition: FrontEnd.cc:1718
boardType type(void) const
returns type.
Definition: FrontEnd.cc:59
static int implementation(const boardType &type, std::ofstream &)
make a VHDL component file.
Definition: FrontEnd.cc:65
static TRGState packerOuterOutside(const TRGState &input)
Makes bit pattern using input bit pattern for the outer FE.
Definition: FrontEnd.cc:1104
static std::string version(void)
returns version.
Definition: FrontEnd.cc:53
void simulate(void)
simulates firmware.
Definition: FrontEnd.cc:152
virtual ~TRGCDCFrontEnd()
Destructor.
Definition: FrontEnd.cc:48
void dump_log_innerInside(void) const
Dump all the details of _mosb into a .log file, for innerInside FE.
Definition: FrontEnd.cc:1611
void dump_log_outerOutside(void) const
Dump all the details of _mosb into a .log file, for outerOutside FE.
Definition: FrontEnd.cc:1771
static void unpackerInnerInside(const TRGState &input, const TRGState &output)
Unpacks TRGState.
Definition: FrontEnd.cc:1273
void push_back(const TRGCDCWire *)
push back TRGCDCWire for this Front-end
Definition: FrontEnd.cc:140
void dump(const std::string &message="", const std::string &pre="") const
dumps contents.
Definition: FrontEnd.cc:146
Abstract base class for different kinds of events.