MatchLib
ReorderBufWBeats.h
1 /*
2  * Copyright (c) 2017-2019, NVIDIA CORPORATION. All rights reserved.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License")
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 
17 #ifndef __REORDERBUFWBEATS_H__
18 #define __REORDERBUFWBEATS_H__
19 
20 #include <ReorderBuf.h>
21 
30 template <typename Data, unsigned int Depth, unsigned int InFlight>
31 class ReorderBufWBeats : public ReorderBuf<Data, Depth, InFlight> {
32 
33  public:
35 
36  bool canReceiveBeats()
37  {
38  // Beats do not have a guaranteed space in storage
39  // since storage corresponds to vbits fifo,
40  // we can just check that vfifo is not full
42  }
43 
44  void addBeat(const Data& data) {
45  typename ReorderBuf<Data, Depth, InFlight>::EntryNum entryNum =
47  ReorderBuf<Data, Depth, InFlight>::storage.write(entryNum, 0, data);
48  // so that response can be read out later
50  }
51 };
52 
53 #endif
Reorder Buffer that allows out-of-order writes to queue and in-order reads.
Definition: ReorderBuf.h:68
An extension of ReorderBuf that allows one entry to contain multiple beats of data.