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

Subversion Repositories sparc64soc

[/] [sparc64soc/] [trunk/] [T1-CPU/] [exu/] [sparc_exu_div_yreg.v] - Blame information for rev 2

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 2 dmitryr
// ========== Copyright Header Begin ==========================================
2
// 
3
// OpenSPARC T1 Processor File: sparc_exu_div_yreg.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
//  Module Name: sparc_exu_div_yreg
24
//      Description: The 4 32 bit y registers.  It can be written to
25
//              twice each cycle because by definition the writes must come
26
//              from different threads.  There is no bypassing because wry switches out.
27
*/
28
module sparc_exu_div_yreg (/*AUTOARG*/
29
   // Outputs
30
   yreg_mdq_y_e, div_ecl_yreg_0_l,
31
   // Inputs
32
   clk, se, byp_div_yreg_data_w, mul_div_yreg_data_g, ecl_div_thr_e,
33
   ecl_div_yreg_wen_w, ecl_div_yreg_wen_g, ecl_div_yreg_wen_l,
34
   ecl_div_yreg_data_31_g, ecl_div_yreg_shift_g
35
   ) ;
36
   input clk;
37
   input se;
38
   input [31:0] byp_div_yreg_data_w;
39
   input [31:0] mul_div_yreg_data_g;
40
   input [3:0]  ecl_div_thr_e;
41
   input [3:0]  ecl_div_yreg_wen_w;
42
   input [3:0]  ecl_div_yreg_wen_g;
43
   input [3:0]  ecl_div_yreg_wen_l;// w or w2
44
   input        ecl_div_yreg_data_31_g;// bit shifted in on muls
45
   input [3:0]  ecl_div_yreg_shift_g;// yreg should be shifted
46
 
47
   output [31:0] yreg_mdq_y_e;
48
   output [3:0]  div_ecl_yreg_0_l;
49
 
50
   wire [31:0]   next_yreg_thr0;// next value for yreg
51
   wire [31:0]   next_yreg_thr1;
52
   wire [31:0]   next_yreg_thr2;
53
   wire [31:0]   next_yreg_thr3;
54
   wire [31:0]   yreg_thr0;     // current value of yreg
55
   wire [31:0]   yreg_thr1;
56
   wire [31:0]   yreg_thr2;
57
   wire [31:0]   yreg_thr3;
58
   wire [3:0]    div_ecl_yreg_0;
59
   wire [31:0]   yreg_data_w1;
60
 
61
 
62
   //////////////////////////////////
63
   //  Output selection for yreg
64
   //////////////////////////////////
65
   // output the LSB of all 4 regs
66
   assign        div_ecl_yreg_0[3:0] = {yreg_thr3[0],yreg_thr2[0],yreg_thr1[0],yreg_thr0[0]};
67
   assign        div_ecl_yreg_0_l[3:0] = ~div_ecl_yreg_0[3:0];
68
 
69
`ifdef FPGA_SYN_1THREAD
70
 
71
   assign        yreg_mdq_y_e[31:0] = yreg_thr0[31:0];
72
 
73
`else
74
 
75
   // mux between the 4 yregs
76
   mux4ds #(32) mux_yreg_out(.dout(yreg_mdq_y_e[31:0]), .sel0(ecl_div_thr_e[0]),
77
                         .sel1(ecl_div_thr_e[1]), .sel2(ecl_div_thr_e[2]),
78
                         .sel3(ecl_div_thr_e[3]), .in0(yreg_thr0[31:0]),
79
                         .in1(yreg_thr1[31:0]), .in2(yreg_thr2[31:0]),
80
                         .in3(yreg_thr3[31:0]));
