Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-04-06 12:21:53

0001 #ifndef L1Trigger_TrackFindingTracklet_interface_FPGAWord_h
0002 #define L1Trigger_TrackFindingTracklet_interface_FPGAWord_h
0003 
0004 #include <string>
0005 #include <cassert>
0006 
0007 namespace trklet {
0008 
0009   class FPGAWord {
0010   public:
0011     FPGAWord();
0012 
0013     FPGAWord(int value, int nbits, bool positive = true, int line = -1, const char* file = nullptr);
0014 
0015     ~FPGAWord() = default;
0016 
0017     void set(int value, int nbits, bool positive = true, int line = -1, const char* file = nullptr);
0018 
0019     std::string str() const;
0020 
0021     //return the nbits starting with the lsb. lsb=0 means the least significant bit
0022     unsigned int bits(unsigned int lsb, unsigned int nbit) const;
0023 
0024     int value() const { return value_; }
0025     int nbits() const { return nbits_; }
0026 
0027     bool atExtreme() const;
0028 
0029     bool operator==(const FPGAWord& other) const;
0030 
0031   private:
0032     int value_{-1};
0033     int nbits_{-1};
0034     bool positive_{true};
0035   };
0036 };  // namespace trklet
0037 #endif