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

Subversion Repositories s1_core

[/] [s1_core/] [trunk/] [hdl/] [rtl/] [sparc_core/] [sparc_ifu_imd.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: sparc_ifu_imd.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
//  Module Name: sparc_ifu_imd
29
//  Description:
30
//  Contains the immediate operand datapath.  Has two outputs:  The
31
//  simm data to the EXU and the branch offset to the IFU.
32
*/
33
 
34
 
35
module sparc_ifu_imd(/*AUTOARG*/
36
   // Outputs
37
   ifu_exu_imm_data_d, dtu_inst_d, ifu_exu_rd_d, ifu_lsu_rd_e,
38
   ifu_lsu_imm_asi_d, ifu_tlu_imm_asi_d, ifu_lsu_imm_asi_vld_d, ifu_tlu_sraddr_d,
39
   ifu_tlu_sraddr_d_v2, imd_dcl_brcond_d, imd_dcl_mvcond_d,
40
   imd_dcl_abit_d, so, ifu_ffu_frs1_d, ifu_ffu_frs2_d, ifu_ffu_frd_d,
41
   ifu_ffu_fpopcode_d, ifu_ffu_fcc_num_d,
42
   // Inputs
43
   rclk, se, si, fdp_dtu_inst_s, fcl_imd_oddwin_d,
44
   dcl_imd_immdata_sel_simm13_d_l, dcl_imd_immdata_sel_movcc_d_l,
45
   dcl_imd_immdata_sel_sethi_d_l, dcl_imd_immdata_sel_movr_d_l,
46
   dcl_imd_broff_sel_call_d_l, dcl_imd_broff_sel_br_d_l,
47
   dcl_imd_broff_sel_bcc_d_l, dcl_imd_broff_sel_bpcc_d_l,
48
   dcl_imd_immbr_sel_br_d, dcl_imd_call_inst_d
49
   );
50
 
51
   input rclk,
52
         se,
53
         si;
54
 
55
   input [31:0] fdp_dtu_inst_s;          // instruction from fetch
56
 
57
   input        fcl_imd_oddwin_d;       // are we in an even or odd window
58
 
59
   input        dcl_imd_immdata_sel_simm13_d_l,  // imm data selects
60
                            dcl_imd_immdata_sel_movcc_d_l,
61
                            dcl_imd_immdata_sel_sethi_d_l,
62
                            dcl_imd_immdata_sel_movr_d_l;
63
 
64
   input        dcl_imd_broff_sel_call_d_l,      // dir branch offset select
65
                            dcl_imd_broff_sel_br_d_l,
66
                            dcl_imd_broff_sel_bcc_d_l,
67
                            dcl_imd_broff_sel_bpcc_d_l;
68
 
69
   input        dcl_imd_immbr_sel_br_d;  // use branch offset or simm data
70
   input        dcl_imd_call_inst_d;
71
 
72
   output [31:0] ifu_exu_imm_data_d;      // imm data to EXU
73
   output [31:0] dtu_inst_d;              // D stage inst to DEC
74
 
75
   output [4:0]  ifu_exu_rd_d,
76
                             ifu_lsu_rd_e;
77
 
78
   output [7:0]  ifu_lsu_imm_asi_d;       // ASI for ldA and stA
79
   output [8:0]  ifu_tlu_imm_asi_d;       // ASI for ldA and stA
80
   output        ifu_lsu_imm_asi_vld_d;
81
   output [6:0]  ifu_tlu_sraddr_d;
82
   output [6:0]  ifu_tlu_sraddr_d_v2;
83
   output [3:0]  imd_dcl_brcond_d;
84
   output [7:0]  imd_dcl_mvcond_d;
85
 
86
   output        imd_dcl_abit_d;         // anull bit for cond branch
87
 
88
   output        so;
89
 
90
   output [4:0]  ifu_ffu_frs1_d,
91
                             ifu_ffu_frs2_d,
92
                             ifu_ffu_frd_d;
93
 
94
   output [8:0]  ifu_ffu_fpopcode_d;
95
   output [1:0]  ifu_ffu_fcc_num_d;
96
 
97
 
98
//-----------------------------------
99
// Declaration of local signals
100
//----------------------------------
101
   wire [4:0]  sraddr5;
102
 
103
   wire [31:0] imm_data_d;       // imm data 
104
 
105
   wire [31:0] dtu_inst_d,
106
                           simm13,
107
                           simm11,
108
                           simm10,
109
                           imm22,
110
                           dbr16,
111
                           dbcc22_nopred,
112
                           dbcc19_pred,
113
                           dcall,
114
                           broffset_d;
115
 
116
   wire        clk, ifu_lsu_imm_asi_vld_f;
117
 
118
 
119
//----------------------------------------------------------------------
120
// Code starts here 
121
//----------------------------------------------------------------------
122
   assign      clk = rclk;
123
 
124
   //--------
125
   // S Stage
126
   // Contains mostly random logic to help with decode in D stage
127
   //--------
128
 
129
   // Regfile operations:
130
   // REMOVED
131
//   assign ifu_exu_rs1_s = fdp_dtu_inst_s[18:14] ^ 
132
//                        {{fdp_dtu_inst_s[17] & dcl_imd_oddwin_s},  4'b0000};
133
 
134
//   assign ifu_exu_rs2_s = fdp_dtu_inst_s[4:0] ^ 
135
//                        {{fdp_dtu_inst_s[3] & dcl_imd_oddwin_s},  4'b0000};
136
 
137
//   assign ifu_exu_rs3_s = fdp_dtu_inst_s[29:25] ^ 
138
//                        {{fdp_dtu_inst_s[28] & dcl_imd_oddwin_s},  4'b0000};
139
 
140
//   assign imd_dcl_op_s = fdp_dtu_inst_s[31:30];
141
//   assign imd_dcl_op3_s = fdp_dtu_inst_s[24:19];
142
 
143
   //--------
144
   // D stage
145
   // Contains the immediate data and branch offset muxes
146
   //--------
147
 
148 113 albert.wat
   dff_s #(32) inst_d_reg(.din  (fdp_dtu_inst_s),
149 95 fafa1971
                      .clk  (clk),
150
                      .q    (dtu_inst_d),
151 113 albert.wat
                      .se   (se), `SIMPLY_RISC_SCANIN, .so());
152 95 fafa1971
 
153 113 albert.wat
   dff_s #(1) ifu_lsu_imm_asi_inst(.din  (fdp_dtu_inst_s[13]),
154 95 fafa1971
                      .clk  (clk),
155
                      .q    (ifu_lsu_imm_asi_vld_f),
156 113 albert.wat
                      .se   (se), `SIMPLY_RISC_SCANIN, .so());
