1 |
2 |
acastong |
//nophandler_l3.h
|
2 |
|
|
/* ***** BEGIN LICENSE BLOCK *****
|
3 |
|
|
* Version: MPL 1.1
|
4 |
|
|
*
|
5 |
|
|
* The contents of this file are subject to the Mozilla Public License Version
|
6 |
|
|
* 1.1 (the "License"); you may not use this file except in compliance with
|
7 |
|
|
* the License. You may obtain a copy of the License at
|
8 |
|
|
* http://www.mozilla.org/MPL/
|
9 |
|
|
*
|
10 |
|
|
* Software distributed under the License is distributed on an "AS IS" basis,
|
11 |
|
|
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
12 |
|
|
* for the specific language governing rights and limitations under the
|
13 |
|
|
* License.
|
14 |
|
|
*
|
15 |
|
|
* The Original Code is HyperTransport Tunnel IP Core.
|
16 |
|
|
*
|
17 |
|
|
* The Initial Developer of the Original Code is
|
18 |
|
|
* Ecole Polytechnique de Montreal.
|
19 |
|
|
* Portions created by the Initial Developer are Copyright (C) 2005
|
20 |
|
|
* the Initial Developer. All Rights Reserved.
|
21 |
|
|
*
|
22 |
|
|
* Contributor(s):
|
23 |
|
|
* Ami Castonguay <acastong@grm.polymtl.ca>
|
24 |
|
|
* Laurent Aubray
|
25 |
|
|
*
|
26 |
|
|
* Alternatively, the contents of this file may be used under the terms
|
27 |
|
|
* of the Polytechnique HyperTransport Tunnel IP Core Source Code License
|
28 |
|
|
* (the "PHTICSCL License", see the file PHTICSCL.txt), in which case the
|
29 |
|
|
* provisions of PHTICSCL License are applicable instead of those
|
30 |
|
|
* above. If you wish to allow use of your version of this file only
|
31 |
|
|
* under the terms of the PHTICSCL License and not to allow others to use
|
32 |
|
|
* your version of this file under the MPL, indicate your decision by
|
33 |
|
|
* deleting the provisions above and replace them with the notice and
|
34 |
|
|
* other provisions required by the PHTICSCL License. If you do not delete
|
35 |
|
|
* the provisions above, a recipient may use your version of this file
|
36 |
|
|
* under either the MPL or the PHTICSCL License."
|
37 |
|
|
*
|
38 |
|
|
* ***** END LICENSE BLOCK ***** */
|
39 |
|
|
|
40 |
|
|
#ifndef NOPHANDLER_L2_H
|
41 |
|
|
#define NOPHANDLER_L2_H
|
42 |
|
|
|
43 |
|
|
#include "../core_synth/synth_datatypes.h"
|
44 |
|
|
#include "../core_synth/constants.h"
|
45 |
|
|
|
46 |
|
|
///Keeps track of buffer count and requesting that nops are sent
|
47 |
|
|
/**
|
48 |
|
|
The nophandler takes care of tracking the number of buffers that
|
49 |
|
|
are used. It also keeps track of how many buffers the next HT
|
50 |
|
|
node think we have. When necessary, it makes a request to the
|
51 |
|
|
flow control to send a nop to readjust the difference in count.
|
52 |
|
|
*/
|
53 |
|
|
class nophandler_l3: public sc_module
|
54 |
|
|
{
|
55 |
|
|
public:
|
56 |
|
|
|
57 |
|
|
//***********************************
|
58 |
|
|
// Ports definition
|
59 |
|
|
//***********************************
|
60 |
|
|
|
61 |
|
|
/// The Clock
|
62 |
|
|
sc_in<bool> clk;
|
63 |
|
|
|
64 |
|
|
/// Reset signal
|
65 |
|
|
sc_in<bool> resetx;
|
66 |
|
|
//When the flow control sent a nop with buffer information
|
67 |
|
|
sc_in<bool> fc_nop_sent;
|
68 |
|
|
//To notify that packets have been received, one signal per VC
|
69 |
|
|
sc_in<bool> received_packet[3];
|
70 |
|
|
//To notify that packets have been sent and the buffer is free, one signal per VC
|
71 |
|
|
//2 bit vector (one for cleared accepted and one for forward). If the same packet
|
72 |
|
|
//was sent to both accepted and forward, only one of the bits will be asserted
|
73 |
|
|
sc_in<sc_bv<2> > buffers_cleared[3];
|
74 |
|
|
|
75 |
|
|
//To request that a nop be sent
|
76 |
|
|
sc_out<bool> ro_nop_req_fc;
|
77 |
|
|
//The buffer count to send on the nop
|
78 |
|
|
sc_out<sc_bv<6> > ro_buffer_cnt_fc;
|
79 |
|
|
|
80 |
|
|
#ifdef RETRY_MODE_ENABLED
|
81 |
|
|
///RX link is not connected
|
82 |
|
|
sc_in< bool > lk_rx_connected;
|
83 |
|
|
///If the retry mode is active
|
84 |
|
|
sc_in< bool > csr_retry;
|
85 |
|
|
///Let the CSR know we received a non flow control stomped packet
|
86 |
|
|
sc_in<bool> cd_received_non_flow_stomped_ro;
|
87 |
|
|
///Virtual Channel of input VC, only used to clear buffer credit of stomped packet
|
88 |
|
|
sc_in<VirtualChannel> input_packet_vc;
|
89 |
|
|
#endif
|
90 |
|
|
//Count of the number of buffers that are advertised as being free to the next node
|
91 |
|
|
sc_signal<sc_uint<LOG2_NB_OF_BUFFERS + 1> > bufferCount[3];
|
92 |
|
|
//The number of free buffers
|
93 |
|
|
sc_signal<sc_uint<LOG2_NB_OF_BUFFERS + 1> > freeBuffers[3];
|
94 |
|
|
//If a nop has already been requested
|
95 |
|
|
sc_signal<bool> nopRequested;
|
96 |
|
|
|
97 |
|
|
|
98 |
|
|
///All registered signals and outputs are treated here
|
99 |
|
|
void clockedProcess();
|
100 |
|
|
///Get the number of buffers freed in that VC
|
101 |
|
|
sc_uint<2> getBufferFreedNop(const VirtualChannel vc);
|
102 |
|
|
///Outputs the nop request with the correct ro_buffer_cnt_fc value
|
103 |
|
|
void outputNopRequest(
|
104 |
|
|
const sc_uint<LOG2_NB_OF_BUFFERS + 1> buffersThatCanBeFreedWithNop_2,
|
105 |
|
|
const sc_uint<LOG2_NB_OF_BUFFERS + 1> buffersThatCanBeFreedWithNop_1,
|
106 |
|
|
const sc_uint<LOG2_NB_OF_BUFFERS + 1> buffersThatCanBeFreedWithNop_0);
|
107 |
|
|
|
108 |
|
|
///SystemC module macro
|
109 |
|
|
SC_HAS_PROCESS(nophandler_l3);
|
110 |
|
|
/// Constructor of the nophandler_l3 module
|
111 |
|
|
/**
|
112 |
|
|
@param name Name of the module
|
113 |
|
|
*/
|
114 |
|
|
nophandler_l3( sc_module_name name);
|
115 |
|
|
|
116 |
|
|
#ifdef SYSTEMC_SIM
|
117 |
|
|
/// Destructor
|
118 |
|
|
virtual ~nophandler_l3(){}
|
119 |
|
|
#endif
|
120 |
|
|
};
|
121 |
|
|
|
122 |
|
|
#endif
|
123 |
|
|
|