Commit | Line | Data |
---|---|---|
86530b38 AT |
1 | // ========== Copyright Header Begin ========================================== |
2 | // | |
3 | // OpenSPARC T2 Processor File: niu_txc_drr_context.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 | /********************************************************************* | |
36 | * | |
37 | * niu_txc_drr_context.v | |
38 | * | |
39 | * DRR Arbiter Context | |
40 | * | |
41 | * Orignal Author(s): Rahoul Puri | |
42 | * Modifier(s): | |
43 | * Project(s): Neptune | |
44 | * | |
45 | * Copyright (c) 2004 Sun Microsystems, Inc. | |
46 | * | |
47 | * All Rights Reserved. | |
48 | * | |
49 | * This verilog model is the confidential and proprietary property of | |
50 | * Sun Microsystems, Inc., and the possession or use of this model | |
51 | * requires a written license from Sun Microsystems, Inc. | |
52 | * | |
53 | **********************************************************************/ | |
54 | ||
55 | `include "timescale.v" | |
56 | ||
57 | module niu_txc_drr_context ( | |
58 | SysClk, | |
59 | Reset_L, | |
60 | FlushEngine, | |
61 | ||
62 | ClrMaxBurst, // Clear max burst bit in control register | |
63 | NewMaxBurst, // Max burst bit in control register | |
64 | MaxBurst, | |
65 | ||
66 | PacketDone, | |
67 | PacketByteCount, // Byte count of the packet that was serviced | |
68 | ||
69 | DMA_Reset_Done, | |
70 | DMA_EofList, | |
71 | AddCreditToContext, | |
72 | ClrDeficitForEofList, | |
73 | ContextActiveList, | |
74 | NextDMAChannel, | |
75 | ContextNumber, | |
76 | NoDeficit | |
77 | ); | |
78 | ||
79 | `include "txc_defines.h" | |
80 | ||
81 | // Global Signals | |
82 | input SysClk; | |
83 | input Reset_L; | |
84 | input FlushEngine; | |
85 | ||
86 | // Control Registers | |
87 | input ClrMaxBurst; | |
88 | input NewMaxBurst; | |
89 | input [19:0] MaxBurst; | |
90 | ||
91 | // Data Fetch State Machine | |
92 | input PacketDone; | |
93 | input [15:0] PacketByteCount; | |
94 | ||
95 | // DRR Arbiter State Machine | |
96 | input DMA_Reset_Done; | |
97 | input DMA_EofList; | |
98 | input AddCreditToContext; | |
99 | input ClrDeficitForEofList; | |
100 | input ContextActiveList; | |
101 | input [4:0] NextDMAChannel; | |
102 | input [4:0] ContextNumber; | |
103 | ||
104 | output NoDeficit; | |
105 | ||
106 | /*--------------------------------------------------------------*/ | |
107 | // Wires & Registers | |
108 | /*--------------------------------------------------------------*/ | |
109 | wire addCredit; | |
110 | wire updatebyteCount; | |
111 | wire updateMaxBurst; | |
112 | ||
113 | reg [19:0] contextBurst; | |
114 | reg [20:0] byteCount; | |
115 | ||
116 | /*--------------------------------------------------------------*/ | |
117 | // Parameters and Defines | |
118 | /*--------------------------------------------------------------*/ | |
119 | ||
120 | /*--------------------------------------------------------------*/ | |
121 | // Zero In Checks | |
122 | /*--------------------------------------------------------------*/ | |
123 | ||
124 | ||
125 | /*--------------------------------------------------------------*/ | |
126 | // Assigns | |
127 | /*--------------------------------------------------------------*/ | |
128 | ||
129 | assign NoDeficit = (byteCount < {1'b0, contextBurst}); | |
130 | ||
131 | assign addCredit = (AddCreditToContext & ContextActiveList); | |
132 | ||
133 | assign updateMaxBurst = (ClrMaxBurst & NewMaxBurst); | |
134 | ||
135 | assign updatebyteCount = (PacketDone | |
136 | && | |
137 | (NextDMAChannel == ContextNumber) | |
138 | ); | |
139 | ||
140 | /*--------------------------------------------------------------*/ | |
141 | // Instantiated Flops | |
142 | /*--------------------------------------------------------------*/ | |
143 | ||
144 | always @(posedge SysClk) | |
145 | if (!Reset_L) contextBurst <= #`SD 20'h0; | |
146 | else if (updateMaxBurst) contextBurst <= #`SD MaxBurst; | |
147 | ||
148 | always @(posedge SysClk) | |
149 | if (!Reset_L) byteCount <= #`SD 21'h0; | |
150 | else if (FlushEngine) byteCount <= #`SD 21'h0; | |
151 | else if (DMA_Reset_Done) byteCount <= #`SD 21'h0; | |
152 | else if (ClrDeficitForEofList & DMA_EofList) byteCount <= #`SD 21'h0; | |
153 | else if (addCredit) | |
154 | begin | |
155 | if (NoDeficit) byteCount <= #`SD 21'h0; | |
156 | else byteCount <= #`SD (byteCount - {1'b0, contextBurst}); | |
157 | end | |
158 | else if (updatebyteCount) byteCount <= #`SD (byteCount | |
159 | + | |
160 | {5'h0, PacketByteCount}); | |
161 | ||
162 | endmodule |