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

Subversion Repositories s1_core

[/] [s1_core/] [trunk/] [hdl/] [rtl/] [sparc_core/] [sparc_exu_alu.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_exu_alu.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_exu_alu
29
*/
30
 
31
module sparc_exu_alu
32
(
33
 /*AUTOARG*/
34
   // Outputs
35
   so, alu_byp_rd_data_e, exu_ifu_brpc_e, exu_lsu_ldst_va_e,
36
   exu_lsu_early_va_e, exu_mmu_early_va_e, alu_ecl_add_n64_e,
37
   alu_ecl_add_n32_e, alu_ecl_log_n64_e, alu_ecl_log_n32_e,
38
   alu_ecl_zhigh_e, alu_ecl_zlow_e, exu_ifu_regz_e, exu_ifu_regn_e,
39
   alu_ecl_adderin2_63_e, alu_ecl_adderin2_31_e,
40
   alu_ecl_adder_out_63_e, alu_ecl_cout32_e, alu_ecl_cout64_e_l,
41
   alu_ecl_mem_addr_invalid_e_l,
42
   // Inputs
43
   rclk, se, si, byp_alu_rs1_data_e, byp_alu_rs2_data_e_l,
44
   byp_alu_rs3_data_e, byp_alu_rcc_data_e, ecl_alu_cin_e,
45
   ifu_exu_invert_d, ecl_alu_log_sel_and_e, ecl_alu_log_sel_or_e,
46
   ecl_alu_log_sel_xor_e, ecl_alu_log_sel_move_e,
47
   ecl_alu_out_sel_sum_e_l, ecl_alu_out_sel_rs3_e_l,
48
   ecl_alu_out_sel_shift_e_l, ecl_alu_out_sel_logic_e_l,
49
   shft_alu_shift_out_e, ecl_alu_sethi_inst_e, ifu_lsu_casa_e
50
   );
51
   input rclk;
52
   input se;
53
   input si;
54
   input [63:0] byp_alu_rs1_data_e;   // source operand 1
55
   input [63:0] byp_alu_rs2_data_e_l;  // source operand 2
56
   input [63:0] byp_alu_rs3_data_e;  // source operand 3
57
   input [63:0] byp_alu_rcc_data_e;  // source operand for reg condition codes
58
   input        ecl_alu_cin_e;            // cin for adder
59
   input        ifu_exu_invert_d;
60
   input  ecl_alu_log_sel_and_e;// These 4 wires are select lines for the logic
61
   input  ecl_alu_log_sel_or_e;// block mux.  They are active high and choose the
62
   input  ecl_alu_log_sel_xor_e;// output they describe.
63
   input  ecl_alu_log_sel_move_e;
64
   input  ecl_alu_out_sel_sum_e_l;// The following 4 are select lines for 
65
   input  ecl_alu_out_sel_rs3_e_l;// the output stage mux.  They are active high
66
   input  ecl_alu_out_sel_shift_e_l;// and choose the output of the respective block.
67
   input  ecl_alu_out_sel_logic_e_l;
68
   input [63:0] shft_alu_shift_out_e;// result from shifter
69
   input        ecl_alu_sethi_inst_e;
70
   input        ifu_lsu_casa_e;
71
 
72
   output       so;
73
   output [63:0] alu_byp_rd_data_e;          // alu result
74
   output [47:0] exu_ifu_brpc_e;// branch pc output
75
   output [47:0] exu_lsu_ldst_va_e; // address for lsu
76
   output [10:3] exu_lsu_early_va_e; // faster bits for cache
77
   output [7:0]  exu_mmu_early_va_e;
78
   output        alu_ecl_add_n64_e;
79
   output        alu_ecl_add_n32_e;
80
   output        alu_ecl_log_n64_e;
81
   output        alu_ecl_log_n32_e;
82
   output        alu_ecl_zhigh_e;
83
   output        alu_ecl_zlow_e;
84
   output    exu_ifu_regz_e;              // rs1_data == 0 
85
   output    exu_ifu_regn_e;
86
   output    alu_ecl_adderin2_63_e;
87
   output    alu_ecl_adderin2_31_e;
88
   output    alu_ecl_adder_out_63_e;
89
   output    alu_ecl_cout32_e;       // To ecl of sparc_exu_ecl.v
90
   output    alu_ecl_cout64_e_l;       // To ecl of sparc_exu_ecl.v
91
   output    alu_ecl_mem_addr_invalid_e_l;// adder_out[63:48] not all 1 or all 0
92
 
93
   wire         clk;
94
   wire [63:0] logic_out;       // result of logic block
95
   wire [63:0] adder_out;       // result of adder
96
   wire [63:0] spr_out;         // result of sum predict
97
   wire [63:0] zcomp_in;        // result going to zcompare
98
   wire [63:0] va_e;            // complete va
99
   wire [63:0] byp_alu_rs2_data_e;
100
   wire        invert_e;
101
   wire        ecl_alu_out_sel_sum_e;
102
   wire        ecl_alu_out_sel_rs3_e;
103
   wire        ecl_alu_out_sel_shift_e;
104
   wire        ecl_alu_out_sel_logic_e;
105
   assign      clk = rclk;
106
   assign      byp_alu_rs2_data_e[63:0] = ~byp_alu_rs2_data_e_l[63:0];
107
   assign      ecl_alu_out_sel_sum_e = ~ecl_alu_out_sel_sum_e_l;
108
   assign      ecl_alu_out_sel_rs3_e = ~ecl_alu_out_sel_rs3_e_l;
109
   assign      ecl_alu_out_sel_shift_e = ~ecl_alu_out_sel_shift_e_l;
110
   assign      ecl_alu_out_sel_logic_e = ~ecl_alu_out_sel_logic_e_l;
111
 
112
   // Zero comparison for exu_ifu_regz_e
113
   sparc_exu_aluzcmp64 regzcmp(.in(byp_alu_rcc_data_e[63:0]), .zero64(exu_ifu_regz_e));
114
   assign     exu_ifu_regn_e = byp_alu_rcc_data_e[63];
115
 
116
   // mux between adder output and rs1 (for casa) for lsu va
117
   dp_mux2es #(64)  lsu_va_mux(.dout(va_e[63:0]),
118
                               .in0(adder_out[63:0]),
119
                               .in1(byp_alu_rs1_data_e[63:0]),
120
                               .sel(ifu_lsu_casa_e));
