Initial commit of OpenSPARC T2 design and verification files.
[OpenSPARC-T2-DV] / design / sys / iop / niu / rtl / niu_smx_arb_2c.v
CommitLineData
86530b38
AT
1// ========== Copyright Header Begin ==========================================
2//
3// OpenSPARC T2 Processor File: niu_smx_arb_2c.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
36module niu_smx_arb_2c(
37/*AUTOARG*/
38 // Outputs
39 ack_a, ack_b, selout,
40 // Inputs
41 clk, reset_l, req_a, req_b, muxin_a, muxin_b
42 );
43 // arb 2 clients
44
45
46parameter MUX_WIDTH= 6;
47
48 // req needs to go down on nxt cycle after seeing ack
49input clk;
50input reset_l;
51
52input req_a;
53input req_b;
54
55input [MUX_WIDTH-1:0] muxin_a;
56input [MUX_WIDTH-1:0] muxin_b;
57
58output ack_a; // pulse
59output ack_b;
60output [MUX_WIDTH-1:0] selout;
61
62reg a_first, a_first_n;
63reg ack_a, ack_b;
64reg [MUX_WIDTH-1:0] selout;
65
66
67always @(posedge clk) begin
68 if(!reset_l) begin
69 a_first<= `SMX_PD 1'b0;
70 end
71 else begin
72 a_first<= `SMX_PD a_first_n;
73 end
74end
75
76always @(/*AUTOSENSE*/a_first or muxin_a or muxin_b or req_a or req_b) begin
77 case({req_a, req_b})
78 2'b00: begin
79 ack_a= 1'b0;
80 ack_b= 1'b0;
81 a_first_n= a_first;
82 selout= muxin_a;
83 end
84 2'b01: begin
85 ack_a= 1'b0;
86 ack_b= 1'b1;
87 a_first_n= 1'b1;
88 selout= muxin_b;
89 end
90 2'b10: begin
91 ack_a= 1'b1;
92 ack_b= 1'b0;
93 a_first_n= 1'b0;
94 selout= muxin_a;
95 end
96 2'b11: begin
97 ack_a= a_first;
98 ack_b= ~a_first;
99 a_first_n= ~a_first;
100 selout= (a_first)? muxin_a : muxin_b;
101 end
102 default: begin
103 ack_a= 1'b0;
104 ack_b= 1'b0;
105 a_first_n= a_first;
106 selout= muxin_a;
107 end
108 endcase
109end
110
111endmodule
112