Belle II Software  release-05-02-19
Merger.h
1 //-----------------------------------------------------------------------------
2 // $Id$
3 //-----------------------------------------------------------------------------
4 // Filename : Merger.h
5 // Section : TRG CDC
6 // Owner : Yoshihito Iwasaki
7 // Email : yoshihito.iwasaki@kek.jp
8 //-----------------------------------------------------------------------------
9 // Description : A class to represent a CDC front-end board
10 //-----------------------------------------------------------------------------
11 // $Log$
12 //-----------------------------------------------------------------------------
13 
14 #ifndef TRGCDCMerger_FLAG_
15 #define TRGCDCMerger_FLAG_
16 
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 TCMerger TRGCDCMerger
24 #endif
25 
26 namespace Belle2 {
32  class TRGCDCFrontEnd;
33 
36  : public TRGBoard,
37  public std::vector<const TRGCDCFrontEnd*> {
38 
39  public:// enum
41  enum unitType {
42  innerType = 0, // for superlayer 0, connected with FE innerInside and innerOutside
43  outerType = 1, // for superlayer 1-7, connected with FE outerInside and outerOutside
44  unknown = 999
45  };
46 
47 
48  public:
50  /*
51  TRGCDCMerger(const std::string & name,
52  const TRGClock & systemClock,
53  const TRGClock & dataClock,
54  const TRGClock & userClockInput,
55  const TRGClock & userClockOutput);
56  */
57  TRGCDCMerger(const std::string& name,
58  unitType type,
59  const TRGClock& systemClock,
60  const TRGClock& dataClock,
61  const TRGClock& userClockInput,
62  const TRGClock& userClockOutput);
63 
65  virtual ~TRGCDCMerger();
66 
67  public:// Selectors.
68 
70  static std::string version(void);
71 
73  unitType type(void) const;
74 
75  public:// Modifiers
76 
78  void simulate(void);
79 
81  TRGSignalBundle* mosb = nullptr;
82 
83  public:// VHDL utilities
84 
86  static TRGState packerInner(const TRGState& input);
87 
89  static TRGState packerOuter(const TRGState& input);
90 
92  static void unpackerInner(const TRGState& input,
93  const TRGState& output);
94 
96  static void unpackerOuter(const TRGState& input,
97  const TRGState& output);
98 
101  static int implementation(const unitType& type, std::ofstream&);
102 
104  static int implementationPort(const unitType& type, std::ofstream&);
105 
106 
107  public:// Configuration
108 
109  //TRGSignalBundle* output(void) { return _mosb;};
110 //yi TRGSignalBundle* output(void) const { return _mosb;};
111 
113  void push_back(const TRGCDCFrontEnd*);
114 
116  void dump(const std::string& message = "",
117  const std::string& pre = "") const;
118 
120  void dump_log(void) const;
122  void dump_log_inner(void) const;
124  void dump_log_outer(void) const;
125 
126 
127 
128  private:
129 
132 
135 
138 
139 
140 
141  };
142 
143 //-----------------------------------------------------------------------------
144 
146 } // namespace Belle2
147 
148 #endif /* TRGCDCMerger_FLAG_ */
Belle2::TRGCDCMerger::dump_log_inner
void dump_log_inner(void) const
dump_log for inner Merger
Definition: Merger.cc:1105
Belle2::TRGCDCMerger::_mosb
TRGSignalBundle * _mosb
outptu signal bundle
Definition: Merger.h:137
Belle2::TRGBoard
A class to represent a trigger board.
Definition: Board.h:30
Belle2::TRGCDCMerger::TRGCDCMerger
TRGCDCMerger(const std::string &name, unitType type, const TRGClock &systemClock, const TRGClock &dataClock, const TRGClock &userClockInput, const TRGClock &userClockOutput)
Constructor.
Definition: Merger.cc:37
Belle2::TRGCDCMerger::unitType
unitType
enum of unitType
Definition: Merger.h:41
Belle2::TRGCDCMerger::simulate
void simulate(void)
simulates firmware.
Definition: Merger.cc:158
Belle2::TRGCDCMerger::unpackerOuter
static void unpackerOuter(const TRGState &input, const TRGState &output)
Unpack TRGState.
Belle2::TRGState
A class to represent a state of multi bits.
Definition: State.h:29
Belle2::TRGCDCMerger::implementationPort
static int implementationPort(const unitType &type, std::ofstream &)
writes a port map.
Definition: Merger.cc:107
Belle2::TRGCDCMerger::packerOuter
static TRGState packerOuter(const TRGState &input)
Make bit pattern using input information from outer FEs.
Belle2::TRGCDCFrontEnd
A class to represent a CDC front-end board.
Definition: FrontEnd.h:36
Belle2::TRGCDCMerger
A class to represent a CDC merger board.
Definition: Merger.h:35
Belle2::TRGSignalBundle
A class to represent a bundle of SignalVectors.
Definition: SignalBundle.h:31
Belle2::TRGBoard::name
const std::string & name(void) const
returns name.
Definition: Board.h:114
Belle2::TRGCDCMerger::dump_log
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:1095
Belle2::TRGCDCMerger::implementation
static int implementation(const unitType &type, std::ofstream &)
make a VHDL component file.
Definition: Merger.cc:69
Belle2::TRGCDCMerger::dump
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:152
Belle2::TRGCDCMerger::dump_log_outer
void dump_log_outer(void) const
dump_log for outer Merger
Definition: Merger.cc:1176
Belle2::TRGCDCMerger::push_back
void push_back(const TRGCDCFrontEnd *)
push back TRGCDCFrontEnd of this Merger
Definition: Merger.cc:146
Belle2::TRGCDCMerger::packerInner
static TRGState packerInner(const TRGState &input)
Make bit pattern using input information from inner FEs.
Belle2::TRGCDCMerger::version
static std::string version(void)
return version.
Definition: Merger.cc:56
Belle2
Abstract base class for different kinds of events.
Definition: MillepedeAlgorithm.h:19
Belle2::TRGCDCMerger::_misb
TRGSignalBundle * _misb
Input single bundle.
Definition: Merger.h:134
Belle2::TRGCDCMerger::~TRGCDCMerger
virtual ~TRGCDCMerger()
Destructor.
Definition: Merger.cc:51
Belle2::TRGCDCMerger::type
unitType type(void) const
return type.
Definition: Merger.cc:62
Belle2::TRGCDCMerger::unpackerInner
static void unpackerInner(const TRGState &input, const TRGState &output)
Unpack TRGState.
Belle2::TRGCDCMerger::_type
unitType _type
Unit type.
Definition: Merger.h:131
Belle2::TRGClock
A class to represent a digitized signal. Unit is nano second.
Definition: Clock.h:43
Belle2::TRGCDCMerger::mosb
TRGSignalBundle * mosb
Output signal bundle. not the best way to do this though.
Definition: Merger.h:81