157 95 fafa1971
 
158
   assign imd_dcl_abit_d = dtu_inst_d[29];
159
 
160
   // imm data select
161
   // sext12:0 -- add/sub/and/or/xor/taggedOP/jmpl/ld/store/atomic/div/mul/popc
162
   //             prefetch/return/restore/save/sir/wr/shft/flush
163
   //  !!!CAS does not use Imm data!!!
164
   //
165
   // sext10:0 -- movcc
166
   // sext9:0  -- movr
167
   // 21:0,10'b0 -- sethi
168
 
169
   assign simm13 = {{19{dtu_inst_d[12]}},dtu_inst_d[12:0]};
170
   assign simm11 = {{21{dtu_inst_d[10]}},dtu_inst_d[10:0]};
171
   assign simm10 = {{22{dtu_inst_d[9]}},dtu_inst_d[9:0]};
172
   assign imm22  = {dtu_inst_d[21:0], 10'b0};
173
 
174
   dp_mux4ds  #(32) immdata_mux(.dout (imm_data_d),
175
                          .in0  (simm13),
176
                          .in1  (simm11),
177
                          .in2  (simm10),
178
                          .in3  (imm22),
179
                          .sel0_l (dcl_imd_immdata_sel_simm13_d_l),
180
                          .sel1_l (dcl_imd_immdata_sel_movcc_d_l),
181
                          .sel2_l (dcl_imd_immdata_sel_movr_d_l),
182
                          .sel3_l (dcl_imd_immdata_sel_sethi_d_l));
183
 
184
 
185
   // branch offset select
