Initial commit of OpenSPARC T2 design and verification files.
[OpenSPARC-T2-DV] / verif / env / niu / vera / dmc_utils / niu_dmc_descr.vr
CommitLineData
86530b38
AT
1// ========== Copyright Header Begin ==========================================
2//
3// OpenSPARC T2 Processor File: niu_dmc_descr.vr
4// Copyright (C) 1995-2007 Sun Microsystems, Inc. All Rights Reserved
5// 4150 Network Circle, Santa Clara, California 95054, U.S.A.
6//
7// * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
8//
9// This program is free software; you can redistribute it and/or modify
10// it under the terms of the GNU General Public License as published by
11// the Free Software Foundation; version 2 of the License.
12//
13// This program is distributed in the hope that it will be useful,
14// but WITHOUT ANY WARRANTY; without even the implied warranty of
15// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16// GNU General Public License for more details.
17//
18// You should have received a copy of the GNU General Public License
19// along with this program; if not, write to the Free Software
20// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
21//
22// For the avoidance of doubt, and except that if any non-GPL license
23// choice is available it will apply instead, Sun elects to use only
24// the General Public License version 2 (GPLv2) at this time for any
25// software where a choice of GPL license versions is made
26// available with the language indicating that GPLv2 or any later version
27// may be used, or where a choice of which version of the GPL is applied is
28// otherwise unspecified.
29//
30// Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
31// CA 95054 USA or visit www.sun.com if you need additional information or
32// have any questions.
33//
34// ========== Copyright Header End ============================================
35#include <vera_defines.vrh>
36#include "niu_mem.vrh"
37extern CSparseMem SparseMem;
38
39virtual class Cdescriptor {
40 integer id;
41 bit [63:0] address;// Address of this descriptor
42 bit [63:0] sw_address;// software Address of this descriptor
43 string type;// Tx or Rx
44 integer valid;
45 integer pkt_page_id;
46
47 virtual task add(integer xlate , (integer ring_page_id = 0)) {
48 }
49}
50
51MakeVeraList(Cdescriptor) // list of descriptors
52
53class CTxdescriptor extends Cdescriptor {
54
55// Tx descriptor Fields
56 bit [43:0] sad;
57 bit sop;
58 bit mark;
59 bit [3:0] num_ptr;
60 bit [13:0] tr_len;
61 integer pkt_page_id;
62
63 task new( (integer i=0),(integer p=0) ){
64 id = i;
65 valid =0;
66 pkt_page_id = p;
67 }
68
69 task add( integer xlate , (integer ring_page_id = 0) ) {
70 bit [63:0] data;
71 data = pack_Txdescr();
72 printf("DESC_ADD %0h, DESC_DATA %0h page_id - %d xlate_on - %d \n", this.address, data,ring_page_id,xlate);
73 SparseMem.WriteVMem(this.address, data,8'hff,xlate,ring_page_id);
74
75 }
76 local function bit[63:0] pack_Txdescr() {
77 // Valid only for Tx Descriptors
78 pack_Txdescr = { sop,mark,num_ptr,tr_len,sad};
79 }
80
81}
82
83MakeVeraList(CTxdescriptor) // list of descriptors
84
85class CRxdescriptor extends Cdescriptor {
86
87// Rx descriptor Fields
88 bit [31:0] blk_addr;
89 integer pkt_page_id;
90
91 task new((integer i=0),(integer p=0)) {
92 id = i;
93 valid =0;
94 pkt_page_id = p;
95 }
96
97 task add( integer xlate , (integer ring_page_id = 0) ) {
98 bit [63:0] data;
99 data = pack_Rxdescr();
100 //printf("DESC_ADD %0h, DESC_DATA %0h\n", this.address, data);
101 SparseMem.WriteVMem(this.address, data,8'hff,xlate,ring_page_id);
102
103
104 }
105 local function bit[31:0] pack_Rxdescr() {
106 // Valid only for Rx Descriptors
107 pack_Rxdescr = { blk_addr};
108 }
109
110}
111
112
113MakeVeraList(CRxdescriptor) // list of descriptors