OpenCores
URL https://opencores.org/ocsvn/s1_core/s1_core/trunk

Subversion Repositories s1_core

[/] [s1_core/] [trunk/] [hdl/] [rtl/] [sparc_core/] [lsu_rrobin_picker2.v] - Blame information for rev 113

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 95 fafa1971
// ========== Copyright Header Begin ==========================================
2
// 
3
// OpenSPARC T1 Processor File: lsu_rrobin_picker2.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
//                      (see description of picker at the end of this file)
30
*/
31
////////////////////////////////////////////////////////////////////////
32
// Global header file includes
33
////////////////////////////////////////////////////////////////////////
34 113 albert.wat
`include        "sys.h" // system level definition file which contains the
35 95 fafa1971
                                        // time scale definition
36
 
37
////////////////////////////////////////////////////////////////////////
38
// Local header file includes / local defines
39
////////////////////////////////////////////////////////////////////////    
40
 
41
module lsu_rrobin_picker2 (/*AUTOARG*/
42
   // Outputs
43
   so, pick_one_hot,
44
   // Inputs
45
   rclk, grst_l, arst_l, si, se, events, events_picked, thread_force
46
   );
47
 
48
input           rclk ;
49
input           grst_l;
50
input           arst_l;
51
input           si;
52
input           se;
53
output          so;
54
 
55
 
56
input   [3:0]    events ;                // multi-hot; events that could be chosen
57
input   [3:0]    events_picked ;         // one-hot; events that were picked - same cycle as pick
58
input   [3:0]    thread_force ;          // multi-hot; thread events that have high priority
59
 
60
output  [3:0]    pick_one_hot ;          // one-hot
61
 
62
wire         clk;
63
wire         reset,dbb_reset_l ;
64
 
65
wire  [3:0]  thread_force_pe_mask ;
66
wire  [3:0]  pick_thread_force_1hot ;
67
wire         thread_force_events_sel ;
68
 
69
wire  [3:0]  pick_rrobin_1hot, pick_rev_rrobin_1hot, pick_rrobin_1hot_mx ;
70
wire         events_pick_dir_d1 ;
71
wire         events_pick_dir ;
72
wire  [3:0]  pick_rrobin_status_or_one_hot ;
73
wire  [3:0]  pick_rrobin_din ;
74
wire  [3:0]  pick_rrobin ;
75
wire         pick_rrobin_reset ;
76
wire         pick_rrobin_dir_upd ;
77
wire  [3:0]  pick_rrobin_events ;
78
 
79
 
80
 
81
    dffrl_async rstff(.din (grst_l),
82
                        .q   (dbb_reset_l),
83 113 albert.wat
                        .clk (clk), .se(se), `SIMPLY_RISC_SCANIN, .so(),
84 95 fafa1971
                        .rst_l (arst_l));
85
 
86
assign  reset =  ~dbb_reset_l;
87
assign  clk = rclk;
88
 
89
 
90
//*******************************************************************************************************
91
//PICK  
92
//*******************************************************************************************************
93
 
94
   //pick for thread force events
95
assign  thread_force_events_sel = |(events[3:0] & thread_force[3:0]) ;
96
 
97
assign  thread_force_pe_mask[3:0]  =  events[3:0] & thread_force[3:0] ;
98
assign  pick_thread_force_1hot[0] = thread_force_pe_mask[0] ;
99
assign  pick_thread_force_1hot[1] = thread_force_pe_mask[1] & ~thread_force_pe_mask[0] ;
100
assign  pick_thread_force_1hot[2] = thread_force_pe_mask[2] & ~|thread_force_pe_mask[1:0] ;
101
assign  pick_thread_force_1hot[3] = thread_force_pe_mask[3] & ~|thread_force_pe_mask[2:0] ;
102
 
103
   //pick for round robin events
104
assign  pick_rrobin_events[3:0]  =  events[3:0] & ~pick_rrobin[3:0] ;
105
 
