1 |
2 |
acastong |
//csr_l2.h
|
2 |
|
|
|
3 |
|
|
/* ***** BEGIN LICENSE BLOCK *****
|
4 |
|
|
* Version: MPL 1.1
|
5 |
|
|
*
|
6 |
|
|
* The contents of this file are subject to the Mozilla Public License Version
|
7 |
|
|
* 1.1 (the "License"); you may not use this file except in compliance with
|
8 |
|
|
* the License. You may obtain a copy of the License at
|
9 |
|
|
* http://www.mozilla.org/MPL/
|
10 |
|
|
*
|
11 |
|
|
* Software distributed under the License is distributed on an "AS IS" basis,
|
12 |
|
|
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
13 |
|
|
* for the specific language governing rights and limitations under the
|
14 |
|
|
* License.
|
15 |
|
|
*
|
16 |
|
|
* The Original Code is HyperTransport Tunnel IP Core.
|
17 |
|
|
*
|
18 |
|
|
* The Initial Developer of the Original Code is
|
19 |
|
|
* Ecole Polytechnique de Montreal.
|
20 |
|
|
* Portions created by the Initial Developer are Copyright (C) 2005
|
21 |
|
|
* the Initial Developer. All Rights Reserved.
|
22 |
|
|
*
|
23 |
|
|
* Contributor(s):
|
24 |
|
|
* Michel Morneau
|
25 |
|
|
* Ami Castonguay <acastong@grm.polymtl.ca>
|
26 |
|
|
*
|
27 |
|
|
* Alternatively, the contents of this file may be used under the terms
|
28 |
|
|
* of the Polytechnique HyperTransport Tunnel IP Core Source Code License
|
29 |
|
|
* (the "PHTICSCL License", see the file PHTICSCL.txt), in which case the
|
30 |
|
|
* provisions of PHTICSCL License are applicable instead of those
|
31 |
|
|
* above. If you wish to allow use of your version of this file only
|
32 |
|
|
* under the terms of the PHTICSCL License and not to allow others to use
|
33 |
|
|
* your version of this file under the MPL, indicate your decision by
|
34 |
|
|
* deleting the provisions above and replace them with the notice and
|
35 |
|
|
* other provisions required by the PHTICSCL License. If you do not delete
|
36 |
|
|
* the provisions above, a recipient may use your version of this file
|
37 |
|
|
* under either the MPL or the PHTICSCL License."
|
38 |
|
|
*
|
39 |
|
|
* ***** END LICENSE BLOCK ***** */
|
40 |
|
|
|
41 |
|
|
#ifndef CSR_L2_H
|
42 |
|
|
#define CSR_L2_H
|
43 |
|
|
|
44 |
|
|
|
45 |
|
|
#include "../core_synth/synth_datatypes.h"
|
46 |
|
|
#include "../core_synth/constants.h"
|
47 |
|
|
|
48 |
|
|
|
49 |
|
|
/// Configuration Space Registers (CSR) of HyperTransport tunnel
|
50 |
|
|
/**
|
51 |
|
|
This module contains all Configuration registers required for
|
52 |
|
|
HyperTransport tunnel. Capabilities block implanted are:
|
53 |
|
|
Device Header, Interface, Error Retry, Direct Route, Revision ID
|
54 |
|
|
and Unit ID Clumping. It manages registers, receive and send
|
55 |
|
|
required signals to/from other modules, and processes Write and
|
56 |
|
|
Read request packets addressed to CSR.
|
57 |
|
|
|
58 |
|
|
@author
|
59 |
|
|
Current implementation: Ami Castonguay
|
60 |
|
|
Original software implementation : Michel Morneau
|
61 |
|
|
|
62 |
|
|
Configuration registers -->
|
63 |
|
|
All registers are implanted using the same hierarchy as the
|
64 |
|
|
HyperTransport specification. Implanted blocks contain a certain
|
65 |
|
|
number of double-words addresses corresponding to byte addressing.
|
66 |
|
|
Each of those double-words contains a certain number of registers,
|
67 |
|
|
that may contain a set of flags.
|
68 |
|
|
|
69 |
|
|
Control signals -->
|
70 |
|
|
The registers required by other modules are outputed as signals
|
71 |
|
|
and updated at each clock cycle. CSR reads some state signals
|
72 |
|
|
from other module, and update corresponding signals at each clock
|
73 |
|
|
cycle.
|
74 |
|
|
|
75 |
|
|
Request packets -->
|
76 |
|
|
CSR reads packets from Reordering module. Valid packets are Write
|
77 |
|
|
and Read. For a write packet, data is requested in Data Buffer
|
78 |
|
|
module and then written in CSR registers. 1 double-word data is
|
79 |
|
|
processed each clock cycle. For non-posted write, a Target Done
|
80 |
|
|
packet is sent to Flow Control module. For a read packet, a Read
|
81 |
|
|
Response packet is sent to Flow Control module, followed by requested
|
82 |
|
|
double-words from CSR.
|
83 |
|
|
*/
|
84 |
|
|
class csr_l2 : public sc_module
|
85 |
|
|
{
|
86 |
|
|
///Sates for the CSR state machine
|
87 |
|
|
enum csr_states {
|
88 |
|
|
CSR_IDLE, /**<The CSR is waiting for requests*/
|
89 |
|
|
CSR_BEGIN_BYTE_WRITE,/**<Send data address to DataBuffer*/
|
90 |
|
|
CSR_BYTE_WRITE_MASK,/**<Get the write mask from the DataBuffer*/
|
91 |
|
|
CSR_BYTE_WRITE,/**<Do the actual byte write*/
|
92 |
|
|
CSR_IDLE_TARGET_DONE_PENDING,/**<TargetDone waiting to be sent, stay in
|
93 |
|
|
this state until it cas be sent*/
|
94 |
|
|
CSR_BEGIN_DWORD_WRITE,/**<Send data address to DataBuffer*/
|
95 |
|
|
CSR_DWORD_WRITE,/**<Do the actual dword write*/
|
96 |
|
|
CSR_BEGIN_READ_WAIT_TGTDONE,/**<Begin a read operation, but first wait
|
97 |
|
|
for the current target done to be sent*/
|
98 |
|
|
CSR_BEGIN_READ,/**<Start the read : send the read command packet*/
|
99 |
|
|
CSR_READ,/**<Continue reading and sending the read data*/
|
100 |
|
|
};
|
101 |
|
|
|
102 |
|
|
public:
|
103 |
|
|
|
104 |
|
|
//*******************
|
105 |
|
|
// General signals
|
106 |
|
|
//*******************
|
107 |
|
|
|
108 |
|
|
/// Clock signal
|
109 |
|
|
sc_in_clk clk;
|
110 |
|
|
|
111 |
|
|
///Reset signal (active low)
|
112 |
|
|
sc_in<bool> resetx;
|
113 |
|
|
///If the power is stable, (for cold reset)
|
114 |
|
|
sc_in<bool> pwrok;
|
115 |
|
|
///Asserted when the link goes in ldtstop (power saving) mode (active low)
|
116 |
|
|
sc_in<bool> ldtstopx;
|
117 |
|
|
|
118 |
|
|
/** asserted when there is a cold reset*/
|
119 |
|
|
sc_signal<bool> coldrstx;
|
120 |
|
|
|
121 |
|
|
///If the tunnel is in sync mode
|
122 |
|
|
/**
|
123 |
|
|
When a critical error is detected, sync flood is sent. When
|
124 |
|
|
a sync flood is received, we also fall in sync mode. This
|
125 |
|
|
cascades and resyncs the complete HT chain.
|
126 |
|
|
*/
|
127 |
|
|
sc_out<bool> csr_sync;
|
128 |
|
|
|
129 |
|
|
//****************************************************
|
130 |
|
|
// Signals for communication with User Interface module
|
131 |
|
|
//****************************************************
|
132 |
|
|
|
133 |
|
|
/** Access to the databuffer is shared with UI, must request acess*/
|
134 |
|
|
sc_out<bool> csr_request_databuffer0_access_ui;
|
135 |
|
|
/** Access to the databuffer is shared with UI, must request acess*/
|
136 |
|
|
sc_out<bool> csr_request_databuffer1_access_ui;
|
137 |
|
|
/** When the access to databuffer is granted following the assertion of
|
138 |
|
|
::csr_request_databuffer0_access_ui or ::csr_request_databuffer1_access_ui*/
|
139 |
|
|
sc_in<bool> ui_databuffer_access_granted_csr;
|
140 |
|
|
|
141 |
|
|
|
142 |
|
|
//****************************************************
|
143 |
|
|
// Signals for communication with Reordering module
|
144 |
|
|
//****************************************************
|
145 |
|
|
|
146 |
|
|
/** @name Reordering
|
147 |
|
|
* Signals for communication with Reordering module
|
148 |
|
|
*/
|
149 |
|
|
//@{
|
150 |
|
|
/** Packet is ready to read from Reordering module */
|
151 |
|
|
sc_in<bool> ro0_available_csr;
|
152 |
|
|
/** Packet from Reordering module */
|
153 |
|
|
sc_in<syn_ControlPacketComplete > ro0_packet_csr;
|
154 |
|
|
/** Packet from Reordering has been read by CSR */
|
155 |
|
|
sc_out<bool> csr_ack_ro0;
|
156 |
|
|
|
157 |
|
|
/** Packet is ready to read from Reordering module */
|
158 |
|
|
sc_in<bool> ro1_available_csr;
|
159 |
|
|
/** Packet from Reordering module */
|
160 |
|
|
sc_in<syn_ControlPacketComplete > ro1_packet_csr;
|
161 |
|
|
/** Packet from Reordering has been read by CSR */
|
162 |
|
|
sc_out<bool> csr_ack_ro1;
|
163 |
|
|
|
164 |
|
|
//@}
|
165 |
|
|
|
166 |
|
|
|
167 |
|
|
//*****************************************************
|
168 |
|
|
// Signals for communication with Data Buffer module
|
169 |
|
|
//*****************************************************
|
170 |
|
|
|
171 |
|
|
/** @name DataBuffer
|
172 |
|
|
* Signals for communication with Data Buffer module
|
173 |
|
|
*/
|
174 |
|
|
//@{
|
175 |
|
|
|
176 |
|
|
/** Consume data from Data Buffer 0 */
|
177 |
|
|
sc_out<bool> csr_read_db0;
|
178 |
|
|
/** Consume data from Data Buffer 1 */
|
179 |
|
|
sc_out<bool> csr_read_db1;
|
180 |
|
|
|
181 |
|
|
/** Address of the data packet requested in Data Buffer 0 */
|
182 |
|
|
sc_out<sc_uint<BUFFERS_ADDRESS_WIDTH> > csr_address_db0;
|
183 |
|
|
/** Address of the data packet requested in Data Buffer 1 */
|
184 |
|
|
sc_out<sc_uint<BUFFERS_ADDRESS_WIDTH> > csr_address_db1;
|
185 |
|
|
|
186 |
|
|
/** Virtual Channel of the data requested in Data Buffer 0 */
|
187 |
|
|
sc_out<VirtualChannel > csr_vctype_db0;
|
188 |
|
|
/** Virtual Channel of the data requested in Data Buffer 1 */
|
189 |
|
|
sc_out<VirtualChannel > csr_vctype_db1;
|
190 |
|
|
|
191 |
|
|
/** 32 bit data sent from Data Buffer to CSR */
|
192 |
|
|
sc_in<sc_bv<32> > db0_data_csr;
|
193 |
|
|
/** 32 bit data sent from Data Buffer to CSR */
|
194 |
|
|
sc_in<sc_bv<32> > db1_data_csr;
|
195 |
|
|
|
196 |
|
|
/** Last dword of data from Data Buffer 0 */
|
197 |
|
|
sc_out<bool> csr_erase_db0;
|
198 |
|
|
/** Last dword of data from Data Buffer 1 */
|
199 |
|
|
sc_out<bool> csr_erase_db1;
|
200 |
|
|
//@}
|
201 |
|
|
|
202 |
|
|
|
203 |
|
|
//******************************************************
|
204 |
|
|
// Signals for communication with Flow Control module
|
205 |
|
|
//******************************************************
|
206 |
|
|
|
207 |
|
|
/** @name FlowControl
|
208 |
|
|
* Signals for communication with Flow Control module
|
209 |
|
|
*/
|
210 |
|
|
//@{
|
211 |
|
|
|
212 |
|
|
/** Request to Flow Control to send packet */
|
213 |
|
|
sc_out<bool> csr_available_fc0;
|
214 |
|
|
/** 32 bit packet or data to Flow Control */
|
215 |
|
|
sc_out<sc_bv<32> > csr_dword_fc0;
|
216 |
|
|
/** Flow Control has read the last 32 bit packet or data */
|
217 |
|
|
sc_in<bool> fc0_ack_csr;
|
218 |
|
|
|
219 |
|
|
|
220 |
|
|
/** Request to Flow Control to send packet */
|
221 |
|
|
sc_out<bool> csr_available_fc1;
|
222 |
|
|
/** 32 bit packet or data to Flow Control */
|
223 |
|
|
sc_out<sc_bv<32> > csr_dword_fc1;
|
224 |
|
|
/** Flow Control has read the last 32 bit packet or data */
|
225 |
|
|
sc_in<bool> fc1_ack_csr;
|
226 |
|
|
|
227 |
|
|
//@}
|
228 |
|
|
|
229 |
|
|
|
230 |
|
|
|
231 |
|
|
//************************************************************
|
232 |
|
|
// Normal input signals from other modules to CSR registers
|
233 |
|
|
//************************************************************
|
234 |
|
|
|
235 |
|
|
/*
|
236 |
|
|
* Input signals received from other modules to CSR
|
237 |
|
|
*/
|
238 |
|
|
|
239 |
|
|
/** @name Packet analysis from UI
|
240 |
|
|
Signals that come from analyzed packet going through the UI */
|
241 |
|
|
//@{
|
242 |
|
|
///Posted packet with a data error detected
|
243 |
|
|
sc_in<bool> ui_sendingPostedDataError_csr;
|
244 |
|
|
///Packet with a TargetAbort detected
|
245 |
|
|
sc_in<bool> ui_sendingTargetAbort_csr;
|
246 |
|
|
///Response packet with a data error detected
|
247 |
|
|
sc_in<bool> ui_receivedResponseDataError_csr;
|
248 |
|
|
///Posted packet with a data error received
|
249 |
|
|
sc_in<bool> ui_receivedPostedDataError_csr;
|
250 |
|
|
///Packet with target abort received
|
251 |
|
|
sc_in<bool> ui_receivedTargetAbort_csr;
|
252 |
|
|
///Packet with master abort received
|
253 |
|
|
sc_in<bool> ui_receivedMasterAbort_csr;
|
254 |
|
|
//@}
|
255 |
|
|
|
256 |
|
|
///When the user received a response with an error
|
257 |
|
|
sc_in<bool> usr_receivedResponseError_csr;
|
258 |
|
|
|
259 |
|
|
|
260 |
|
|
/** @name Register extension interface
|
261 |
|
|
Signals to allow external registers with minimal logic
|
262 |
|
|
Connect usr_read_data_csr to zeroes if not used!
|
263 |
|
|
*/
|
264 |
|
|
//@{
|
265 |
|
|
///Read address into extended registers, addresses dwords (4 bytes)
|
266 |
|
|
sc_out<sc_uint<6> > csr_read_addr_usr;
|
267 |
|
|
///Read data from extended registers
|
268 |
|
|
sc_in<sc_bv<32> > usr_read_data_csr;
|
269 |
|
|
///Write in extended registers
|
270 |
|
|
sc_out<bool > csr_write_usr;
|
271 |
|
|
///Write address in extended registers, addresses dwords (4 bytes)
|
272 |
|
|
sc_out<sc_uint<6> > csr_write_addr_usr;
|
273 |
|
|
///Write data in extended registers
|
274 |
|
|
sc_out<sc_bv<32> > csr_write_data_usr;
|
275 |
|
|
///Write byte mask in extended registers
|
276 |
|
|
sc_out<sc_bv<4> > csr_write_mask_usr;
|
277 |
|
|
//@}
|
278 |
|
|
|
279 |
|
|
|
280 |
|
|
|
281 |
|
|
///Overflow of the buffers of the databuffer0
|
282 |
|
|
sc_in<bool> db0_overflow_csr;
|
283 |
|
|
///Overflow of the buffers of the reordering0
|
284 |
|
|
sc_in<bool> ro0_overflow_csr;
|
285 |
|
|
///Overflow of the buffers of the databuffer1
|
286 |
|
|
sc_in<bool> db1_overflow_csr;
|
287 |
|
|
///Overflow of the buffers of the reordering1
|
288 |
|
|
sc_in<bool> ro1_overflow_csr;
|
289 |
|
|
|
290 |
|
|
///If the Error Handler consumes data, it means that there is an end of chain error
|
291 |
|
|
sc_in<bool> eh0_ack_ro0;
|
292 |
|
|
///If the Error Handler consumes data, it means that there is an end of chain error
|
293 |
|
|
sc_in<bool> eh1_ack_ro1;
|
294 |
|
|
|
295 |
|
|
/// Link0 has completed it's initialization
|
296 |
|
|
sc_in<bool> lk0_initialization_complete_csr;
|
297 |
|
|
#ifdef RETRY_MODE_ENABLED
|
298 |
|
|
///Link0 asks to initiate a retry disconnect (probably due to a protocol error)
|
299 |
|
|
sc_in<bool> lk0_initiate_retry_disconnect;
|
300 |
|
|
#endif
|
301 |
|
|
/// Link0 has completed it's initialization
|
302 |
|
|
sc_in<bool > lk0_crc_error_csr;
|
303 |
|
|
/// Link0 detected a protocol error
|
304 |
|
|
sc_in<bool> lk0_protocol_error_csr;
|
305 |
|
|
|
306 |
|
|
|
307 |
|
|
/// Link1 has completed it's initialization
|
308 |
|
|
sc_in<bool> lk1_initialization_complete_csr;
|
309 |
|
|
#ifdef RETRY_MODE_ENABLED
|
310 |
|
|
///Link1 asks to initiate a retry disconnect (probably due to a protocol error)
|
311 |
|
|
sc_in<bool> lk1_initiate_retry_disconnect;
|
312 |
|
|
#endif
|
313 |
|
|
/// Link1 has completed it's initialization
|
314 |
|
|
sc_in<bool > lk1_crc_error_csr;
|
315 |
|
|
/// Link1 detected a protocol error
|
316 |
|
|
sc_in<bool> lk1_protocol_error_csr;
|
317 |
|
|
|
318 |
|
|
/** Signal to register Interface->LinkError_0->ProtocolError_0 */
|
319 |
|
|
sc_in<bool> cd0_protocol_error_csr;
|
320 |
|
|
|
321 |
|
|
///When the command decoder0 detects a sync
|
322 |
|
|
sc_in<bool> cd0_sync_detected_csr;
|
323 |
|
|
/** Signal to register Interface->LinkError_1->ProtocolError_1 */
|
324 |
|
|
sc_in<bool> cd1_protocol_error_csr;
|
325 |
|
|
#ifdef RETRY_MODE_ENABLED
|
326 |
|
|
/** Signal to register ErrorRetry->Status_0->RetrySent_0 */
|
327 |
|
|
sc_in<bool> cd0_initiate_retry_disconnect;
|
328 |
|
|
/** Signal to register ErrorRetry->Status_0->StompReceived_0 */
|
329 |
|
|
sc_in<bool> cd0_received_stomped_csr;
|
330 |
|
|
/** Signal to register ErrorRetry->Status_1->RetrySent_1 */
|
331 |
|
|
sc_in<bool> cd1_initiate_retry_disconnect;
|
332 |
|
|
/** Signal to register ErrorRetry->Status_1->StompReceived_1 */
|
333 |
|
|
sc_in<bool> cd1_received_stomped_csr;
|
334 |
|
|
#endif
|
335 |
|
|
|
336 |
|
|
///When the command decode1r detects a sync
|
337 |
|
|
sc_in<bool> cd1_sync_detected_csr;
|
338 |
|
|
|
339 |
|
|
|
340 |
|
|
|
341 |
|
|
///Update the registers with the value of "link failure" from the link
|
342 |
|
|
sc_in<bool> lk0_update_link_failure_property_csr;
|
343 |
|
|
///Update the registers with the value of "link width" from the link
|
344 |
|
|
sc_in<bool> lk0_update_link_width_csr;
|
345 |
|
|
///Detected link width (only valid when lk0_update_link_width_csr)
|
346 |
|
|
sc_in<sc_bv<3> > lk0_sampled_link_width_csr;
|
347 |
|
|
///Detected link failure (only valid when lk0_update_link_failure_property_csr)
|
348 |
|
|
sc_in<bool> lk0_link_failure_csr;
|
349 |
|
|
|
350 |
|
|
#ifdef RETRY_MODE_ENABLED
|
351 |
|
|
///Clear the bit that forces a single CRC error to be sent
|
352 |
|
|
sc_in<bool> fc0_clear_single_error_csr;
|
353 |
|
|
///Clear the bit that forces a single CRC stomp to be sent
|
354 |
|
|
sc_in<bool> fc0_clear_single_stomp_csr;
|
355 |
|
|
///Clear the bit that forces a single CRC error to be sent
|
356 |
|
|
sc_in<bool> fc1_clear_single_error_csr;
|
357 |
|
|
///Clear the bit that forces a single CRC stomp to be sent
|
358 |
|
|
sc_in<bool> fc1_clear_single_stomp_csr;
|
359 |
|
|
#endif
|
360 |
|
|
|
361 |
|
|
///Update the registers with the value of "link failure" from the link
|
362 |
|
|
sc_in<bool> lk1_update_link_failure_property_csr;
|
363 |
|
|
///Update the registers with the value of "link width" from the link
|
364 |
|
|
sc_in<bool> lk1_update_link_width_csr;
|
365 |
|
|
///Detected link width (only valid when lk1_update_link_width_csr)
|
366 |
|
|
sc_in<sc_bv<3> > lk1_sampled_link_width_csr;
|
367 |
|
|
///Detected link failure (only valid when lk1_update_link_failure_property_csr)
|
368 |
|
|
sc_in<bool> lk1_link_failure_csr;
|
369 |
|
|
|
370 |
|
|
|
371 |
|
|
|
372 |
|
|
//***********************************************
|
373 |
|
|
// Outputs from CSR registers to other modules
|
374 |
|
|
//***********************************************
|
375 |
|
|
|
376 |
|
|
/** Signal from register DeviceHeader->Command->csr_io_space_enable */
|
377 |
|
|
sc_out<bool> csr_io_space_enable;
|
378 |
|
|
/** Signal from register DeviceHeader->Command->csr_memory_space_enable */
|
379 |
|
|
sc_out<bool> csr_memory_space_enable;
|
380 |
|
|
/** Signal from register DeviceHeader->Command->csr_bus_master_enable */
|
381 |
|
|
sc_out<bool> csr_bus_master_enable;
|
382 |
|
|
/** Signal from register Interface->Command->Master host */
|
383 |
|
|
sc_out<bool> csr_master_host;
|
384 |
|
|
/** Signal derived from register DeviceHeader->Command->Master host */
|
385 |
|
|
//sc_out<bool> csr_is_upstream0;
|
386 |
|
|
/** Signal derived from register DeviceHeader->Command->Master host */
|
387 |
|
|
//sc_out<bool> csr_is_upstream1;
|
388 |
|
|
/** Signals table containing all 40 bits Base Addresses from BARs implemented */
|
389 |
|
|
sc_out<sc_bv<40> > csr_bar[NbRegsBars];
|
390 |
|
|
/** Signal from register Interface->Command->csr_unit_id */
|
391 |
|
|
sc_out<sc_bv<5> > csr_unit_id;
|
392 |
|
|
/** Signal from register Interface->Command->csr_default_dir */
|
393 |
|
|
sc_out<bool> csr_default_dir;
|
394 |
|
|
/** Signal from register Interface->Command->csr_drop_uninit_link */
|
395 |
|
|
sc_out<bool> csr_drop_uninit_link;
|
396 |
|
|
/** Signal from register Interface->LinkControl_0->csr_crc_force_error_lk0 */
|
397 |
|
|
sc_out<bool> csr_crc_force_error_lk0;
|
398 |
|
|
/** Signal from register Interface->LinkControl_0->csr_end_of_chain0 */
|
399 |
|
|
sc_out<bool> csr_end_of_chain0;
|
400 |
|
|
/** Signal from register Interface->LinkControl_0->csr_transmitter_off_lk0 */
|
401 |
|
|
sc_out<bool> csr_transmitter_off_lk0;
|
402 |
|
|
/** Signal from register Interface->LinkControl_0->csr_ldtstop_tristate_enable_lk0 */
|
403 |
|
|
sc_out<bool> csr_ldtstop_tristate_enable_lk0;
|
404 |
|
|
/** Signal from register Interface->LinkControl_0->csr_extented_ctl_lk0 */
|
405 |
|
|
sc_out<bool> csr_extented_ctl_lk0;
|
406 |
|
|
/** Signal from register Interface->LinkConfiguration_0->csr_rx_link_width_lk0 */
|
407 |
|
|
sc_out<sc_bv<3> > csr_rx_link_width_lk0;
|
408 |
|
|
/** Signal from register Interface->LinkConfiguration_0->csr_tx_link_width_lk0 */
|
409 |
|
|
sc_out<sc_bv<3> > csr_tx_link_width_lk0;
|
410 |
6 |
acastong |
/** Signal from register Interface->Link Freq 0 */
|
411 |
|
|
sc_out<sc_bv<4> >csr_link_frequency0;
|
412 |
2 |
acastong |
/** Signal from register Interface->LinkControl_1->csr_crc_force_error_lk1 */
|
413 |
|
|
sc_out<bool> csr_crc_force_error_lk1;
|
414 |
|
|
/** Signal from register Interface->LinkControl_1->csr_end_of_chain1 */
|
415 |
|
|
sc_out<bool> csr_end_of_chain1;
|
416 |
|
|
/** Signal from register Interface->LinkControl_1->csr_transmitter_off_lk1 */
|
417 |
|
|
sc_out<bool> csr_transmitter_off_lk1;
|
418 |
|
|
/** Signal from register Interface->LinkControl_1->csr_ldtstop_tristate_enable_lk1 */
|
419 |
|
|
sc_out<bool> csr_ldtstop_tristate_enable_lk1;
|
420 |
|
|
/** Signal from register Interface->LinkControl_1->csr_extented_ctl_lk1 */
|
421 |
|
|
sc_out<bool> csr_extented_ctl_lk1;
|
422 |
|
|
/** Signal from register Interface->LinkConfiguration_1->csr_rx_link_width_lk1 */
|
423 |
|
|
sc_out<sc_bv<3> > csr_rx_link_width_lk1;
|
424 |
|
|
/** Signal from register Interface->LinkConfiguration_1->csr_tx_link_width_lk1 */
|
425 |
|
|
sc_out<sc_bv<3> > csr_tx_link_width_lk1;
|
426 |
6 |
acastong |
/** Signal from register Interface->Link Freq 1 */
|
427 |
|
|
sc_out<sc_bv<4> >csr_link_frequency1;
|
428 |
2 |
acastong |
/** Signal from register Interface->LinkError_0->csr_extended_ctl_timeout_lk0 */
|
429 |
|
|
sc_out<bool> csr_extended_ctl_timeout_lk0;
|
430 |
|
|
#ifdef ENABLE_REORDERING
|
431 |
|
|
/** Signal from register Interface->FeatureCapability->csr_unitid_reorder_disable */
|
432 |
|
|
sc_out<bool> csr_unitid_reorder_disable;
|
433 |
|
|
#endif
|
434 |
|
|
/** Signal from register Interface->LinkError_1->csr_extended_ctl_timeout_lk1 */
|
435 |
|
|
sc_out<bool> csr_extended_ctl_timeout_lk1;
|
436 |
|
|
#ifdef RETRY_MODE_ENABLED
|
437 |
|
|
/** Signal from register ErrorRetry->Control_0->LinkRetryEnable_0 */
|
438 |
|
|
sc_out<bool> csr_retry0;
|
439 |
|
|
/** Signal from register ErrorRetry->Control_0->csr_force_single_error_fc0 */
|
440 |
|
|
sc_out<bool> csr_force_single_error_fc0;
|
441 |
|
|
/** Signal from register ErrorRetry->Control_0->csr_force_single_stomp_fc0 */
|
442 |
|
|
sc_out<bool> csr_force_single_stomp_fc0;
|
443 |
|
|
/** Signal from register ErrorRetry->Control_1->LinkRetryEnable_1 */
|
444 |
|
|
sc_out<bool> csr_retry1;
|
445 |
|
|
/** Signal from register ErrorRetry->Control_1->csr_force_single_error_fc1 */
|
446 |
|
|
sc_out<bool> csr_force_single_error_fc1;
|
447 |
|
|
/** Signal from register ErrorRetry->Control_1->csr_force_single_stomp_fc1 */
|
448 |
|
|
sc_out<bool> csr_force_single_stomp_fc1;
|
449 |
|
|
#endif
|
450 |
|
|
#ifdef ENABLE_DIRECTROUTE
|
451 |
|
|
/** Signal from register DirectRoute->csr_direct_route_enable */
|
452 |
|
|
sc_out<sc_bv<32> > csr_direct_route_enable;
|
453 |
|
|
/** Signals table containing all csr_direct_route_oppposite_dir from Direct Route spaces implemented */
|
454 |
|
|
sc_out<bool> csr_direct_route_oppposite_dir[DirectRoute_NumberDirectRouteSpaces];
|
455 |
|
|
/** Signals table containing all Base Addresses from Direct Route spaces implemented
|
456 |
|
|
These are the bits 39:8*/
|
457 |
|
|
sc_out<sc_bv<32> > csr_direct_route_base[DirectRoute_NumberDirectRouteSpaces];
|
458 |
|
|
/** Signals table containing all Limit Addresses from Direct Route spaces implemented
|
459 |
|
|
These are the bits 39:8*/
|
460 |
|
|
sc_out<sc_bv<32> > csr_direct_route_limit[DirectRoute_NumberDirectRouteSpaces];
|
461 |
|
|
#endif
|
462 |
|
|
/** Signal from register Clumping->csr_clumping_configuration */
|
463 |
|
|
sc_out<sc_bv<32> > csr_clumping_configuration;
|
464 |
|
|
|
465 |
|
|
/** If the link has finished it's initialization (is connected)*/
|
466 |
|
|
sc_out<bool> csr_initcomplete0;
|
467 |
|
|
/** If the link has finished it's initialization (is connected)*/
|
468 |
|
|
sc_out<bool> csr_initcomplete1;
|
469 |
|
|
|
470 |
|
|
|
471 |
|
|
//*******************************************
|
472 |
|
|
// Internal signals
|
473 |
|
|
//*******************************************
|
474 |
|
|
|
475 |
|
|
///The consolidated signal containing the output of all the registers for
|
476 |
|
|
///easy read operation
|
477 |
|
|
sc_signal<sc_bv<8> > config_registers[CSR_SIZE];
|
478 |
|
|
|
479 |
|
|
///Actual register of the output
|
480 |
|
|
sc_signal<sc_bv<32> > output_packet_buf;
|
481 |
|
|
|
482 |
|
|
/////////////////////////////////////////////
|
483 |
|
|
// The CSR registers
|
484 |
|
|
/////////////////////////////////////////////
|
485 |
|
|
sc_signal<sc_bv<8> > command_lsb;
|
486 |
|
|
sc_signal<sc_bv<8> > command_msb;
|
487 |
|
|
sc_signal<sc_bv<8> > status_msb;
|
488 |
|
|
sc_signal<sc_bv<32> > bar_slots[6];
|
489 |
|
|
sc_signal<sc_bv<8> > interrupt_scratchpad;
|
490 |
|
|
|
491 |
|
|
sc_signal<sc_bv<8> > interface_command_lsb;
|
492 |
|
|
sc_signal<sc_bv<8> > interface_command_msb;
|
493 |
|
|
sc_signal<sc_bv<8> > link_control_0_lsb;
|
494 |
|
|
sc_signal<bool > link_control_0_lsb_cold4;
|
495 |
|
|
sc_signal<sc_bv<8> > link_control_0_msb;
|
496 |
|
|
sc_signal<bool > link_control_0_msb_cold0;
|
497 |
|
|
sc_signal<sc_bv<8> > link_config_0_msb;
|
498 |
|
|
sc_signal<sc_bv<8> > link_control_1_lsb;
|
499 |
|
|
sc_signal<bool > link_control_1_lsb_cold4;
|
500 |
|
|
sc_signal<sc_bv<8> > link_control_1_msb;
|
501 |
|
|
sc_signal<bool> link_control_1_msb_cold0;
|
502 |
|
|
sc_signal<sc_bv<8> > link_config_1_msb;
|
503 |
|
|
sc_signal<sc_bv<8> > link_freq_and_error0;
|
504 |
|
|
sc_signal<bool> reorder_disable;
|
505 |
|
|
sc_signal<sc_bv<8> > link_freq_and_error1;
|
506 |
|
|
sc_signal<sc_bv<8> > enum_scratchpad_lsb;
|
507 |
|
|
sc_signal<sc_bv<8> > enum_scratchpad_msb;
|
508 |
|
|
sc_signal<bool > protocol_error_flood_en;
|
509 |
|
|
sc_signal<bool > overflow_error_flood_en;
|
510 |
|
|
sc_signal<bool > chain_fail;
|
511 |
|
|
sc_signal<bool > response_error;
|
512 |
|
|
sc_signal<sc_bv<8> > bus_number;
|
513 |
|
|
|
514 |
|
|
#ifdef ENABLE_DIRECTROUTE
|
515 |
|
|
sc_signal<sc_uint<5> > direct_route_index;
|
516 |
|
|
sc_signal<sc_uint<32> > direct_route_enable;
|
517 |
|
|
#endif
|
518 |
|
|
|
519 |
|
|
sc_signal<sc_bv<32> > clumping_enable;
|
520 |
|
|
|
521 |
|
|
sc_signal<sc_bv<8> > error_retry_control0;
|
522 |
|
|
sc_signal<bool> error_retry_control0_cold0;
|
523 |
|
|
sc_signal<sc_bv<8> > error_retry_control1;
|
524 |
|
|
sc_signal<bool> error_retry_control1_cold0;
|
525 |
|
|
sc_signal<sc_bv<8> > error_retry_status0;
|
526 |
|
|
sc_signal<sc_bv<8> > error_retry_status1;
|
527 |
|
|
sc_signal<sc_uint<16> > error_retry_count0;
|
528 |
|
|
sc_signal<sc_uint<16> > error_retry_count1;
|
529 |
|
|
|
530 |
|
|
|
531 |
|
|
/////////////////////////////////////////////
|
532 |
|
|
// Misc state registers
|
533 |
|
|
/////////////////////////////////////////////
|
534 |
|
|
|
535 |
|
|
|
536 |
|
|
#ifdef ENABLE_DIRECTROUTE
|
537 |
|
|
///Extra registers for DirectRoute
|
538 |
|
|
sc_signal<sc_bv<32> > direct_route_data[4*DirectRoute_NumberDirectRouteSpaces];
|
539 |
|
|
#endif
|
540 |
|
|
|
541 |
|
|
///Extra registers for the link width
|
542 |
|
|
sc_signal<sc_bv<3> > link0WidthIn;
|
543 |
|
|
///Extra registers for the link width
|
544 |
|
|
sc_signal<sc_bv<3> > link0WidthOut;
|
545 |
|
|
///Extra registers for the link width
|
546 |
|
|
sc_signal<sc_bv<3> > link1WidthIn;
|
547 |
|
|
///Extra registers for the link width
|
548 |
|
|
sc_signal<sc_bv<3> > link1WidthOut;
|
549 |
|
|
|
550 |
|
|
///Read associated signals - Read is synchronous
|
551 |
|
|
sc_signal<sc_uint<6> > read_addr;
|
552 |
|
|
///Read associated signals - Read is synchronous
|
553 |
|
|
sc_signal<sc_uint<4> > counter;
|
554 |
|
|
|
555 |
|
|
///Write associated signals - Write is synchronous
|
556 |
|
|
sc_signal<sc_uint<6> > write_addr;
|
557 |
|
|
///Write associated signals - Write is synchronous
|
558 |
|
|
sc_signal<bool> write;
|
559 |
|
|
///Write associated signals - Write is synchronous
|
560 |
|
|
sc_signal<bool > write_from_side;
|
561 |
|
|
///Write associated signals - Write is synchronous
|
562 |
|
|
sc_signal<sc_bv<4> > write_mask;
|
563 |
|
|
///Write associated signals - Write is synchronous
|
564 |
|
|
sc_signal<sc_bv<32> > write_data;
|
565 |
|
|
///Write associated signals - Write is synchronous
|
566 |
|
|
sc_signal<sc_bv<32> > write_mask_vector;
|
567 |
|
|
|
568 |
|
|
///Side from which the write or read came from
|
569 |
|
|
sc_signal<bool> read_write_side;
|
570 |
|
|
|
571 |
|
|
///If a target done is waiting to be send to the flow control (currently outputed)
|
572 |
|
|
sc_signal<bool> tgtdone_waiting_to_be_sent;
|
573 |
|
|
///Passpw for the next response
|
574 |
|
|
//sc_signal<bool> targetdone_passpw;
|
575 |
|
|
///RqUID for the next response
|
576 |
|
|
//sc_signal<sc_bv<2> > targetdone_RqUID;
|
577 |
|
|
///Passpw for the next response
|
578 |
|
|
//sc_signal<sc_bv<5> > targetdone_srctag;
|
579 |
|
|
///The side to send the target done, if one has to be send
|
580 |
|
|
sc_signal<bool > targetdone_send_side;
|
581 |
|
|
|
582 |
|
|
|
583 |
|
|
/** @name Next value of resposne informatino
|
584 |
|
|
A write request can be treated even though a target
|
585 |
|
|
done from the last request has not been sent yet. So
|
586 |
|
|
the value of the previous targetdone cannot simply
|
587 |
|
|
be overwritten, so we store the "next value" of the
|
588 |
|
|
response information
|
589 |
|
|
*/
|
590 |
|
|
//@{
|
591 |
|
|
///The next side to send a response
|
592 |
|
|
sc_signal<bool> next_response_side;
|
593 |
|
|
///The value of passpw for the next response
|
594 |
|
|
sc_signal<bool> next_response_passpw;
|
595 |
|
|
///The value of rqUID for the next response
|
596 |
|
|
sc_signal<sc_bv<2> > next_response_RqUID;
|
597 |
|
|
///The value of srcTag for the next response
|
598 |
|
|
sc_signal<sc_bv<5> > next_response_srctag;
|
599 |
|
|
///If the next response should have Target Error on
|
600 |
|
|
sc_signal<bool> next_response_target_abort;
|
601 |
|
|
///If a request is posted : no response
|
602 |
|
|
sc_signal<bool> next_posted;
|
603 |
|
|
//@}
|
604 |
|
|
|
605 |
|
|
///The current state of the state machine
|
606 |
|
|
sc_signal<csr_states> state;
|
607 |
|
|
|
608 |
|
|
///Register that finds if sync sequence has started
|
609 |
|
|
/** Does not need to be a register, but is simpler to code*/
|
610 |
|
|
sc_signal<bool> sync_initiated;
|
611 |
|
|
|
612 |
|
|
#ifdef SYSTEMC_SIM
|
613 |
|
|
|
614 |
|
|
sc_event registers_modified_event;
|
615 |
|
|
|
616 |
|
|
#endif
|
617 |
|
|
|
618 |
|
|
|
619 |
|
|
//*******************************************
|
620 |
|
|
// Contructor and destructor of CSR module
|
621 |
|
|
//*******************************************
|
622 |
|
|
|
623 |
|
|
SC_HAS_PROCESS(csr_l2);
|
624 |
|
|
|
625 |
|
|
/**
|
626 |
|
|
Updates all the internal registers of the CSR that have a warm
|
627 |
|
|
reset, excluding the state machine registers. It also defines
|
628 |
|
|
some hardwired bits.
|
629 |
|
|
|
630 |
|
|
This simply calls others functions.
|
631 |
|
|
|
632 |
|
|
It is setup as a synchronous process with WARM reset (reset
|
633 |
|
|
on resetx signal)
|
634 |
|
|
*/
|
635 |
|
|
void update_registers_warm();
|
636 |
|
|
|
637 |
|
|
/**
|
638 |
|
|
Updates all the internal registers of the CSR that have a cold
|
639 |
|
|
reset, excluding the state machine registers. It also defines
|
640 |
|
|
some hardwired bits.
|
641 |
|
|
|
642 |
|
|
This simply calls others functions.
|
643 |
|
|
|
644 |
|
|
It is setup as a synchronous process with COLD reset (reset
|
645 |
|
|
on coldrstx signal)
|
646 |
|
|
*/
|
647 |
|
|
void update_registers_cold();
|
648 |
|
|
|
649 |
|
|
/**
|
650 |
|
|
Process for the CSR state machine
|
651 |
|
|
*/
|
652 |
|
|
void csr_state_machine();
|
653 |
|
|
|
654 |
|
|
/**
|
655 |
|
|
Updates all the registers of the device header
|
656 |
|
|
register block for registers that have warm reset
|
657 |
|
|
*/
|
658 |
|
|
void manage_device_header_registers_warm();
|
659 |
|
|
|
660 |
|
|
/**
|
661 |
|
|
Updates all the registers of the device header
|
662 |
|
|
register block for registers that have cold reset
|
663 |
|
|
*/
|
664 |
|
|
void manage_device_header_registers_cold();
|
665 |
|
|
|
666 |
|
|
/**
|
667 |
|
|
Updates all the registers of the interface
|
668 |
|
|
register block that have warm reset
|
669 |
|
|
*/
|
670 |
|
|
void manage_interface_registers_warm();
|
671 |
|
|
|
672 |
|
|
/**
|
673 |
|
|
Updates all the registers of the interface
|
674 |
|
|
register block that have cold reset
|
675 |
|
|
*/
|
676 |
|
|
void manage_interface_registers_cold();
|
677 |
|
|
|
678 |
|
|
#ifdef ENABLE_DIRECTROUTE
|
679 |
|
|
/**
|
680 |
|
|
Updates all the registers of the direct route
|
681 |
|
|
register block that have warm reset
|
682 |
|
|
*/
|
683 |
|
|
void manage_direct_route_registers_warm();
|
684 |
|
|
|
685 |
|
|
/**
|
686 |
|
|
Updates all the registers of the direct route
|
687 |
|
|
register block that have cold reset
|
688 |
|
|
*/
|
689 |
|
|
void manage_direct_route_registers_cold();
|
690 |
|
|
#endif
|
691 |
|
|
|
692 |
|
|
/**
|
693 |
|
|
Updates all the registers of the ID clumpimp
|
694 |
|
|
register block. It only has cold reset
|
695 |
|
|
registers.
|
696 |
|
|
*/
|
697 |
|
|
void manage_unit_id_clumping_registers_cold();
|
698 |
|
|
|
699 |
|
|
#ifdef RETRY_MODE_ENABLED
|
700 |
|
|
/**
|
701 |
|
|
Updates all the registers of the error retry
|
702 |
|
|
register block that have warm reset
|
703 |
|
|
*/
|
704 |
|
|
void manage_error_retry_registers_warm();
|
705 |
|
|
|
706 |
|
|
/**
|
707 |
|
|
Updates all the registers of the error retry
|
708 |
|
|
register block that have cold reset
|
709 |
|
|
*/
|
710 |
|
|
void manage_error_retry_registers_cold();
|
711 |
|
|
#endif
|
712 |
|
|
|
713 |
|
|
/**
|
714 |
|
|
Checks if a sync flood has been initiated
|
715 |
|
|
@return true if a sync flood has been initiated
|
716 |
|
|
*/
|
717 |
|
|
void isSyncInitiated();
|
718 |
|
|
|
719 |
|
|
/**
|
720 |
|
|
Process that takes care of outputing the content of the internal
|
721 |
|
|
registers to the correct outputs
|
722 |
|
|
*/
|
723 |
|
|
void output_register_values();
|
724 |
|
|
|
725 |
|
|
/// Drives external register interface signals
|
726 |
|
|
void output_external_register_signals();
|
727 |
|
|
|
728 |
|
|
void build_output_values();
|
729 |
|
|
void build_device_header_output();
|
730 |
|
|
void build_interface_output();
|
731 |
|
|
#ifdef ENABLE_DIRECTROUTE
|
732 |
|
|
void build_direct_route_output();
|
733 |
|
|
#endif
|
734 |
|
|
void build_revision_id_output();
|
735 |
|
|
void build_unit_id_clumping_output();
|
736 |
|
|
#ifdef RETRY_MODE_ENABLED
|
737 |
|
|
void build_error_retry_registers_output();
|
738 |
|
|
#endif
|
739 |
|
|
|
740 |
|
|
void isSyncInitiated_reset();
|
741 |
|
|
void manage_device_header_registers_warm_reset();
|
742 |
|
|
void manage_interface_registers_warm_reset();
|
743 |
|
|
#ifdef ENABLE_DIRECTROUTE
|
744 |
|
|
void manage_direct_route_registers_warm_reset();
|
745 |
|
|
#endif
|
746 |
|
|
#ifdef RETRY_MODE_ENABLED
|
747 |
|
|
void manage_error_retry_registers_warm_reset();
|
748 |
|
|
#endif
|
749 |
|
|
|
750 |
|
|
void manage_device_header_registers_cold_reset();
|
751 |
|
|
void manage_interface_registers_cold_reset();
|
752 |
|
|
void manage_direct_route_registers_cold_reset();
|
753 |
|
|
void manage_unit_id_clumping_registers_cold_reset();
|
754 |
|
|
#ifdef RETRY_MODE_ENABLED
|
755 |
|
|
void manage_error_retry_registers_cold_reset();
|
756 |
|
|
#endif
|
757 |
|
|
|
758 |
|
|
|
759 |
|
|
/// Contructor of CSR with sensitivity lists
|
760 |
|
|
/**
|
761 |
|
|
Open the output file, define sensitivity list for each process
|
762 |
|
|
*/
|
763 |
|
|
csr_l2(sc_module_name name);
|
764 |
|
|
|
765 |
|
|
|
766 |
|
|
#ifdef SYSTEMC_SIM
|
767 |
|
|
|
768 |
|
|
/// Destructor of CSR
|
769 |
|
|
/** Close output file */
|
770 |
|
|
virtual ~csr_l2() {};
|
771 |
|
|
|
772 |
|
|
#endif
|
773 |
|
|
|
774 |
|
|
|
775 |
|
|
|
776 |
|
|
};
|
777 |
|
|
|
778 |
|
|
|
779 |
|
|
#endif
|
780 |
|
|
|