[6] | 1 | // ========== Copyright Header Begin ========================================== |
---|
| 2 | // |
---|
| 3 | // OpenSPARC T1 Processor File: sparc_ffu_part_add32.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_ffu_part_add32 |
---|
| 24 | // Description: This is the ffu VIS adder. It can do either |
---|
| 25 | // 2 16 bit adds or 1 32 bit add. |
---|
| 26 | */ |
---|
| 27 | module sparc_ffu_part_add32 (/*AUTOARG*/ |
---|
| 28 | // Outputs |
---|
| 29 | z, |
---|
| 30 | // Inputs |
---|
| 31 | a, b, cin, add32 |
---|
| 32 | ) ; |
---|
| 33 | input [31:0] a; |
---|
| 34 | input [31:0] b; |
---|
| 35 | input cin; |
---|
| 36 | input add32; |
---|
| 37 | |
---|
| 38 | output [31:0] z; |
---|
| 39 | |
---|
| 40 | wire cout15; // carry out from lower 16 bit add |
---|
| 41 | wire cin16; // carry in to the upper 16 bit add |
---|
| 42 | |
---|
| 43 | assign cin16 = (add32)? cout15: cin; |
---|
| 44 | |
---|
| 45 | assign {cout15, z[15:0]} = a[15:0]+b[15:0]+{15'b0,cin}; |
---|
| 46 | assign z[31:16] = a[31:16]+b[31:16]+{15'b0,cin16}; |
---|
| 47 | |
---|
| 48 | endmodule // sparc_ffu_part_add32 |
---|