Initial commit of OpenSPARC T2 design and verification files.
[OpenSPARC-T2-DV] / design / sys / iop / niu / rtl / niu_pio_slv_decoder.v
CommitLineData
86530b38
AT
1// ========== Copyright Header Begin ==========================================
2//
3// OpenSPARC T2 Processor File: niu_pio_slv_decoder.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/*%W% %G%*/
36
37/*****************************************************************
38 *
39 * File Name : niu_pio_slv_decoder.v
40 * Author Name : John Lo
41 * Description : It contains PIO itslef read/write decoder,
42 *
43 * Parent Module: niu_pio_slv_decoder.v
44 * Child Module:
45 * Interface Mod: many.
46 * Date Created : 3/30/04
47 *
48 * Copyright (c) 2020, Sun Microsystems, Inc.
49 * Sun Proprietary and Confidential
50 *
51 * Modification :
52 *
53 ****************************************************************/
54
55module niu_pio_slv_decoder (/*AUTOARG*/
56 // Outputs
57 slv_ack, slv_rdata, slv_err, ras_dev_func_share,
58 ld_dev_func_share,rd_dev_func_share,
59 // Inputs
60 reset, clk, slv_sel_reg, addr, rd, dev_func_share
61 );
62
63 input clk;
64 input reset;
65
66 input slv_sel_reg;
67 // pio broadcast signals
68 input [18:0] addr;
69 input rd;
70 input [63:0] dev_func_share;
71
72 output slv_ack;
73 output [63:0] slv_rdata;
74 output slv_err;
75 //
76 output ras_dev_func_share;
77 output ld_dev_func_share;
78 output rd_dev_func_share;
79
80
81// common reg declaration
82 reg [63:0] rd_data;
83 reg non_qualified_addr_err;
84// common wrie declaration
85 wire [63:0] slv_rdata;
86 wire rd_en;
87 wire wr_en;
88 wire rasr;
89// output reg declaration
90 reg ras_dev_func_share;
91 reg ld_dev_func_share;
92 reg rd_dev_func_share;
93
94`ifdef NEPTUNE
95/* ---------------------------------------------------------- */
96 reg slv_sel_reg_int;
97 reg rd_int;
98 reg [18:0] addr_int;
99
100always @(posedge clk)
101 if (reset)
102 begin
103 slv_sel_reg_int <= 1'b0;
104 rd_int <= 1'b0;
105 addr_int <= 19'b0;
106 end
107 else
108 begin
109 slv_sel_reg_int <= slv_sel_reg ;
110 rd_int <= rd ;
111 addr_int <= addr;
112 end
113
114`else
115/* ---------------------------------------------------------- */
116
117 wire slv_sel_reg_int;
118 wire rd_int;
119 wire [18:0] addr_int;
120
121 assign slv_sel_reg_int = slv_sel_reg ;
122 assign rd_int = rd ;
123 assign addr_int = addr ;
124/* ----------------------------------------------------------- */
125`endif
126
127
128niu_rw_ctl_0 slv_rw_ctl(
129 // Outputs
130 .wr_en (wr_en),
131 .rd_en (rd_en),
132 .ack (slv_ack),
133 .rdata (slv_rdata[63:0]),
134 .err (slv_err),
135 .rasr (rasr),
136 // Inputs
137 .clk (clk),
138 .sel (slv_sel_reg_int),
139 .rd (rd_int),
140 .rd_data (rd_data[63:0]),
141 .non_qualified_addr_err(non_qualified_addr_err));
142
143
144always @ (/*AUTOSENSE*/addr_int or dev_func_share or rasr or wr_en or rd_en)
145 begin
146 non_qualified_addr_err = 0;
147 rd_data = 64'hdead_beef_dead_beef;
148 ras_dev_func_share = 0;
149 ld_dev_func_share = 0;
150 rd_dev_func_share = 0;
151
152 case({addr_int[18:3],3'b0}) //synopsys parallel_case full_case
153 19'h1_0000: begin // device function shared register
154 ras_dev_func_share = rasr;
155 ld_dev_func_share = wr_en;
156 rd_dev_func_share = rd_en;
157 rd_data = dev_func_share;
158
159 end
160
161 default: begin
162 rd_data = 64'hdead_beef_dead_beef;
163 non_qualified_addr_err = 1;
164 end // case: default
165 endcase // case({addr[18:3],3'b0})
166
167 end // always @ (...
168
169endmodule // niu_pio_slv_decoder