CMS 3D CMS Logo

FPGAWord.h
Go to the documentation of this file.
1 #ifndef L1Trigger_TrackFindingTracklet_interface_FPGAWord_h
2 #define L1Trigger_TrackFindingTracklet_interface_FPGAWord_h
3 
4 #include <string>
5 #include <cassert>
6 
7 namespace trklet {
8 
9  class FPGAWord {
10  public:
11  FPGAWord();
12 
13  FPGAWord(int value, int nbits, bool positive = true, int line = -1, const char* file = nullptr);
14 
15  ~FPGAWord() = default;
16 
17  void set(int value, int nbits, bool positive = true, int line = -1, const char* file = nullptr);
18 
19  std::string str() const;
20 
21  //return the nbits starting with the lsb. lsb=0 means the least significant bit
22  unsigned int bits(unsigned int lsb, unsigned int nbit) const;
23 
24  int value() const { return value_; }
25  int nbits() const { return nbits_; }
26 
27  bool atExtreme() const;
28 
29  bool operator==(const FPGAWord& other) const;
30 
31  private:
32  int value_{-1};
33  int nbits_{-1};
34  bool positive_{true};
35  };
36 }; // namespace trklet
37 #endif
~FPGAWord()=default
int value() const
Definition: FPGAWord.h:24
bool operator==(const FPGAWord &other) const
Definition: FPGAWord.cc:86
Definition: value.py:1
int nbits() const
Definition: FPGAWord.h:25
unsigned int bits(unsigned int lsb, unsigned int nbit) const
Definition: FPGAWord.cc:74
std::string str() const
Definition: FPGAWord.cc:54
bool atExtreme() const
Definition: FPGAWord.cc:79