Belle II Software  release-08-01-10
Merger.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 TRGCDCMerger_FLAG_
14 #define TRGCDCMerger_FLAG_
15 
16 #include <string>
17 #include "trg/trg/Board.h"
18 #include "trg/trg/SignalVector.h"
19 #include "trg/trg/SignalBundle.h"
20 
21 #ifdef TRGCDC_SHORT_NAMES
22 #define TCMerger TRGCDCMerger
23 #endif
24 
25 namespace Belle2 {
31  class TRGCDCFrontEnd;
32 
35  : public TRGBoard,
36  public std::vector<const TRGCDCFrontEnd*> {
37 
38  public:// enum
40  enum unitType {
41  innerType = 0, // for superlayer 0, connected with FE innerInside and innerOutside
42  outerType = 1, // for superlayer 1-7, connected with FE outerInside and outerOutside
43  unknown = 999
44  };
45 
46 
47  public:
49  /*
50  TRGCDCMerger(const std::string & name,
51  const TRGClock & systemClock,
52  const TRGClock & dataClock,
53  const TRGClock & userClockInput,
54  const TRGClock & userClockOutput);
55  */
56  TRGCDCMerger(const std::string& name,
57  unitType type,
58  const TRGClock& systemClock,
59  const TRGClock& dataClock,
60  const TRGClock& userClockInput,
61  const TRGClock& userClockOutput);
62 
64  virtual ~TRGCDCMerger();
65 
66  public:// Selectors.
67 
69  static std::string version(void);
70 
72  unitType type(void) const;
73 
74  public:// Modifiers
75 
77  void simulate(void);
78 
80  TRGSignalBundle* mosb = nullptr;
81 
82  public:// VHDL utilities
83 
85  static TRGState packerInner(const TRGState& input);
86 
88  static TRGState packerOuter(const TRGState& input);
89 
91  static void unpackerInner(const TRGState& input,
92  const TRGState& output);
93 
95  static void unpackerOuter(const TRGState& input,
96  const TRGState& output);
97 
100  static int implementation(const unitType& type, std::ofstream&);
101 
103  static int implementationPort(const unitType& type, std::ofstream&);
104 
105 
106  public:// Configuration
107 
108  //TRGSignalBundle* output(void) { return _mosb;};
109 //yi TRGSignalBundle* output(void) const { return _mosb;};
110 
112  void push_back(const TRGCDCFrontEnd*);
113 
115  void dump(const std::string& message = "",
116  const std::string& pre = "") const;
117 
119  void dump_log(void) const;
121  void dump_log_inner(void) const;
123  void dump_log_outer(void) const;
124 
125 
126 
127  private:
128 
131 
134 
137 
138 
139 
140  };
141 
142 //-----------------------------------------------------------------------------
143 
145 } // namespace Belle2
146 
147 #endif /* TRGCDCMerger_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
A class to represent a CDC merger board.
Definition: Merger.h:36
TRGSignalBundle * _mosb
outptu signal bundle
Definition: Merger.h:136
TRGSignalBundle * _misb
Input single bundle.
Definition: Merger.h:133
TRGSignalBundle * mosb
Output signal bundle. not the best way to do this though.
Definition: Merger.h:80
unitType _type
Unit type.
Definition: Merger.h:130
unitType
enum of unitType
Definition: Merger.h:40
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
static int implementation(const unitType &type, std::ofstream &)
make a VHDL component file.
Definition: Merger.cc:66
static void unpackerOuter(const TRGState &input, const TRGState &output)
Unpack TRGState.
Definition: Merger.cc:905
void dump_log_outer(void) const
dump_log for outer Merger
Definition: Merger.cc:1173
static int implementationPort(const unitType &type, std::ofstream &)
writes a port map.
Definition: Merger.cc:104
const std::string & name(void) const
returns name.
Definition: Board.h:109
static TRGState packerInner(const TRGState &input)
Make bit pattern using input information from inner FEs.
Definition: Merger.cc:257
void dump_log(void) const
Dump all the details of _mosb into a .log file, do it in the end of simulate()
Definition: Merger.cc:1092
unitType type(void) const
return type.
Definition: Merger.cc:59
virtual ~TRGCDCMerger()
Destructor.
Definition: Merger.cc:48
TRGCDCMerger(const std::string &name, unitType type, const TRGClock &systemClock, const TRGClock &dataClock, const TRGClock &userClockInput, const TRGClock &userClockOutput)
Constructor.
Definition: Merger.cc:34
static TRGState packerOuter(const TRGState &input)
Make bit pattern using input information from outer FEs.
Definition: Merger.cc:460
void dump_log_inner(void) const
dump_log for inner Merger
Definition: Merger.cc:1102
static std::string version(void)
return version.
Definition: Merger.cc:53
void simulate(void)
simulates firmware.
Definition: Merger.cc:155
void push_back(const TRGCDCFrontEnd *)
push back TRGCDCFrontEnd of this Merger
Definition: Merger.cc:143
static void unpackerInner(const TRGState &input, const TRGState &output)
Unpack TRGState.
Definition: Merger.cc:719
void dump(const std::string &message="", const std::string &pre="") const
dumps contents. "message" is to select information to dump. "pre" will be printed in head of each lin...
Definition: Merger.cc:149
Abstract base class for different kinds of events.