81
`endif
82
 
83
   //////////////////////////////////////
84
   //  Storage of yreg
85
   //////////////////////////////////////
86
   // pass along yreg w to w2 (for control signal timing)
87
   dff_s #(32) yreg_dff_w2w2(.din(byp_div_yreg_data_w[31:0]), .clk(clk), .q(yreg_data_w1[31:0]),
88
                           .se(se), .si(), .so());
89
 
90
 
91
   // mux between yreg_w, yreg_g, old value
92
   mux4ds #(32) mux_yregin0(.dout(next_yreg_thr0[31:0]),
93
                          .sel0(ecl_div_yreg_wen_w[0]),
94
                          .sel1(ecl_div_yreg_wen_g[0]),
95
                          .sel2(ecl_div_yreg_wen_l[0]),
96
                          .sel3(ecl_div_yreg_shift_g[0]),
97
                          .in0(yreg_data_w1[31:0]),
98
                          .in1(mul_div_yreg_data_g[31:0]),
99
                          .in2(yreg_thr0[31:0]),
100
                          .in3({ecl_div_yreg_data_31_g, yreg_thr0[31:1]}));
101
`ifdef FPGA_SYN_1THREAD
102
   assign        next_yreg_thr1[31:0] = yreg_data_w1[31:0];
103
   assign        next_yreg_thr2[31:0] = yreg_data_w1[31:0];
104
   assign        next_yreg_thr3[31:0] = yreg_data_w1[31:0];
105
 
106
`else
107
 
108
   mux4ds #(32) mux_yregin1(.dout(next_yreg_thr1[31:0]),
109
                          .sel0(ecl_div_yreg_wen_w[1]),
110
                          .sel1(ecl_div_yreg_wen_g[1]),
111
                          .sel2(ecl_div_yreg_wen_l[1]),
112
                          .sel3(ecl_div_yreg_shift_g[1]),
113
                          .in0(yreg_data_w1[31:0]),
114
                          .in1(mul_div_yreg_data_g[31:0]),
115
                          .in2(yreg_thr1[31:0]),
116
                          .in3({ecl_div_yreg_data_31_g, yreg_thr1[31:1]}));
117
   mux4ds #(32) mux_yregin2(.dout(next_yreg_thr2[31:0]),
118
                          .sel0(ecl_div_yreg_wen_w[2]),
119
                          .sel1(ecl_div_yreg_wen_g[2]),
120
                          .sel2(ecl_div_yreg_wen_l[2]),
121
                          .sel3(ecl_div_yreg_shift_g[2]),
122
                          .in0(yreg_data_w1[31:0]),
123
                          .in1(mul_div_yreg_data_g[31:0]),
124
                          .in2(yreg_thr2[31:0]),
125
                          .in3({ecl_div_yreg_data_31_g, yreg_thr2[31:1]}));
126
   mux4ds #(32) mux_yregin3(.dout(next_yreg_thr3[31:0]),
127
                          .sel0(ecl_div_yreg_wen_w[3]),
128
                          .sel1(ecl_div_yreg_wen_g[3]),
129
                          .sel2(ecl_div_yreg_wen_l[3]),
130
                          .sel3(ecl_div_yreg_shift_g[3]),
131
                          .in0(yreg_data_w1[31:0]),
132
                          .in1(mul_div_yreg_data_g[31:0]),
133
                          .in2(yreg_thr3[31:0]),
134
                          .in3({ecl_div_yreg_data_31_g, yreg_thr3[31:1]}));
135
`endif // !`ifdef FPGA_SYN_1THREAD
136
 
137
   // store new value
138
   dff_s #(32) dff_yreg_thr0(.din(next_yreg_thr0[31:0]), .clk(clk), .q(yreg_thr0[31:0]),
139
                       .se(se), .si(), .so());
140
   dff_s #(32) dff_yreg_thr1(.din(next_yreg_thr1[31:0]), .clk(clk), .q(yreg_thr1[31:0]),
141
                       .se(se), .si(), .so());
142
   dff_s #(32) dff_yreg_thr2(.din(next_yreg_thr2[31:0]), .clk(clk), .q(yreg_thr2[31:0]),
143
                       .se(se), .si(), .so());
144
   dff_s #(32) dff_yreg_thr3(.din(next_yreg_thr3[31:0]), .clk(clk), .q(yreg_thr3[31:0]),
145
                       .se(se), .si(), .so());
146
 
147
 
148
endmodule // sparc_exu_div_yreg

powered by: WebSVN 2.1.0

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