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 7

Go to most recent revision | 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
 
52
 
53
struct packet_t {
54
 
55
    int length;
56
 
57
    // Packet fields
58
 
59
    sc_uint<48> dest_addr;
60
    sc_uint<48> src_addr;
61
    sc_uint<8> payload [12000];
62
    sc_uint<32> crc;
63
 
64
    sc_uint<32> crc_rx;
65
    sc_uint<32> err_flags;
66
    sc_uint<32> err_info;
67
 
68
    sc_uint<32> ifg;
69
    sc_uint<32> start_lane;
70
 
71
    sc_uint<8> data [10000];
72
};
73
 
74
ostream& operator<<(ostream& os, const packet_t& p);
75
 
76
void pack(packet_t* p);
77
void unpack(packet_t* p);
78
 
79
void add_crc(packet_t* p);
80
void strip_crc(packet_t* p);
81
 
82
void calc_crc(packet_t* p);
83
 
84
void pad(packet_t* p, int len);
85
 
86
bool compare(packet_t* pkta, packet_t* pktb);
87
 
88
#endif

powered by: WebSVN 2.1.0

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