1 |
95 |
fafa1971 |
// ========== 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 |
113 |
albert.wat |
`ifdef SIMPLY_RISC_TWEAKS
|
22 |
|
|
`define SIMPLY_RISC_SCANIN .si(0)
|
23 |
|
|
`else
|
24 |
|
|
`define SIMPLY_RISC_SCANIN .si()
|
25 |
|
|
`endif
|
26 |
95 |
fafa1971 |
////////////////////////////////////////////////////////////////////////
|
27 |
|
|
/*
|
28 |
|
|
// Description: Round-Robin Picker for 4 eventss.
|
29 |
|
|
// Differs from lsu'v rrobin picker by the
|
30 |
|
|
// fact that there is no default 1-hot event.
|
31 |
|
|
*/
|
32 |
|
|
////////////////////////////////////////////////////////////////////////
|
33 |
|
|
// Global header file includes
|
34 |
|
|
////////////////////////////////////////////////////////////////////////
|
35 |
113 |
albert.wat |
`include "sys.h" // system level definition file which contains the
|
36 |
95 |
fafa1971 |
// time scale definition
|
37 |
|
|
|
38 |
|
|
module tlu_rrobin_picker (/*AUTOARG*/
|
39 |
|
|
// Outputs
|
40 |
|
|
pick_one_hot,
|
41 |
|
|
// Inputs
|
42 |
|
|
events, tlu_rst_l, clk
|
43 |
|
|
);
|
44 |
|
|
|
45 |
|
|
input [3:0] events ; // multi-hot; events that could be chosen
|
46 |
|
|
// this siganl was modified to abide to the Niagara reset methodology
|
47 |
|
|
input tlu_rst_l ; // reset - active low
|
48 |
|
|
input clk ;
|
49 |
|
|
|
50 |
|
|
output [3:0] pick_one_hot ; // one-hot; events that must be chosen
|
51 |
|
|
//
|
52 |
|
|
// this signal was added to abide to the Niagara reset methodology
|
53 |
|
|
wire tlu_rst ;
|
54 |
|
|
|
55 |
|
|
// This section was modified to abide to the Niagara synthesis methodology
|
56 |
|
|
//
|
57 |
|
|
// reg [3:0] pick_status ;
|
58 |
|
|
wire pick_status_reset ;
|
59 |
|
|
wire [3:0] pick_status_in ;
|
60 |
|
|
wire [3:0] pick_status ;
|
61 |
|
|
|
62 |
|
|
wire events_unpicked ;
|
63 |
|
|
wire [3:0] pe_mask ;
|
64 |
|
|
|
65 |
|
|
//
|
66 |
|
|
// this signal was added to abide to the Niagara reset methodology
|
67 |
|
|
assign tlu_rst = ~tlu_rst_l;
|
68 |
|
|
|
69 |
|
|
assign events_unpicked = |(events[3:0] & ~pick_status[3:0]) ;
|
70 |
|
|
// term replicated.
|
71 |
|
|
|
72 |
|
|
// priority encode mask
|
73 |
|
|
assign pe_mask[3:0] =
|
74 |
|
|
events_unpicked ?
|
75 |
|
|
(events[3:0] & ~pick_status[3:0]) : // choose from eventss that have not picked.
|
76 |
|
|
events[3:0] ; // else all eventss on equal terms
|
77 |
|
|
|
78 |
|
|
assign pick_one_hot[0] =
|
79 |
|
|
pe_mask[0] ;
|
80 |
|
|
//pe_mask[0] | ~(|pe_mask[3:0]); // none requesting then 0 is forced hot
|
81 |
|
|
assign pick_one_hot[1] =
|
82 |
|
|
pe_mask[1] & ~pe_mask[0] ;
|
83 |
|
|
assign pick_one_hot[2] =
|
84 |
|
|
pe_mask[2] & ~(|pe_mask[1:0]) ;
|
85 |
|
|
assign pick_one_hot[3] =
|
86 |
|
|
pe_mask[3] & ~(|pe_mask[2:0]) ;
|
87 |
|
|
|
88 |
|
|
// This section was modified to abide to the Niagara synthesis methodology
|
89 |
|
|
//
|
90 |
|
|
// Define Pick Status
|
91 |
|
|
//always @ (posedge clk)
|
92 |
|
|
// begin
|
93 |
|
|
// if ((&(pick_status[3:0] | pick_one_hot[3:0])) | tlu_rst)
|
94 |
|
|
// pick_status[3:0] <= 4'b0000 ; // clear pick_status
|
95 |
|
|
// else
|
96 |
|
|
// pick_status[3:0] <= pick_status[3:0] | pick_one_hot[3:0] ;
|
97 |
|
|
// // term replicated
|
98 |
|
|
// end
|
99 |
|
|
|
100 |
|
|
assign pick_status_reset = (&(pick_status[3:0] | pick_one_hot[3:0])) | tlu_rst;
|
101 |
|
|
assign pick_status_in = pick_status[3:0] | pick_one_hot[3:0];
|
102 |
|
|
|
103 |
113 |
albert.wat |
dffr_s #(4) dffre_pick_status (
|
104 |
95 |
fafa1971 |
.din (pick_status_in[3:0]), .q (pick_status[3:0]),
|
105 |
|
|
.rst (pick_status_reset), .clk (clk),
|
106 |
113 |
albert.wat |
.se (1'b0), `SIMPLY_RISC_SCANIN, .so ()
|
107 |
95 |
fafa1971 |
);
|
108 |
|
|
|
109 |
|
|
endmodule
|