Commit | Line | Data |
---|---|---|
86530b38 AT |
1 | // ========== Copyright Header Begin ========================================== |
2 | // | |
3 | // OpenSPARC T2 Processor File: fc_niu_csr_probe.v | |
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 "fc.vh" | |
36 | `include "defines.vh" | |
37 | ||
38 | `define NIU_UCB `CPU.rdp.niu_pio_ucb | |
39 | `define NIU_PIO `CPU.rdp.niu_pio | |
40 | `define FM_MAX 12'hfff | |
41 | ||
42 | module fc_niu_csr_probe; | |
43 | reg [26:0] addr[4095:0]; | |
44 | reg [63:0] data; | |
45 | reg [11:0] wrptr; | |
46 | reg [11:0] rdptr; | |
47 | ||
48 | integer niu_csr; | |
49 | integer i; | |
50 | ||
51 | initial begin | |
52 | wrptr = 12'h0; | |
53 | rdptr = 12'h0; | |
54 | end | |
55 | ||
56 | always @ (`NIU_PIO.ucb_rd_req or `NIU_PIO.fifo_wr_en) begin | |
57 | if ((`NIU_PIO.ucb_rd_req == 1'b1) && (`NIU_PIO.fifo_wr_en == 1'b1)) begin | |
58 | addr[wrptr] = `NIU_PIO.ucb_addr; | |
59 | `PR_INFO ("niu_csr_probe", `INFO, "ts=%d addr[%h] gets %h\n", `TOP.core_cycle_cnt-1, wrptr, `NIU_PIO.ucb_addr); | |
60 | if (wrptr == `FM_MAX) | |
61 | wrptr = 12'h0; | |
62 | else | |
63 | wrptr = wrptr + 1; | |
64 | end | |
65 | end | |
66 | ||
67 | ||
68 | always @ (posedge `NIU_UCB.rd_ack_vld or posedge `NIU_UCB.rd_nack_vld) begin | |
69 | if (wrptr == rdptr) begin | |
70 | `PR_ERROR("niu_csr_probe", `ERROR, "A data phase without an address phase received"); | |
71 | end | |
72 | else begin | |
73 | data = {`NIU_UCB.data_out[7:0],`NIU_UCB.data_out[15:8],`NIU_UCB.data_out[23:16],`NIU_UCB.data_out[31:24],`NIU_UCB.data_out[39:32],`NIU_UCB.data_out[47:40],`NIU_UCB.data_out[55:48],`NIU_UCB.data_out[63:56]} ; | |
74 | `PR_INFO ("niu_csr_probe", `INFO, "ts=%0d NIU CSR READ RETURN: address %x data %x ", | |
75 | `TOP.core_cycle_cnt-1, {24'h0, 8'h81, 5'h0, addr[rdptr]}, data); | |
76 | if (`PARGS.nas_check_on ) | |
77 | niu_csr = $sim_send(`PLI_CSR_READ, {24'h0, 8'h81, 5'h0, addr[rdptr]}, data, 8'h01); | |
78 | if (rdptr == `FM_MAX) | |
79 | rdptr = 12'h0; | |
80 | else | |
81 | rdptr = rdptr + 1; | |
82 | end | |
83 | ||
84 | end // always @ (posedge | |
85 | ||
86 | ||
87 | endmodule // fc_niu_csr_probe |