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

Subversion Repositories s1_core

[/] [s1_core/] [trunk/] [hdl/] [rtl/] [sparc_core/] [sparc_exu_aluaddsub.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_aluaddsub.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_aluaddsub
29
//      Description:            This block implements addition and subtraction.
30
//            It takes two operands, a carry_in, plus two control signals
31
//            (subtract and use_cin).  If subtract is high, then rs2_data
32
//            is subtracted from rs1_data.  If use_cin is high, then
33
//            carry_in is added to the sum (addition) or subtracted from
34
//            the result (subtraction).  It outputs the result of the
35
//            specified operation.  To keep the cin calculation from
36
//            being in the critical path, it is moved into the d-stage.
37
//            All other calculations are in the e-stage.
38
*/
39
 
40
module sparc_exu_aluaddsub
41
  (/*AUTOARG*/
42
   // Outputs
43
   adder_out, spr_out, alu_ecl_cout64_e_l, alu_ecl_cout32_e,
44
   alu_ecl_adderin2_63_e, alu_ecl_adderin2_31_e,
45
   // Inputs
46
   clk, se, byp_alu_rs1_data_e, byp_alu_rs2_data_e, ecl_alu_cin_e,
47
   ifu_exu_invert_d
48
   );
49
   input clk;
50
   input se;
51
   input [63:0] byp_alu_rs1_data_e;   // 1st input operand
52
   input [63:0]  byp_alu_rs2_data_e;   // 2nd input operand
53
   input         ecl_alu_cin_e;           // carry in
54
   input         ifu_exu_invert_d;     // subtract used by adder
55
 
56
   output [63:0] adder_out; // result of adder
57
   output [63:0] spr_out;   // result of sum predict
58
   output         alu_ecl_cout64_e_l;
59
   output         alu_ecl_cout32_e;
60
   output       alu_ecl_adderin2_63_e;
61
   output       alu_ecl_adderin2_31_e;
62
 
63
   wire [63:0]  rs2_data;       // 2nd input to adder
64
   wire [63:0]  rs1_data;       // 1st input to adder
65
   wire [63:0]  subtract_d;
66
   wire [63:0]  subtract_e;
67
   wire         cout64_e;
68
 
69
////////////////////////////////////////////
70
//  Module implementation
71
////////////////////////////////////////////
72
   assign       subtract_d[63:0] = {64{ifu_exu_invert_d}};
73 113 albert.wat
   dff_s #(64) sub_dff(.din(subtract_d[63:0]), .clk(clk), .q(subtract_e[63:0]), .se(se),
74
                     `SIMPLY_RISC_SCANIN, .so());
75 95 fafa1971
 
76
   assign       rs1_data[63:0] = byp_alu_rs1_data_e[63:0];
77
 
78
   assign       rs2_data[63:0] = byp_alu_rs2_data_e[63:0] ^ subtract_e[63:0];
79
 
80
   assign      alu_ecl_adderin2_63_e = rs2_data[63];
81
   assign      alu_ecl_adderin2_31_e = rs2_data[31];
82
   sparc_exu_aluadder64 adder(.rs1_data(rs1_data[63:0]), .rs2_data(rs2_data[63:0]),
83
                              .cin(ecl_alu_cin_e), .adder_out(adder_out[63:0]),
84
                              .cout32(alu_ecl_cout32_e), .cout64(cout64_e));
85
   assign      alu_ecl_cout64_e_l = ~cout64_e;
86
 
87
 
88
   // sum predict
89
   sparc_exu_aluspr spr(.rs1_data(rs1_data[63:0]), .rs2_data(rs2_data[63:0]), .cin(ecl_alu_cin_e),
90
                        .spr_out(spr_out[63:0]));
91
 
92
endmodule // sparc_exu_aluaddsub
93
 
94
 
95
 
96
 

powered by: WebSVN 2.1.0

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