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

Subversion Repositories s1_core

[/] [s1_core/] [trunk/] [hdl/] [rtl/] [sparc_core/] [sparc_mul_dp.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_mul_dp.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
//FPGA_SYN enables all FPGA related modifications
27 113 albert.wat
`ifdef FPGA_SYN
28
`define FPGA_SYN_CLK_EN
29
`define FPGA_SYN_CLK_DFF
30
`endif
31 95 fafa1971
 
32
module sparc_mul_dp(
33
  ecl_mul_rs1_data,
34
  ecl_mul_rs2_data,
35
  spu_mul_op1_data,
36
  spu_mul_op2_data,
37
  valid,
38
  spick,
39
  byp_sel,
40
  byp_imm,
41
  acc_imm,
42
  acc_actc2,
43
  acc_actc3,
44
  acc_actc5,
45
  acc_reg_enb,
46
  acc_reg_rst,
47
  acc_reg_shf,
48
  x2,
49
  mul_data_out,
50
  rst_l,
51
  si,
52
  so,
53
  se,
54
  rclk
55
  );
56
 
57
input [63:0]     ecl_mul_rs1_data;       // EXU mul operand 1
58
input [63:0]     ecl_mul_rs2_data;       // EXU mul operand 2
59
input [63:0]     spu_mul_op1_data;       // SPU mul operand 1    
60
input [63:0]     spu_mul_op2_data;       // SPU mul operand 2    
61
input           valid;                  // begin cyc0 of MUL operation
62
input           spick;                  // Internal pick signals of exu, spu multiplier 
63
input           byp_sel;                // SPU bypass ACCUM[63:0] as operand 
64
input           byp_imm;                // SPU bypss action from mout immediately 
65
input           acc_imm;                // SPU accumlate from mout immediately
66
input           acc_actc2, acc_actc3;   // accumulate enable for LSB-32 and All-96
67
input           acc_actc5;              // accumulate enable for LSB-32 and All-96
68
input           acc_reg_enb;            // ACCUM register enable
69
input           acc_reg_rst;            // ACCUM register reset
70
input           acc_reg_shf;            // ACCUM shift right 64-bit
71
input           x2;                     // for op1*op2*2
72
input           rst_l;                  // system  reset
73
input           si;                     // si
74
input           se;                     // scan_enable
75
input           rclk;
76
output          so;                     // so
77
output [63:0]    mul_data_out;           // Multiplier outputs
78
 
79
wire  [63:0]     mul_op1_d, mul_op2_d, bypreg;
80
wire  [63:32]   mux1_reg, mux1_mou;
81
wire  [96:0]    mux2_reg, areg;
82
wire  [135:0]    mout, acc_reg_in, acc_reg;
83
wire            op2_s0, op2_s1, op2_s2;
84
wire            acc_reg_shf2, clk_enb1;
85
wire            clk;
86
 
87
assign clk = rclk ;
88
 
89
///////////////////////////////////////////////////////////////////////////////
90
//////  op1 inputs mux between EXU and SPU 
91
///////////////////////////////////////////////////////////////////////////////
92
 
93
  assign mul_op1_d = ({64{spick}}  & spu_mul_op1_data) |
94
                     ({64{~spick}} & ecl_mul_rs1_data );
95
 
96
///////////////////////////////////////////////////////////////////////////////
97
//////  op2 inputs mux between EXU, SPU and bypass from ACCUM register
98
///////////////////////////////////////////////////////////////////////////////
99
 
100
  assign op2_s0 = ~spick;
101
  assign op2_s1 = spick & byp_sel ;
102
  assign op2_s2 = spick & ~byp_sel ;
103
  assign mul_op2_d = (op2_s0 & op2_s1)|(op2_s0 & op2_s2)|(op2_s1 & op2_s2) ? 64'hxx :
104
                     (op2_s0 ? ecl_mul_rs2_data :
105
                     (op2_s1 ? bypreg :
106
                     (op2_s2 ? spu_mul_op2_data : 64'hxx)
107
                      ));
108
 
109
///////////////////////////////////////////////////////////////////////////////
110
//////  Accumulate input muxes 
111
///////////////////////////////////////////////////////////////////////////////
112
 
113
// MUX1: Pass acc_reg[31:0] at cyc2 of SPU accumulate, otherwise acc_reg[63:32] 
114
  assign mux1_reg[63:32] = acc_actc2 ? acc_reg[31:0]
115
                                     : acc_reg[63:32] ;
116
 
117
// Bypass mout[31:0] (mul core output) of MAC1 at cyc5 when the lower 32-bit 
118
//        are ready but not lateched into acc_reg yet.
119
//
120
//  MAC1: cyc1  |cyc2   |cyc3   |       cyc4    |       cyc5    |       cyc6
121
//              |       |       |               |  mout[31:0]   |  acc_reg[128:0]       
122
//              |       |       |               |  bypass       |  latched out
123
//      
124
//  MAC2:                       |       cyc1    |       cyc2    |       
125
//                              |               |  ACCUM from   |       
126
//                              |               |  mout[31:0]   |
127
//                                              
128
  assign mux1_mou[63:32] = (acc_actc2 & acc_actc5) ? mout[31:0]
129
                                                   : mout[63:32] ;
130
 
131
// MUX2: Immediate bypass from mout (output of mul core)
132
  assign mux2_reg[96:0]  = acc_imm   ? {mout[128:64],mux1_mou[63:32]}
133
                                     : {acc_reg[128:64],mux1_reg[63:32]};
134
 
135
// Enable of accumulate reg input to multipler core
136
  assign areg[96:32] = mux2_reg[96:32] & {65{acc_actc3}} ;
137
  assign areg[31:0] =  mux2_reg[31:0]  & {32{(acc_actc3 | acc_actc2)}};
138
 
139
 
140
 
141
///////////////////////////////////////////////////////////////////////////////
142
//////  Multiplier core connection
143
///////////////////////////////////////////////////////////////////////////////
144
 
145
  mul64         mulcore(.rs1_l  (~mul_op1_d),
146
                        .rs2    (mul_op2_d),
147
                        .valid  (valid),
148
                        .areg   (areg),
149
                        .accreg (acc_reg[135:129]),
150
                        .x2     (x2),
151
                        .out    (mout),
152
                        .rclk   (clk),
153 113 albert.wat
                        `SIMPLY_RISC_SCANIN,
154 95 fafa1971
                        .so     (),
155
                        .se     (se),
156
                        .mul_rst_l (rst_l),
157
                        .mul_step  (1'b1)
158
                        );
159
 
160
///////////////////////////////////////////////////////////////////////////////
161
/////   ACCUM register and right shift muxes
162
///////////////////////////////////////////////////////////////////////////////
163
 
164 113 albert.wat
  dff_s         dffshf (.din    (acc_reg_shf),
165 95 fafa1971
                        .clk    (clk),
166
                        .q      (acc_reg_shf2),
167
                        .se     (se),
168 113 albert.wat
                        `SIMPLY_RISC_SCANIN,
169 95 fafa1971
                        .so     ()
170
                        );
171
 
172
  assign acc_reg_in  =  acc_reg_shf  ?  {64'b0,acc_reg[135:64]}
173
                                     :  mout ;
174
 
175
  assign mul_data_out = acc_reg_shf2 ?  acc_reg[63:0]
176
                                     :  mout[63:0]       ;
177
 
178 113 albert.wat
`ifdef FPGA_SYN_CLK_DFF
179
  dffre_s  #(136)  accum  (.din    (acc_reg_in),
180 95 fafa1971
                        .rst    (acc_reg_rst),
181
                        .en (acc_reg_enb | acc_reg_rst), .clk(clk), //manually fixed
182
                        .q      (acc_reg),
183
                        .se     (se),
184 113 albert.wat
                        `SIMPLY_RISC_SCANIN,
185 95 fafa1971
                        .so     ()
186
                        );
187 113 albert.wat
`else
188
  dffr_s  #(136)  accum  (.din    (acc_reg_in),
189
                        .rst    (acc_reg_rst),
190
                        .clk    (clk_enb1),
191
                        .q      (acc_reg),
192
                        .se     (se),
193
                        `SIMPLY_RISC_SCANIN,
194
                        .so     ()
195
                        );
196
`endif
197 95 fafa1971
 
198 113 albert.wat
`ifdef FPGA_SYN_CLK_EN
199
`else
200
  clken_buf     ckbuf_1(.clk(clk_enb1), .rclk(clk), .enb_l(~(acc_reg_enb | acc_reg_rst)), .tmb_l(~se));
201
`endif
202 95 fafa1971
 
203
 
204
  assign bypreg =  byp_imm ? mout[63:0]
205
                           : acc_reg[63:0] ;
206
 
207
endmodule
208
 

powered by: WebSVN 2.1.0

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