1 |
2 |
acastong |
//fc_packet_crc.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 |
|
|
* Ami Castonguay <acastong@grm.polymtl.ca>
|
25 |
|
|
* Martin Corriveau
|
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 FC_PACKET_CRC_L3_H
|
42 |
|
|
#define FC_PACKET_CRC_L3_H
|
43 |
|
|
|
44 |
|
|
//The Poly used for the CRC32 encoding
|
45 |
|
|
#define CRC_ENCODER_POLY 0x04C11DB7
|
46 |
|
|
|
47 |
|
|
#include "../core_synth/synth_datatypes.h"
|
48 |
|
|
#include "../core_synth/constants.h"
|
49 |
|
|
|
50 |
|
|
///Caculates per packet CRC for packets being sent out
|
51 |
|
|
/**
|
52 |
|
|
@author Ami Castonguay
|
53 |
|
|
*/
|
54 |
|
|
class fc_packet_crc_l3 : public sc_module
|
55 |
|
|
{
|
56 |
|
|
public:
|
57 |
|
|
|
58 |
|
|
//*******************************
|
59 |
|
|
// Inputs
|
60 |
|
|
//*******************************
|
61 |
|
|
///Clock to synchronize module
|
62 |
|
|
sc_in < bool > clk;
|
63 |
|
|
///Reset to initialize module
|
64 |
|
|
sc_in < bool > resetx;
|
65 |
|
|
|
66 |
|
|
///Bit vector being sent out to link - used to calculate CRC
|
67 |
|
|
sc_in< sc_bv<32> > data_in;
|
68 |
|
|
|
69 |
|
|
///Control bit sent to link - used to calculate CRC
|
70 |
|
|
sc_in< bool > fc_hctl_lk;
|
71 |
|
|
///Control bit sent to link - used to calculate CRC
|
72 |
|
|
sc_in< bool > fc_lctl_lk;
|
73 |
|
|
|
74 |
|
|
///When set, the CRC is calculated based on what is being sent to the link
|
75 |
|
|
sc_in< bool > calculate_crc;
|
76 |
|
|
///When set, the nop CRC is calculated based on what is being sent to the link
|
77 |
|
|
sc_in< bool > calculate_nop_crc;
|
78 |
|
|
///Clears the curent CRC value (to start a new packet)
|
79 |
|
|
sc_in< bool > clear_crc;
|
80 |
|
|
///Clears the curent nop CRC value (to start a new packet)
|
81 |
|
|
sc_in< bool > clear_nop_crc;
|
82 |
|
|
|
83 |
|
|
///Sent from CSR to force a stomp CRC (inverse of good CRC), it is a test mode
|
84 |
|
|
sc_in<bool> csr_force_single_stomp_fc;
|
85 |
|
|
///Sent from CSR to force a bad CRC, it is a test mode
|
86 |
|
|
sc_in<bool> csr_force_single_error_fc;
|
87 |
|
|
|
88 |
|
|
//*******************************
|
89 |
|
|
// CRC output signals
|
90 |
|
|
//*******************************
|
91 |
|
|
|
92 |
|
|
///Register that holds the CRC value
|
93 |
|
|
sc_signal< sc_uint<32> > crc_value;
|
94 |
|
|
///Register that holds the nop CRC value
|
95 |
|
|
sc_signal< sc_uint<32> > nop_crc_value;
|
96 |
|
|
|
97 |
|
|
///Output of the calculated CRC (usually inverse of crc_value)
|
98 |
|
|
sc_out< sc_uint<32> > crc_output;
|
99 |
|
|
///Output of the calculated nop CRC (usually inverse of nop_crc_value)
|
100 |
|
|
sc_out< sc_uint<32> > nop_crc_output;
|
101 |
|
|
|
102 |
|
|
///Generates the CRC outputs
|
103 |
|
|
void clocked_process();
|
104 |
|
|
|
105 |
|
|
///SystemC Macro
|
106 |
|
|
SC_HAS_PROCESS(fc_packet_crc_l3);
|
107 |
|
|
|
108 |
|
|
///Module constructor
|
109 |
|
|
fc_packet_crc_l3(sc_module_name name);
|
110 |
|
|
};
|
111 |
|
|
|
112 |
|
|
#endif
|