186
   assign dbr16 = {{14{dtu_inst_d[21]}}, dtu_inst_d[21:20],
187
                   dtu_inst_d[13:0], 2'b0};
188
   assign dbcc22_nopred = {{8{dtu_inst_d[21]}}, dtu_inst_d[21:0], 2'b0};
189
   assign dbcc19_pred = {{11{dtu_inst_d[18]}}, dtu_inst_d[18:0], 2'b0};
190
   assign dcall = {dtu_inst_d[29:0], 2'b0};
191
 
192
   dp_mux4ds  #(32) broffset_mux(.dout   (broffset_d[31:0]),
193
                           .in0    (dcall[31:0]),          // call
194
                           .in1    (dbr16[31:0]),          // br on reg
195
                           .in2    (dbcc22_nopred[31:0]),  // branch w/o pred
196
                           .in3    (dbcc19_pred[31:0]),    // branch w/ pred
197
                           .sel0_l (dcl_imd_broff_sel_call_d_l),
198
                           .sel1_l (dcl_imd_broff_sel_br_d_l),
199
                           .sel2_l (dcl_imd_broff_sel_bcc_d_l),
200
                           .sel3_l (dcl_imd_broff_sel_bpcc_d_l));
201
 
202
   dp_mux2es #(32) immbr_mux(.dout (ifu_exu_imm_data_d[31:0]),
203
                           .in0  (imm_data_d[31:0]),
204
                           .in1  (broffset_d[31:0]),
205
                           .sel  (dcl_imd_immbr_sel_br_d));
206
 
207
   // branch/move condition to dcl
208
   assign imd_dcl_brcond_d = dtu_inst_d[28:25];
209
   assign imd_dcl_mvcond_d = dtu_inst_d[17:10];
210
 
211
   // if call instruction set rd = 0f (15)
212
   assign ifu_exu_rd_d[3:0] = dtu_inst_d[28:25] | {4{dcl_imd_call_inst_d}};
213
   assign ifu_exu_rd_d[4] = (dtu_inst_d[29] & ~dcl_imd_call_inst_d) ^
214
                              (ifu_exu_rd_d[3] & fcl_imd_oddwin_d);
215
 
216 113 albert.wat
   dff_s #(5) rde_ff(.din (ifu_exu_rd_d[4:0]),
217 95 fafa1971
                 .clk (clk),
218
                 .q   (ifu_lsu_rd_e[4:0]),
219 113 albert.wat
                 .se  (se), `SIMPLY_RISC_SCANIN, .so());
220 95 fafa1971
 
221
   // read/write pr and read/write sr
222
   dp_mux2es #(5)  sraddr_mux(.dout (sraddr5[4:0]),
223
                            .in0  (dtu_inst_d[18:14]),  // rs1 for rdpr
224
                            .in1  (dtu_inst_d[29:25]),  // rd  for wrpr
225
                            .sel  (dtu_inst_d[23]));
226
 
227
   assign ifu_tlu_sraddr_d = {dtu_inst_d[19],                     // hpriv
228
                              {dtu_inst_d[20] & ~dtu_inst_d[19]}, // priv
229
                              sraddr5[4:0]};
230
   assign ifu_tlu_sraddr_d_v2 = ifu_tlu_sraddr_d;
231
 
232
 
233
   // asi fields for stA, ldA
234
   // same as fpopcode_d
235
 
236
   assign ifu_lsu_imm_asi_d[7:0] = dtu_inst_d[12:5];
237
   assign ifu_tlu_imm_asi_d[8:0] = dtu_inst_d[13:5];
238
 
239
   assign ifu_lsu_imm_asi_vld_d = ~ifu_lsu_imm_asi_vld_f;
240
 
241
   // fp reg fields
242
   assign ifu_ffu_frd_d = dtu_inst_d[29:25];
243
   assign ifu_ffu_fcc_num_d = dtu_inst_d[26:25];
244
   assign ifu_ffu_frs1_d = dtu_inst_d[18:14];
245
   assign ifu_ffu_fpopcode_d = dtu_inst_d[13:5];
246
   assign ifu_ffu_frs2_d = dtu_inst_d[4:0];
247
 
248
endmodule // sparc_ifu_imd

powered by: WebSVN 2.1.0

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