Initial commit of OpenSPARC T2 design and verification files.
[OpenSPARC-T2-DV] / design / sys / iop / dmu / rtl / dmu_imu_ics_csrpipe_5.v
CommitLineData
86530b38
AT
1// ========== Copyright Header Begin ==========================================
2//
3// OpenSPARC T2 Processor File: dmu_imu_ics_csrpipe_5.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 ============================================
35module dmu_imu_ics_csrpipe_5
36 (
37 clk,
38 rst_l,
39 reg_in,
40 reg_out,
41 data0,
42 data1,
43 data2,
44 data3,
45 data4,
46 sel0,
47 sel1,
48 sel2,
49 sel3,
50 sel4,
51 out
52 );
53
54//====================================================================
55// Polarity declarations
56//====================================================================
57input clk; // Clock signal
58input rst_l; // Reset signal
59input reg_in; // Set to constant. 0: sel* non-reg 1: sel* reg
60input reg_out; // Set to constant. 0: out non-reg 1: out registered
61input [`FIRE_CSRBUS_DATA_WIDTH-1:0] data0; // Read data
62input [`FIRE_CSRBUS_DATA_WIDTH-1:0] data1; // Read data
63input [`FIRE_CSRBUS_DATA_WIDTH-1:0] data2; // Read data
64input [`FIRE_CSRBUS_DATA_WIDTH-1:0] data3; // Read data
65input [`FIRE_CSRBUS_DATA_WIDTH-1:0] data4; // Read data
66input sel0; // Set to 1 if reg_in==0
67input sel1; // Set to 1 if reg_in==0
68input sel2; // Set to 1 if reg_in==0
69input sel3; // Set to 1 if reg_in==0
70input sel4; // Set to 1 if reg_in==0
71output [`FIRE_CSRBUS_DATA_WIDTH-1:0] out; // Read data out
72
73//====================================================================
74// Type declarations
75//====================================================================
76wire clk; // Clock signal
77wire rst_l; // Reset signal
78wire reg_in; // Set to constant. 0: sel* non-reg 1: sel* reg
79wire reg_out; // Set to constant. 0: out non-reg 1: out registered
80wire [`FIRE_CSRBUS_DATA_WIDTH-1:0] data0; // Read data
81wire [`FIRE_CSRBUS_DATA_WIDTH-1:0] data1; // Read data
82wire [`FIRE_CSRBUS_DATA_WIDTH-1:0] data2; // Read data
83wire [`FIRE_CSRBUS_DATA_WIDTH-1:0] data3; // Read data
84wire [`FIRE_CSRBUS_DATA_WIDTH-1:0] data4; // Read data
85wire sel0; // Set to 1 if reg_in==0
86wire sel1; // Set to 1 if reg_in==0
87wire sel2; // Set to 1 if reg_in==0
88wire sel3; // Set to 1 if reg_in==0
89wire sel4; // Set to 1 if reg_in==0
90wire [`FIRE_CSRBUS_DATA_WIDTH-1:0] out; // Read data out
91
92//====================================================================
93// Local variables
94//====================================================================
95reg [`FIRE_CSRBUS_DATA_WIDTH-1:0] out_p1;
96reg sel0_p1;
97reg sel1_p1;
98reg sel2_p1;
99reg sel3_p1;
100reg sel4_p1;
101
102//====================================================================
103// Logic
104//====================================================================
105//select required ?
106wire sel0_int=reg_in?sel0_p1:sel0;
107wire sel1_int=reg_in?sel1_p1:sel1;
108wire sel2_int=reg_in?sel2_p1:sel2;
109wire sel3_int=reg_in?sel3_p1:sel3;
110wire sel4_int=reg_in?sel4_p1:sel4;
111
112//generate AND/OR
113wire [`FIRE_CSRBUS_DATA_WIDTH-1:0] out_d =
114 {`FIRE_CSRBUS_DATA_WIDTH { sel0_int } } & data0 |
115 {`FIRE_CSRBUS_DATA_WIDTH { sel1_int } } & data1 |
116 {`FIRE_CSRBUS_DATA_WIDTH { sel2_int } } & data2 |
117 {`FIRE_CSRBUS_DATA_WIDTH { sel3_int } } & data3 |
118 {`FIRE_CSRBUS_DATA_WIDTH { sel4_int } } & data4;
119
120//reg out or combo
121assign out=reg_out?out_p1:out_d;
122
123//pipe control/data
124always @(posedge clk)
125 begin
126 if(~rst_l)
127 begin
128 sel0_p1<=1'b0;
129 sel1_p1<=1'b0;
130 sel2_p1<=1'b0;
131 sel3_p1<=1'b0;
132 sel4_p1<=1'b0;
133 out_p1<=`FIRE_CSRBUS_DATA_WIDTH'b0;
134 end
135 else
136 begin
137 sel0_p1<=sel0;
138 sel1_p1<=sel1;
139 sel2_p1<=sel2;
140 sel3_p1<=sel3;
141 sel4_p1<=sel4;
142 out_p1<=out_d;
143 end
144 end
145
146endmodule // dmu_imu_ics_csrpipe_5