| 1 | // ========== Copyright Header Begin ========================================== |
|---|
| 2 | // |
|---|
| 3 | // OpenSPARC T1 Processor File: tlu_rrobin_picker.v |
|---|
| 4 | // Copyright (c) 2006 Sun Microsystems, Inc. All Rights Reserved. |
|---|
| 5 | // DO NOT ALTER OR REMOVE COPYRIGHT NOTICES. |
|---|
| 6 | // |
|---|
| 7 | // The above named program is free software; you can redistribute it and/or |
|---|
| 8 | // modify it under the terms of the GNU General Public |
|---|
| 9 | // License version 2 as published by the Free Software Foundation. |
|---|
| 10 | // |
|---|
| 11 | // The above named program is distributed in the hope that it will be |
|---|
| 12 | // useful, but WITHOUT ANY WARRANTY; without even the implied warranty of |
|---|
| 13 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
|---|
| 14 | // General Public License for more details. |
|---|
| 15 | // |
|---|
| 16 | // You should have received a copy of the GNU General Public |
|---|
| 17 | // License along with this work; if not, write to the Free Software |
|---|
| 18 | // Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. |
|---|
| 19 | // |
|---|
| 20 | // ========== Copyright Header End ============================================ |
|---|
| 21 | //////////////////////////////////////////////////////////////////////// |
|---|
| 22 | /* |
|---|
| 23 | // Description: Round-Robin Picker for 4 eventss. |
|---|
| 24 | // Differs from lsu'v rrobin picker by the |
|---|
| 25 | // fact that there is no default 1-hot event. |
|---|
| 26 | */ |
|---|
| 27 | //////////////////////////////////////////////////////////////////////// |
|---|
| 28 | // Global header file includes |
|---|
| 29 | //////////////////////////////////////////////////////////////////////// |
|---|
| 30 | `include "sys.h" // system level definition file which contains the |
|---|
| 31 | // time scale definition |
|---|
| 32 | |
|---|
| 33 | module tlu_rrobin_picker (/*AUTOARG*/ |
|---|
| 34 | // Outputs |
|---|
| 35 | pick_one_hot, |
|---|
| 36 | // Inputs |
|---|
| 37 | events, tlu_rst_l, clk |
|---|
| 38 | ); |
|---|
| 39 | |
|---|
| 40 | input [3:0] events ; // multi-hot; events that could be chosen |
|---|
| 41 | // this siganl was modified to abide to the Niagara reset methodology |
|---|
| 42 | input tlu_rst_l ; // reset - active low |
|---|
| 43 | input clk ; |
|---|
| 44 | |
|---|
| 45 | output [3:0] pick_one_hot ; // one-hot; events that must be chosen |
|---|
| 46 | // |
|---|
| 47 | // this signal was added to abide to the Niagara reset methodology |
|---|
| 48 | wire tlu_rst ; |
|---|
| 49 | |
|---|
| 50 | // This section was modified to abide to the Niagara synthesis methodology |
|---|
| 51 | // |
|---|
| 52 | // reg [3:0] pick_status ; |
|---|
| 53 | wire pick_status_reset ; |
|---|
| 54 | wire [3:0] pick_status_in ; |
|---|
| 55 | wire [3:0] pick_status ; |
|---|
| 56 | |
|---|
| 57 | wire events_unpicked ; |
|---|
| 58 | wire [3:0] pe_mask ; |
|---|
| 59 | |
|---|
| 60 | // |
|---|
| 61 | // this signal was added to abide to the Niagara reset methodology |
|---|
| 62 | assign tlu_rst = ~tlu_rst_l; |
|---|
| 63 | |
|---|
| 64 | assign events_unpicked = |(events[3:0] & ~pick_status[3:0]) ; |
|---|
| 65 | // term replicated. |
|---|
| 66 | |
|---|
| 67 | // priority encode mask |
|---|
| 68 | assign pe_mask[3:0] = |
|---|
| 69 | events_unpicked ? |
|---|
| 70 | (events[3:0] & ~pick_status[3:0]) : // choose from eventss that have not picked. |
|---|
| 71 | events[3:0] ; // else all eventss on equal terms |
|---|
| 72 | |
|---|
| 73 | assign pick_one_hot[0] = |
|---|
| 74 | pe_mask[0] ; |
|---|
| 75 | //pe_mask[0] | ~(|pe_mask[3:0]); // none requesting then 0 is forced hot |
|---|
| 76 | assign pick_one_hot[1] = |
|---|
| 77 | pe_mask[1] & ~pe_mask[0] ; |
|---|
| 78 | assign pick_one_hot[2] = |
|---|
| 79 | pe_mask[2] & ~(|pe_mask[1:0]) ; |
|---|
| 80 | assign pick_one_hot[3] = |
|---|
| 81 | pe_mask[3] & ~(|pe_mask[2:0]) ; |
|---|
| 82 | |
|---|
| 83 | // This section was modified to abide to the Niagara synthesis methodology |
|---|
| 84 | // |
|---|
| 85 | // Define Pick Status |
|---|
| 86 | //always @ (posedge clk) |
|---|
| 87 | // begin |
|---|
| 88 | // if ((&(pick_status[3:0] | pick_one_hot[3:0])) | tlu_rst) |
|---|
| 89 | // pick_status[3:0] <= 4'b0000 ; // clear pick_status |
|---|
| 90 | // else |
|---|
| 91 | // pick_status[3:0] <= pick_status[3:0] | pick_one_hot[3:0] ; |
|---|
| 92 | // // term replicated |
|---|
| 93 | // end |
|---|
| 94 | |
|---|
| 95 | assign pick_status_reset = (&(pick_status[3:0] | pick_one_hot[3:0])) | tlu_rst; |
|---|
| 96 | assign pick_status_in = pick_status[3:0] | pick_one_hot[3:0]; |
|---|
| 97 | |
|---|
| 98 | dffr_s #(4) dffre_pick_status ( |
|---|
| 99 | .din (pick_status_in[3:0]), .q (pick_status[3:0]), |
|---|
| 100 | .rst (pick_status_reset), .clk (clk), |
|---|
| 101 | .se (1'b0), .si (), .so () |
|---|
| 102 | ); |
|---|
| 103 | |
|---|
| 104 | endmodule |
|---|