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

Subversion Repositories pcie_vera_tb

[/] [pcie_vera_tb/] [trunk/] [pcie_phy_packet.vri] - Blame information for rev 8

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 2 cmagleby
// ===========================================================================
2
// File    : pcie_phy_packet.vri
3
// Author  : cmagleby
4
// Date    : Mon Dec 3 11:03:46 MST 2007
5
// Project : TI PHY design
6
//
7
// Copyright (c) notice
8
// This code adheres to the GNU public license
9
//
10
// ===========================================================================
11
//
12
// $Id: pcie_phy_packet.vri,v 1.1.1.1 2007-12-05 18:37:07 cmagleby Exp $
13
//
14
// ===========================================================================
15
//
16
// $Log: not supported by cvs2svn $
17
//
18
// ===========================================================================
19
// Function : This file is a class of pcie packet can be used for all Phy
20
// packet types.
21
//
22
// ===========================================================================
23
// ===========================================================================
24
#include 
25
 
26
class pcie_phy_packet {
27
  bit [7:0] com;
28
  bit [7:0] link;
29
  bit [7:0] lane;
30
  bit [7:0] n_fts;
31
  bit [7:0] rateid;
32
  bit [7:0] train_cntrl;
33
  bit [7:0] ts_id;
34
  bit [7:0] idle;
35
  bit [7:0] skp;
36
  bit [7:0] fts;
37
  integer   length;
38
  bit [17:0] temp_packet[];
39
 
40
 
41
  //methods
42
  task new(
43
    bit [7:0] ic_link = 8'hf7,
44
    bit [7:0] ic_lane = 8'hf7,
45
    bit [7:0] ic_nfts = 8'hff,
46
    bit [7:0] ic_rateid = 8'h2,
47
    bit [7:0] ic_train_cntrl = 8'h0,
48
    bit [7:0] ic_ts_id = 8'h4a) {
49
 
50
    link        = ic_link;
51
    lane        = ic_lane;
52
    n_fts       = ic_nfts;
53
    rateid      = ic_rateid;
54
    train_cntrl = ic_train_cntrl;
55
    ts_id       = ic_ts_id;
56
    com         = 8'hbc;
57
    idle        = 8'h7c;
58
    skp         = 8'h1c;
59
    fts         = 8'h3c;
60
  }
61
 
62
  task build_packet (string pkt_type = "ts") {
63
    if (pkt_type == "ts") {
64
      length = 8;
65
      if (link == 8'hf7) temp_packet[0]  = {2'b11,link,com};
66
      else temp_packet[0]  = {2'b01,link,com};
67
      if (lane == 8'hf7) temp_packet[1]  = {2'b1,n_fts,lane};
68
      else temp_packet[1]  = {2'b0,n_fts,lane};
69
      temp_packet[2]  = {2'b0,train_cntrl,rateid};
70
      temp_packet[3]  = {2'b0,ts_id,ts_id};
71
      temp_packet[4]  = {2'b0,ts_id,ts_id};
72
      temp_packet[5]  = {2'b0,ts_id,ts_id};
73
      temp_packet[6]  = {2'b0,ts_id,ts_id};
74
      temp_packet[7] = {2'b0,ts_id,ts_id};
75
      printf ("building training set packet (%0h)\n",
76
              {temp_packet[7][15:0],temp_packet[6][15:0],
77
               temp_packet[5][15:0],temp_packet[4][15:0],
78
               temp_packet[3][15:0],temp_packet[2][15:0],
79
               temp_packet[1][15:0],temp_packet[0][15:0]});
80
    }
81
    else if (pkt_type == "eidle") {
82
      length = 2;
83
      temp_packet[0] = {2'b11,idle,com};
84
      temp_packet[1] = {2'b11,idle,idle};
85
      printf ("building eidle packet (%0h)\n",{temp_packet[1][15:0],temp_packet[0][15:0]});
86
    }
87
    else if (pkt_type == "skip"){
88
      length = 2;
89
      temp_packet[0] = {2'b11,skp,com};
90
      temp_packet[1] = {2'b11,skp,skp};
91
      printf ("building skip packet (%0h)\n",{temp_packet[1][15:0],temp_packet[0][15:0]});
92
    }
93
    else if (pkt_type == "fast_ts"){
94
      length = 2;
95
      temp_packet[0] = {2'b11,fts,com};
96
      temp_packet[1] = {2'b11,fts,fts};
97
      printf ("building fts packet (%0h)\n",{temp_packet[1][15:0],temp_packet[0][15:0]});
98
    }
99
 
100
  }
101
}

powered by: WebSVN 2.1.0

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