Skip to content

Commit

Permalink
Removed more LUTs, commented out old versios for now
Browse files Browse the repository at this point in the history
  • Loading branch information
bryates committed Dec 6, 2023
1 parent 662069c commit 73c6e6b
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 7 deletions.
4 changes: 2 additions & 2 deletions TrackletAlgorithm/MatchEngineUnit.h
Original file line number Diff line number Diff line change
Expand Up @@ -284,7 +284,7 @@ inline void step(const VMStubMECM<VMSMEType> stubmem[4][1<<(kNbitsrzbinMP+kNbits
#endif

inline void set_empty() {
empty_ = emptyUnit<MatchEngineUnitBase<VMProjType>::kNBitsBuffer>()[(readindex_,writeindex_)];
empty_ = emptyUnitBool<MatchEngineUnitBase<VMProjType>::kNBitsBuffer>(readindex_,writeindex_);
}

inline bool empty() const {
Expand All @@ -293,7 +293,7 @@ inline void step(const VMStubMECM<VMSMEType> stubmem[4][1<<(kNbitsrzbinMP+kNbits
}

inline bool nearFull() {
return nearFull3Unit<MatchEngineUnitBase<VMProjType>::kNBitsBuffer>()[(readindex_,writeindex_)];
return nearFull3UnitBool<MatchEngineUnitBase<VMProjType>::kNBitsBuffer>(readindex_,writeindex_);
}

inline bool idle() {
Expand Down
10 changes: 10 additions & 0 deletions TrackletAlgorithm/MatchEngineUnit_parameters.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
// each MEU and that come directly from the wiring.
//

/* REPLACED BY bool version
template<int kNBitsBuffer>
static const ap_uint<(1 << (2 * kNBitsBuffer))> nearFullUnit() {
ap_uint<(1 << (2 * kNBitsBuffer))> lut;
Expand All @@ -20,6 +21,7 @@ static const ap_uint<(1 << (2 * kNBitsBuffer))> nearFullUnit() {
}
return lut;
}
*/

template<int kNBitsBuffer>
static bool nearFullUnitBool(ap_uint<kNBitsBuffer> rptr, ap_uint<kNBitsBuffer> wptr) {
Expand All @@ -28,6 +30,7 @@ static bool nearFullUnitBool(ap_uint<kNBitsBuffer> rptr, ap_uint<kNBitsBuffer> w
return wptr1==rptr || wptr2==rptr;
}

/* REPLACED BY bool version
template<int kNBitsBuffer>
static const ap_uint<(1 << (2 * kNBitsBuffer))> nearFull3Unit() {
ap_uint<(1 << (2 * kNBitsBuffer))> lut;
Expand All @@ -44,6 +47,7 @@ static const ap_uint<(1 << (2 * kNBitsBuffer))> nearFull3Unit() {
}
return lut;
}
*/

template<int kNBitsBuffer>
static bool nearFull3UnitBool(ap_uint<kNBitsBuffer> rptr, ap_uint<kNBitsBuffer> wptr) {
Expand All @@ -53,6 +57,7 @@ static bool nearFull3UnitBool(ap_uint<kNBitsBuffer> rptr, ap_uint<kNBitsBuffer>
return wptr1==rptr || wptr2==rptr || wptr3==rptr;
}

/* REPLACED BY bool version
template<int kNBitsBuffer>
static const ap_uint<(1 << (2 * kNBitsBuffer))> nearFull4Unit() {
ap_uint<(1 << (2 * kNBitsBuffer))> lut;
Expand All @@ -70,6 +75,7 @@ static const ap_uint<(1 << (2 * kNBitsBuffer))> nearFull4Unit() {
}
return lut;
}
*/

template<int kNBitsBuffer>
static bool nearFull4UnitBool(ap_uint<kNBitsBuffer> rptr, ap_uint<kNBitsBuffer> wptr) {
Expand All @@ -80,6 +86,7 @@ static bool nearFull4UnitBool(ap_uint<kNBitsBuffer> rptr, ap_uint<kNBitsBuffer>
return wptr1==rptr || wptr2==rptr || wptr3==rptr || wptr4==rptr;
}

/* REPLACED BY bool version
template<int kNBitsBuffer>
static const ap_uint<(1 << (2 * kNBitsBuffer))> emptyUnit() {
ap_uint<(1 << (2 * kNBitsBuffer))> lut;
Expand All @@ -93,6 +100,7 @@ static const ap_uint<(1 << (2 * kNBitsBuffer))> emptyUnit() {
}
return lut;
}
*/

template<int kNBitsBuffer>
static bool emptyUnitBool(ap_uint<kNBitsBuffer> wptr, ap_uint<kNBitsBuffer> rptr) {
Expand Down Expand Up @@ -144,6 +152,7 @@ static const ap_uint<1 << nbits> isLessThanSize() {
return tab;
}

/* REPLACED BY bool version
template<int nbits, int max, bool lessThan, int proj, int stub>
static const ap_uint<1 << 2*nbits> isLessThanSize() {
ap_uint<1 << 2*nbits> tab(0);
Expand All @@ -165,6 +174,7 @@ static const ap_uint<1 << 2*nbits> isLessThanSize() {
}
return tab;
}
*/

template<int nbits, int max, bool lessThan, int proj, int stub>
static bool isLessThanSizeBool(ap_uint<nbits> projphi, ap_uint<nbits> stubphi) {
Expand Down
5 changes: 2 additions & 3 deletions TrackletAlgorithm/MatchProcessor.h
Original file line number Diff line number Diff line change
Expand Up @@ -1302,9 +1302,8 @@ void MatchProcessor(BXType bx,

auto readptr = projbufferarray.getReadPtr();
auto writeptr = projbufferarray.getWritePtr();
bool empty = emptyUnit<nPRBAbits>()[(readptr,writeptr)];
bool projBuffNearFull = nearFull3Unit<nPRBAbits>()[(readptr,writeptr)];
bool projBuffNearFullB = nearFull3UnitBool<nPRBAbits>(readptr,writeptr);
bool empty = emptyUnitBool<nPRBAbits>(readptr,writeptr);
bool projBuffNearFull = nearFull3UnitBool<nPRBAbits>(readptr,writeptr);

ap_uint<3> iphi = 0;

Expand Down
2 changes: 0 additions & 2 deletions TrackletAlgorithm/ProjectionRouterBufferArray.h
Original file line number Diff line number Diff line change
Expand Up @@ -67,8 +67,6 @@ template<int kNBitsBuffer, int VMProjType, int AllProjectionType> class Projecti
ap_uint<kNBitsBuffer> readptr_ = 0;
ap_uint<kNBitsBuffer> writeptr_ = 0;
ProjectionRouterBuffer<VMProjType,AllProjectionType> projbuffer_[1<<kNBitsBuffer];
ap_uint<(1 << (2 * kNBitsBuffer))> nearFullLUT = nearFullUnit<kNBitsBuffer>();
ap_uint<(1 << (2 * kNBitsBuffer))> emptyLUT = emptyUnit<kNBitsBuffer>();

};

Expand Down

0 comments on commit 73c6e6b

Please sign in to comment.