CMS 3D CMS Logo

MatchEngineUnit.h
Go to the documentation of this file.
1 /****************************************************************
2  * MatchEngineUnit (MEU) is a single instance of the MatchEngine
3  * section of the MatchProcessor (MP)
4  *
5  * Manual pipelining is implemented to properly emulate the HLS
6  * implementation (required to meet II=1)
7  *
8  * A total of `nMatchEngines_` MEUs are used in the MP
9  ****************************************************************/
10 #ifndef L1Trigger_TrackFindingTracklet_interface_MatchEngineUnit_h
11 #define L1Trigger_TrackFindingTracklet_interface_MatchEngineUnit_h
12 
17 
18 #include <cassert>
19 #include <vector>
20 
21 namespace trklet {
22 
23  class Settings;
24  class Stub;
25  class L1TStub;
26  class TrackletLUT;
27 
29  public:
30  MatchEngineUnit(const Settings& settings, bool barrel, unsigned int layerdisk, const TrackletLUT& luttable);
31 
32  ~MatchEngineUnit() = default;
33 
34  void init(VMStubsMEMemory* vmstubsmemory,
35  unsigned int nrzbin,
36  unsigned int rzbin,
37  unsigned int iphi,
38  int shift,
39  int projrinv,
40  int projfinerz,
41  int projfinephi,
42  bool usefirstMinus,
43  bool usefirstPlus,
44  bool usesecondMinus,
45  bool usesecondPlus,
46  bool isPSseed,
47  Tracklet* proj);
48 
49  bool empty() const { return candmatches_.empty(); }
50 
51  int TCID() const;
52 
53  std::pair<Tracklet*, const Stub*> read() { return candmatches_.read(); }
54 
55  std::pair<Tracklet*, const Stub*> peek() const { return candmatches_.peek(); }
56 
57  bool idle() const { return idle_; }
58 
59  bool active() const { return !idle_ || good__ || good____ || !empty(); }
60 
61  void setAlmostFull();
62 
63  void setimeu(int imeu) { imeu_ = imeu; }
64 
65  void setprint(bool print) { print_ = print; }
66 
67  void reset();
68 
69  unsigned int rptr() const { return candmatches_.rptr(); }
70  unsigned int wptr() const { return candmatches_.wptr(); }
71 
72  void step();
73 
74  void processPipeline();
75 
76  private:
77  //Provide access to constants
79 
81 
82  unsigned int nrzbins_;
83  unsigned int rzbin_, rzbin__, rzbin____, rzbin___;
84  unsigned int phibin_;
85  int shift_;
86 
87  unsigned int istub_;
88  unsigned int iuse_;
89 
90  bool barrel_;
91  int projrinv_;
94  std::vector<std::pair<unsigned int, unsigned int>> use_;
95  bool isPSseed_;
97 
98  bool idle_;
99 
100  unsigned int layerdisk_;
101 
102  //The minimum radius for 2s disks in projection bins
103  unsigned int ir2smin_;
104 
105  //Save state at the start of istep
107 
108  //LUT for bend consistency with rinv
110 
111  //Various manually pipelined variables
112  //Each _ represents a layer of pipelining
113  //e.g., good__ is set and one iteration later good____ is updated
121 
122  //save the candidate matches
124 
125  //debugging help
126  int imeu_;
127  bool print_;
128  };
129 
130 }; // namespace trklet
131 #endif
unsigned int rptr() const
MatchEngineUnit(const Settings &settings, bool barrel, unsigned int layerdisk, const TrackletLUT &luttable)
std::pair< Tracklet *, const Stub * > peek() const
const Settings & settings_
void setprint(bool print)
void init(VMStubsMEMemory *vmstubsmemory, unsigned int nrzbin, unsigned int rzbin, unsigned int iphi, int shift, int projrinv, int projfinerz, int projfinephi, bool usefirstMinus, bool usefirstPlus, bool usesecondMinus, bool usesecondPlus, bool isPSseed, Tracklet *proj)
CircularBuffer< std::pair< Tracklet *, const Stub * > > candmatches_
std::pair< Tracklet *, const Stub * > read()
const TrackletLUT & luttable_
VMStubsMEMemory * vmstubsmemory_
void print(TMatrixD &m, const char *label=nullptr, bool mathematicaFormat=false)
Definition: Utilities.cc:47
std::vector< std::pair< unsigned int, unsigned int > > use_
unsigned int wptr() const
static unsigned int const shift