121
   assign     exu_lsu_ldst_va_e[47:0] = va_e[47:0];
122
   // for bits 10:4 we have a separate bus that is not used for cas
123
   assign     exu_lsu_early_va_e[10:3] = adder_out[10:3];
124
   // mmu needs bits 7:0
125
   assign     exu_mmu_early_va_e[7:0] = adder_out[7:0];
126
 
127
 
128
   // Adder
129
   assign     exu_ifu_brpc_e[47:0] = adder_out[47:0];
130
   assign     alu_ecl_adder_out_63_e = adder_out[63];
131
   sparc_exu_aluaddsub addsub(.adder_out(adder_out[63:0]),
132
                              /*AUTOINST*/
133
                              // Outputs
134
                              .spr_out  (spr_out[63:0]),
135
                              .alu_ecl_cout64_e_l(alu_ecl_cout64_e_l),
136
                              .alu_ecl_cout32_e(alu_ecl_cout32_e),
137
                              .alu_ecl_adderin2_63_e(alu_ecl_adderin2_63_e),
138
                              .alu_ecl_adderin2_31_e(alu_ecl_adderin2_31_e),
139
                              // Inputs
140
                              .clk      (clk),
141
                              .se       (se),
142
                              .byp_alu_rs1_data_e(byp_alu_rs1_data_e[63:0]),
143
                              .byp_alu_rs2_data_e(byp_alu_rs2_data_e[63:0]),
144
                              .ecl_alu_cin_e(ecl_alu_cin_e),
145
                              .ifu_exu_invert_d(ifu_exu_invert_d));
146
 
147
   // Logic/pass rs2_data
148 113 albert.wat
   dff_s invert_d2e(.din(ifu_exu_invert_d), .clk(clk), .q(invert_e), .se(se), `SIMPLY_RISC_SCANIN, .so());
149
`ifdef SIMPLY_RISC_TWEAKS
150
   sparc_exu_alulogic alulogic(.rs1_data(byp_alu_rs1_data_e[63:0]),
151
`else
152
   sparc_exu_alulogic logic(.rs1_data(byp_alu_rs1_data_e[63:0]),
153
`endif
154 95 fafa1971
                            .rs2_data(byp_alu_rs2_data_e[63:0]),
155
                            .isand(ecl_alu_log_sel_and_e),
156
                            .isor(ecl_alu_log_sel_or_e),
157
                            .isxor(ecl_alu_log_sel_xor_e),
158
                            .pass_rs2_data(ecl_alu_log_sel_move_e),
159
                            .inv_logic(invert_e), .logic_out(logic_out[63:0]),
160
                            .ifu_exu_sethi_inst_e(ecl_alu_sethi_inst_e));
161
 
162
   // Mux between sum predict and logic outputs for zcc
163
   dp_mux2es #(64)  zcompmux(.dout(zcomp_in[63:0]),
164
                           .in0(logic_out[63:0]),
165
                           .in1(spr_out[63:0]),
166
                           .sel(ecl_alu_out_sel_sum_e));
167
 
168
   // Zero comparison for zero cc
169
//   sparc_exu_aluzcmp64 zcccmp(.in(zcomp_in[63:0]), .zero64(alu_ecl_z64_e),
170
//                          .zero32(alu_ecl_z32_e));
171
   assign        alu_ecl_zlow_e = ~(|zcomp_in[31:0]);
172
   assign        alu_ecl_zhigh_e = ~(|zcomp_in[63:32]);
173
 
174
   // Get Negative ccs
175
   assign   alu_ecl_add_n64_e = adder_out[63];
176
   assign   alu_ecl_add_n32_e = adder_out[31];
177
   assign   alu_ecl_log_n64_e = logic_out[63];
178
   assign   alu_ecl_log_n32_e = logic_out[31];
179
 
180
 
181
   // Mux for output
182
   mux4ds #(64) output_mux(.dout(alu_byp_rd_data_e[63:0]),
183
                         .in0(adder_out[63:0]),
184
                         .in1(byp_alu_rs3_data_e[63:0]),
185
                         .in2(shft_alu_shift_out_e[63:0]),
186
                         .in3(logic_out[63:0]),
187
                         .sel0(ecl_alu_out_sel_sum_e),
188
                         .sel1(ecl_alu_out_sel_rs3_e),
189
                         .sel2(ecl_alu_out_sel_shift_e),
190
                         .sel3(ecl_alu_out_sel_logic_e));
191
 
192
   // memory address checks
193
   sparc_exu_alu_16eql chk_mem_addr(.equal(alu_ecl_mem_addr_invalid_e_l),
194
                                    .in(va_e[63:47]));
195
 
196
endmodule  // sparc_exu_alu

powered by: WebSVN 2.1.0

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