Initial commit of OpenSPARC T2 design and verification files.
[OpenSPARC-T2-DV] / verif / env / fc / vera / classes / sys_mem.vr
CommitLineData
86530b38
AT
1// ========== Copyright Header Begin ==========================================
2//
3// OpenSPARC T2 Processor File: sys_mem.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 "std_display_defines.vri"
37
38#include "std_display_class.vrh"
39
40extern hdl_task write_sys_mem (
41 bit [63:0] addr,
42 bit [63:0] data,
43 bit [7:0] be
44 );
45
46extern hdl_task read_sys_mem (
47 bit [63:0] addr,
48 var bit [63:0] rd_data
49 );
50
51class CSparseMem {
52 local event write_sync;
53 local event read_sync;
54
55 task new() {
56 trigger(ON,write_sync);
57 trigger(ON,read_sync);
58 }
59
60 task WriteMem( bit [63:0] address, bit [63:0] data, bit [7:0] be, (integer enable_tracking = 0 ));
61 task ReadMem( bit[63:0] address, var bit [63:0] data, bit[7:0] be);
62 function bit [39:0] get_address(integer no_of_blocks, (integer page_id = 0), (integer alignment = 1));
63
64}
65
66
67task CSparseMem::WriteMem( bit [63:0] address, bit [63:0] data, bit [7:0] be, (integer enable_tracking = 0 ) ) {
68
69
70 sync(ALL,write_sync);
71 trigger(OFF,write_sync);
72
73 write_sys_mem(address[63:0], data[63:0], 8'h0); // write DoubleWord
74 trigger(ON,write_sync);
75
76}
77
78task CSparseMem::ReadMem( bit [63:0] address, var bit [63:0] data, bit [7:0] be ) {
79
80 bit [63:0] rdata;
81
82 sync(ALL,read_sync);
83 trigger(OFF,read_sync);
84
85 read_sys_mem(address[63:0], rdata); // read DoubleWord
86 data = rdata;
87 trigger(ON,read_sync);
88
89}
90function bit [39:0] CSparseMem::get_address(integer no_of_blocks, (integer page_id = 0) , (integer alignment = 1) ) {
91 bit [39:0] address;
92// printf(" Page id - %d \n",page_id);
93// MAQ : address = MallocBlock(no_of_blocks,page_id,alignment);
94 address = 40'h200000000;
95// printf(" Address Allocated - %x \n",address);
96 get_address = address;
97}
98