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

Subversion Repositories sparc64soc

[/] [sparc64soc/] [trunk/] [T1-CPU/] [mul/] [sparc_mul_cntl.v] - Blame information for rev 7

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: sparc_mul_cntl.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
module sparc_mul_cntl(
22
  ecl_mul_req_vld,
23
  spu_mul_req_vld,
24
  spu_mul_acc,
25
  spu_mul_areg_shf,
26
  spu_mul_areg_rst,
27
  spu_mul_mulres_lshft,
28
  c0_act,
29
  spick,
30
  byp_sel,
31
  byp_imm,
32
  acc_imm,
33
  acc_actc2,
34
  acc_actc3,
35
  acc_actc5,
36
  acc_reg_enb,
37
  acc_reg_rst,
38
  acc_reg_shf,
39
  x2,
40
  mul_ecl_ack,
41
  mul_spu_ack,
42
  mul_spu_shf_ack,
43
  rst_l,
44
  rclk
45
  );
46
 
47
input           rclk;
48
input           rst_l;                  // System rest 
49
input           ecl_mul_req_vld;        // Input request from EXU to MUL
50
input           spu_mul_req_vld;        // Input request from SPU to MUL
51
input           spu_mul_acc;            // 1: SPU mul op req will accumulate the ACCUM register 
52
input           spu_mul_areg_shf;       // ACCUM shift right 64-bit
53
input           spu_mul_areg_rst;       // ACCUM reset; initialization of modular multiplication
54
input           spu_mul_mulres_lshft;   // For x2 of op1*op2*2 left shift
55
output          c0_act;                 // cycle-0 of muliplier operation
56
output          spick;
57
output          byp_sel;                // Bypass mux control
58
output          byp_imm;
59
output          acc_imm;
60
output          acc_actc2, acc_actc3;   // accumulate enable for LSB-32 and All-96
61
output          acc_actc5;              // accumulate enable for LSB-32 and All-96
62
output          acc_reg_enb;            // ACCUM register enable
63
output          acc_reg_rst;            // ACCUM register reset
64
output          acc_reg_shf;            // ACCUM register shift select
65
output          x2;
66
output          mul_ecl_ack;            // Ack EXU multiplier operation is accepted.
67
output          mul_spu_ack;            // Ack SPU multiplier operation is accepted.
68
output          mul_spu_shf_ack;        // Ack SPU shift operation is accepted.
69
 
70
reg             mul_ecl_ack_d;
71
reg             mul_spu_ack_d;
72
reg             c1_act;                 // Squash all mul requests from EXU and SPU if c1_act = 1
73
reg             c2_act;                 // Squash bypass ACCUM mul request from SPU if c2_act = 1
74
reg             c3_act;                 // Enable >>32 results back to CSA2 if c3_act = 1
75
reg             favor_e;                // Flag for alternate picker, favor to EXU if f_state = 1
76
reg             acc_actc1, acc_actc2, acc_actc3, acc_actc4, acc_actc5;
77
reg             acc_reg_shf, acc_reg_rst;
78
 
79
wire            exu_req_vld, spu_req_vld;
80
wire            epick;                  // Internal pick signals of exu, spu multiplier
81
wire            nobyps;                 // Squash SPU bypass mul requests nobyps = 1
82
wire            noshft;                 // Squash SPU bypass mul requests noshft = 1
83
wire            acc_reg_shf_in;
84
wire            spu_mul_byp = ~spu_mul_acc ;
85
wire            clk;
86
 
87
 
88
/////////////////////////////////////////
89
// Requests picker and general control //
90
/////////////////////////////////////////
91
 
92
assign clk = rclk ;
93
 
94
assign  c0_act = epick | spick ;                                // Cycle0 of multiplier operation
95
//assign        c1_act = mul_ecl_ack_d | mul_spu_ack_d ;                // Cycle1 of multiplier operation
96
assign  nobyps = c1_act | acc_actc2 | acc_actc3 | acc_actc4 ;   // Cycles prevent the SPU bypass 
97
 
98
assign  x2 = spick & spu_mul_mulres_lshft;
99
 
100
assign  exu_req_vld = ecl_mul_req_vld & ~c1_act ;
101
assign  spu_req_vld = spu_mul_req_vld & ~c1_act & ~(nobyps & spu_mul_byp);
102
 
103
assign  epick = exu_req_vld & ( favor_e | ~spu_req_vld) ;
104
assign  spick = spu_req_vld & (~favor_e | ~exu_req_vld) ;
105
 
106
// moved this one cycle earlier   
107
assign    mul_spu_ack = rst_l & spick ;
108
assign    mul_ecl_ack = rst_l & epick ;
109
 
110
always @(posedge clk)
111
  begin
112
        mul_ecl_ack_d <= rst_l & epick ;
113
        mul_spu_ack_d <= rst_l & spick ;
114
        c1_act <= rst_l & c0_act ;
115
        c2_act <= rst_l & c1_act ;
116
        c3_act <= rst_l & c2_act ;
117
 
118
        favor_e <= rst_l & (mul_spu_ack_d & ~mul_ecl_ack_d);
119
  end
120
 
121
/////////////////////////////////////////////////
122
// SPU accumulate and bypass and shift control //
123
/////////////////////////////////////////////////
124
 
125
assign  byp_sel = spick & spu_mul_byp ; // SPU bypass operand is picked 
126
 
127
//////////////////////////////////////////////////////////////////////////
128
//      No ACCUM >>= 64 allow if there are                              //
129
//      1) accumulate mul before cycle4 which need to updated ACCUM     //
130
//      2) Any mul at cyc3 which will use the same output mux at cyc-5  //
131
//////////////////////////////////////////////////////////////////////////
132
assign  noshft = acc_actc1 | acc_actc2 | c3_act | acc_actc4 ;
133
 
134
                                                // Squash shifr if:
135
assign  acc_reg_shf_in =   spu_mul_areg_shf &   // No shift request
136
                          ~noshft           &   // SPU accum mul in cycle1~4 or EXU mul in cycle3
137
                          ~acc_reg_shf ;        // reset SPU shift request for 1-cycle for signal upate
138
 
139
always @(posedge clk)
140
  begin
141
        acc_reg_shf <= rst_l & acc_reg_shf_in ;         // latch ACCUM reg shift control
142
 
143
        acc_reg_rst <=  spu_mul_areg_rst ;              // latch input control of ACCUM reg reset
144
 
145
        acc_actc1 <= rst_l & (spick & spu_mul_acc) ;    // SPU MAC in cycle 1
146
        acc_actc2 <= rst_l & acc_actc1 ;                        // SPU MAC in cycle 2 
147
        acc_actc3 <= rst_l & acc_actc2 ;                        // SPU MAC in cycle 3 
148
        acc_actc4 <= rst_l & acc_actc3 ;                        // SPU MAC in cycle 4 
149
        acc_actc5 <= rst_l & acc_actc4 ;                        // SPU MAC in cycle 5 
150
  end
151
 
152
assign  mul_spu_shf_ack = acc_reg_shf;
153
 
154
assign  byp_imm = acc_actc5 ;
155
 
156
assign  acc_imm = (acc_actc2 & acc_actc4) | ((acc_actc2 | acc_actc3) & acc_actc5)  ;
157
 
158
assign  acc_reg_enb = acc_actc5 | acc_reg_shf;          // enable of ACCUM registers 
159
 
160
 
161
endmodule // sparc_mul_cntl
162
 

powered by: WebSVN 2.1.0

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