Commit | Line | Data |
---|---|---|
86530b38 AT |
1 | // ========== Copyright Header Begin ========================================== |
2 | // | |
3 | // OpenSPARC T2 Processor File: vega_shadow_class.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 "neptune_memory_map.vri" | |
36 | #include "mac_shadow_class.vrh" | |
37 | #include "xmac_shadow_class.vrh" | |
38 | ||
39 | ||
40 | class shadow_cl { | |
41 | mac_shadow_cl mac_shadow_class[4]; | |
42 | xmac_shadow_cl xmac_shadow_class[4]; | |
43 | ||
44 | ||
45 | task new() { | |
46 | integer i; | |
47 | for(i = 0;i<2;i++){ | |
48 | xmac_shadow_class[i] = new(i); | |
49 | } | |
50 | ||
51 | } | |
52 | ||
53 | // get_data | |
54 | // The user provides a 33 bit address. If the register | |
55 | // corresponding to the address does not exist in the shadow | |
56 | // space, then the data_valid bit will be set to zero. | |
57 | // Otherwise, the data and mask corresponding to the address | |
58 | // will be provided to the user. | |
59 | // | |
60 | task get_data (bit [32:0] addr, var bit [31:0] data, | |
61 | var bit [31:0] data_mask, var bit data_valid) { | |
62 | bit [32:0] addr1; | |
63 | integer port_id; | |
64 | ||
65 | addr1 = {1'b0,addr[31:0]}; | |
66 | case (addr1[31:0] & ADDRESS_RANGE_MASK) { | |
67 | MAC_ADDRESS_RANGE : { | |
68 | mac_shadow_class[port_id].get_data(addr1, data, data_mask, data_valid); | |
69 | xmac_shadow_class[port_id].get_data(addr1, data, data_mask, data_valid); | |
70 | } | |
71 | ||
72 | default : { | |
73 | data_valid = 0; | |
74 | } | |
75 | } // end of case | |
76 | } // end of task get_data | |
77 | ||
78 | // put_data | |
79 | // The user provides a 33 bit address and 32 bit data. | |
80 | // If the address exists in the shadow space then the | |
81 | // data is updated. If the address does not exist, then | |
82 | // it is ignored -- no error message results from attempting | |
83 | // to updated non-existant locations. | |
84 | // | |
85 | task put_data (bit [32:0] addr, bit [31:0] data) { | |
86 | bit [32:0] addr1; | |
87 | integer port_id; | |
88 | ||
89 | addr1 = {1'b0,addr[31:0]}; | |
90 | case (addr1[31:0] & ADDRESS_RANGE_MASK) { | |
91 | MAC_ADDRESS_RANGE : { | |
92 | mac_shadow_class[port_id].put_data(addr1, data); | |
93 | xmac_shadow_class[port_id].put_data(addr1, data); | |
94 | } | |
95 | ||
96 | } // end of case | |
97 | } // end of task put_data | |
98 | ||
99 | } // end of class |