106
assign  pick_rrobin_1hot[0] = ~events_pick_dir_d1 & pick_rrobin_events[0] ;
107
assign  pick_rrobin_1hot[1] = ~events_pick_dir_d1 & pick_rrobin_events[1] & ~pick_rrobin_events[0] ;
108
assign  pick_rrobin_1hot[2] = ~events_pick_dir_d1 & pick_rrobin_events[2] & ~|pick_rrobin_events[1:0] ;
109
assign  pick_rrobin_1hot[3] = ~events_pick_dir_d1 & pick_rrobin_events[3] & ~|pick_rrobin_events[2:0] ;
110
 
111
   //pick for reverse round robin events
112
assign  pick_rev_rrobin_1hot[0] = events_pick_dir_d1 & pick_rrobin_events[0] & ~|pick_rrobin_events[3:1] ;
113
assign  pick_rev_rrobin_1hot[1] = events_pick_dir_d1 & pick_rrobin_events[1] & ~|pick_rrobin_events[3:2] ;
114
assign  pick_rev_rrobin_1hot[2] = events_pick_dir_d1 & pick_rrobin_events[2] & ~|pick_rrobin_events[3] ;
115
assign  pick_rev_rrobin_1hot[3] = events_pick_dir_d1 & pick_rrobin_events[3] ;
116
 
117
assign  pick_rrobin_1hot_mx[3:0]  =  pick_rev_rrobin_1hot[3:0] | pick_rrobin_1hot[3:0] ;
118
assign  pick_one_hot[3:0]    =  thread_force_events_sel ? pick_thread_force_1hot[3:0] :
119
                                                          pick_rrobin_1hot_mx[3:0] ;
120
 
121
//*******************************************************************************************************
122
 
123
 
124
 
125
//*******************************************************************************************************
126
//PICK ROUND ROBIN (bug4814)
127
//*******************************************************************************************************
128
// this is used if there are no requests to be picked based on pick_status[3:0]
129
 
130
assign pick_rrobin_status_or_one_hot[3:0] = pick_rrobin[3:0] | events_picked[3:0] ;
131
assign pick_rrobin_reset = reset | ~|(events[3:0] & ~pick_rrobin_status_or_one_hot[3:0]) ;
132
   //change direction bit only when events are non-zero
133
assign pick_rrobin_dir_upd = |events[3:0] & (~|(events[3:0] & ~pick_rrobin_status_or_one_hot[3:0])) ;
134
 
135
   // make reset dominant
136
assign pick_rrobin_din[3:0] = pick_rrobin_status_or_one_hot[3:0] & ~{4{pick_rrobin_reset}};
137
 
138 113 albert.wat
dff_s   #(4) ff_pick_rrobin (
139 95 fafa1971
           .din    (pick_rrobin_din[3:0]),
140
           .q      (pick_rrobin[3:0]    ),
141
           .clk    (clk),
142 113 albert.wat
           .se     (1'b0),       `SIMPLY_RISC_SCANIN,          .so ()
143 95 fafa1971
            );
144
//*******************************************************************************************************
145
 
146
 
147
//*******************************************************************************************************
148
// PICK DIRECTION
149
//*******************************************************************************************************
150
 
151
   //bug4609 - change direction of pick all events are picked in round robin pick
152
   //          this is needed when the condition below occurs. assuming misc is less frequent
153
   //          this should pick load/store in round robin fashion
154
   //-------------------------------------------------------
155
   // cycle                 0   1   2
156
   //-------------------------------------------------------
157
   // history{misc,st,ld}  010 011 011
158
   // vld{misc,st,ld}      011 011 011
159
   //-------------------------------------------------------
160
 
161
assign events_pick_dir  =  ~reset &
162
                           (( ~pick_rrobin_dir_upd & events_pick_dir_d1) |              //hold
163
                            (  pick_rrobin_dir_upd & ~events_pick_dir_d1)) ;            //set - invert direction
164
 
165 113 albert.wat
   dff_s   #(1) ff_events_pick_dir (
166 95 fafa1971
        .din    (events_pick_dir),
167
        .q      (events_pick_dir_d1),
168
        .clk    (clk),
169 113 albert.wat
        .se     (1'b0),       `SIMPLY_RISC_SCANIN,          .so ()
170 95 fafa1971
        );
171
 
172
//*******************************************************************************************************
173
endmodule

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.