source: XOpenSparcT1/trunk/T1-CPU/exu/sparc_exu_aluaddsub.v @ 6

Revision 6, 3.7 KB checked in by pntsvt00, 14 years ago (diff)

versione iniziale opensparc

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