OpenCores
URL https://opencores.org/ocsvn/xge_mac/xge_mac/trunk

Subversion Repositories xge_mac

[/] [xge_mac/] [trunk/] [tbench/] [systemc/] [sc_packet.h] - Blame information for rev 29

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 2 antanguay
//////////////////////////////////////////////////////////////////////
2
////                                                              ////
3
////  File name "sc_packet.h"                                     ////
4
////                                                              ////
5
////  This file is part of the "10GE MAC" project                 ////
6
////  http://www.opencores.org/cores/xge_mac/                     ////
7
////                                                              ////
8
////  Author(s):                                                  ////
9
////      - A. Tanguay (antanguay@opencores.org)                  ////
10
////                                                              ////
11
//////////////////////////////////////////////////////////////////////
12
////                                                              ////
13
//// Copyright (C) 2008 AUTHORS. All rights reserved.             ////
14
////                                                              ////
15
//// This source file may be used and distributed without         ////
16
//// restriction provided that this copyright statement is not    ////
17
//// removed from the file and that any derivative work contains  ////
18
//// the original copyright notice and the associated disclaimer. ////
19
////                                                              ////
20
//// This source file is free software; you can redistribute it   ////
21
//// and/or modify it under the terms of the GNU Lesser General   ////
22
//// Public License as published by the Free Software Foundation; ////
23
//// either version 2.1 of the License, or (at your option) any   ////
24
//// later version.                                               ////
25
////                                                              ////
26
//// This source is distributed in the hope that it will be       ////
27
//// useful, but WITHOUT ANY WARRANTY; without even the implied   ////
28
//// warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR      ////
29
//// PURPOSE.  See the GNU Lesser General Public License for more ////
30
//// details.                                                     ////
31
////                                                              ////
32
//// You should have received a copy of the GNU Lesser General    ////
33
//// Public License along with this source; if not, download it   ////
34
//// from http://www.opencores.org/lgpl.shtml                     ////
35
////                                                              ////
36
//////////////////////////////////////////////////////////////////////
37
 
38
#ifndef PACKET_H
39
#define PACKET_H
40
 
41
#include "systemc.h"
42
 
43
 
44
#define PKT_FLAG_ERR_SIG      0x0001
45
#define PKT_FLAG_ERR_SOP      0x0002
46
#define PKT_FLAG_ERR_CRC      0x0004
47
#define PKT_FLAG_ERR_FRG      0x0008
48
#define PKT_FLAG_ERR_CODING   0x0010
49
#define PKT_FLAG_LOCAL_FAULT  0x0020
50
#define PKT_FLAG_REMOTE_FAULT 0x0040
51 29 antanguay
#define PKT_FLAG_ERR_LENGHT   0x0080
52 2 antanguay
 
53
 
54
struct packet_t {
55
 
56
    int length;
57
 
58
    // Packet fields
59
 
60
    sc_uint<48> dest_addr;
61
    sc_uint<48> src_addr;
62 29 antanguay
    sc_uint<8> payload [18000];
63 2 antanguay
    sc_uint<32> crc;
64
 
65
    sc_uint<32> crc_rx;
66
    sc_uint<32> err_flags;
67
    sc_uint<32> err_info;
68
 
69
    sc_uint<32> ifg;
70
    sc_uint<32> start_lane;
71
 
72 29 antanguay
    sc_uint<8> data [20000];
73 2 antanguay
};
74
 
75
ostream& operator<<(ostream& os, const packet_t& p);
76
 
77
void pack(packet_t* p);
78
void unpack(packet_t* p);
79
 
80
void add_crc(packet_t* p);
81
void strip_crc(packet_t* p);
82
 
83
void calc_crc(packet_t* p);
84
 
85
void pad(packet_t* p, int len);
86
 
87
bool compare(packet_t* pkta, packet_t* pktb);
88
 
89
#endif

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.