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] - Rev 8
Compare with Previous | Blame | View Log
// ===========================================================================
// File : pcie_phy_packet.vri
// Author : cmagleby
// Date : Mon Dec 3 11:03:46 MST 2007
// Project : TI PHY design
//
// Copyright (c) notice
// This code adheres to the GNU public license
//
// ===========================================================================
//
// $Id: pcie_phy_packet.vri,v 1.1.1.1 2007-12-05 18:37:07 cmagleby Exp $
//
// ===========================================================================
//
// $Log: not supported by cvs2svn $
//
// ===========================================================================
// Function : This file is a class of pcie packet can be used for all Phy
// packet types.
//
// ===========================================================================
// ===========================================================================
#include <vera_defines.vrh>
class pcie_phy_packet {
bit [7:0] com;
bit [7:0] link;
bit [7:0] lane;
bit [7:0] n_fts;
bit [7:0] rateid;
bit [7:0] train_cntrl;
bit [7:0] ts_id;
bit [7:0] idle;
bit [7:0] skp;
bit [7:0] fts;
integer length;
bit [17:0] temp_packet[];
//methods
task new(
bit [7:0] ic_link = 8'hf7,
bit [7:0] ic_lane = 8'hf7,
bit [7:0] ic_nfts = 8'hff,
bit [7:0] ic_rateid = 8'h2,
bit [7:0] ic_train_cntrl = 8'h0,
bit [7:0] ic_ts_id = 8'h4a) {
link = ic_link;
lane = ic_lane;
n_fts = ic_nfts;
rateid = ic_rateid;
train_cntrl = ic_train_cntrl;
ts_id = ic_ts_id;
com = 8'hbc;
idle = 8'h7c;
skp = 8'h1c;
fts = 8'h3c;
}
task build_packet (string pkt_type = "ts") {
if (pkt_type == "ts") {
length = 8;
if (link == 8'hf7) temp_packet[0] = {2'b11,link,com};
else temp_packet[0] = {2'b01,link,com};
if (lane == 8'hf7) temp_packet[1] = {2'b1,n_fts,lane};
else temp_packet[1] = {2'b0,n_fts,lane};
temp_packet[2] = {2'b0,train_cntrl,rateid};
temp_packet[3] = {2'b0,ts_id,ts_id};
temp_packet[4] = {2'b0,ts_id,ts_id};
temp_packet[5] = {2'b0,ts_id,ts_id};
temp_packet[6] = {2'b0,ts_id,ts_id};
temp_packet[7] = {2'b0,ts_id,ts_id};
printf ("building training set packet (%0h)\n",
{temp_packet[7][15:0],temp_packet[6][15:0],
temp_packet[5][15:0],temp_packet[4][15:0],
temp_packet[3][15:0],temp_packet[2][15:0],
temp_packet[1][15:0],temp_packet[0][15:0]});
}
else if (pkt_type == "eidle") {
length = 2;
temp_packet[0] = {2'b11,idle,com};
temp_packet[1] = {2'b11,idle,idle};
printf ("building eidle packet (%0h)\n",{temp_packet[1][15:0],temp_packet[0][15:0]});
}
else if (pkt_type == "skip"){
length = 2;
temp_packet[0] = {2'b11,skp,com};
temp_packet[1] = {2'b11,skp,skp};
printf ("building skip packet (%0h)\n",{temp_packet[1][15:0],temp_packet[0][15:0]});
}
else if (pkt_type == "fast_ts"){
length = 2;
temp_packet[0] = {2'b11,fts,com};
temp_packet[1] = {2'b11,fts,fts};
printf ("building fts packet (%0h)\n",{temp_packet[1][15:0],temp_packet[0][15:0]});
}
}
}