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

Subversion Repositories sparc64soc

[/] [sparc64soc/] [trunk/] [T1-CPU/] [lsu/] [lsu_rrobin_picker2.v] - Blame information for rev 8

Go to most recent revision | Details | Compare with Previous | View Log

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

powered by: WebSVN 2.1.0

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