[6] | 1 | // ========== Copyright Header Begin ========================================== |
---|
| 2 | // |
---|
| 3 | // OpenSPARC T1 Processor File: sparc_ffu_vis.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_vis |
---|
| 24 | // Description: This is the ffu VIS blk. |
---|
| 25 | // It implements FALIGN, partitioned add and logicals. |
---|
| 26 | */ |
---|
| 27 | |
---|
| 28 | module sparc_ffu_vis(/*AUTOARG*/ |
---|
| 29 | // Outputs |
---|
| 30 | vis_dp_rd_data, |
---|
| 31 | // Inputs |
---|
| 32 | dp_vis_rs1_data, dp_vis_rs2_data, ctl_vis_sel_add, |
---|
| 33 | ctl_vis_sel_log, ctl_vis_sel_align, ctl_vis_add32, |
---|
| 34 | ctl_vis_subtract, ctl_vis_cin, ctl_vis_align0, ctl_vis_align2, |
---|
| 35 | ctl_vis_align4, ctl_vis_align6, ctl_vis_align_odd, |
---|
| 36 | ctl_vis_log_sel_pass, ctl_vis_log_sel_nand, ctl_vis_log_sel_nor, |
---|
| 37 | ctl_vis_log_sel_xor, ctl_vis_log_invert_rs1, |
---|
| 38 | ctl_vis_log_invert_rs2, ctl_vis_log_constant, |
---|
| 39 | ctl_vis_log_pass_const, ctl_vis_log_pass_rs1, |
---|
| 40 | ctl_vis_log_pass_rs2 |
---|
| 41 | ); |
---|
| 42 | |
---|
| 43 | input [63:0] dp_vis_rs1_data; |
---|
| 44 | input [63:0] dp_vis_rs2_data; |
---|
| 45 | input ctl_vis_sel_add; |
---|
| 46 | input ctl_vis_sel_log; |
---|
| 47 | input ctl_vis_sel_align; |
---|
| 48 | input ctl_vis_add32; |
---|
| 49 | input ctl_vis_subtract; |
---|
| 50 | input ctl_vis_cin; |
---|
| 51 | input ctl_vis_align0; |
---|
| 52 | input ctl_vis_align2; |
---|
| 53 | input ctl_vis_align4; |
---|
| 54 | input ctl_vis_align6; |
---|
| 55 | input ctl_vis_align_odd; |
---|
| 56 | input ctl_vis_log_sel_pass; |
---|
| 57 | input ctl_vis_log_sel_nand; |
---|
| 58 | input ctl_vis_log_sel_nor; |
---|
| 59 | input ctl_vis_log_sel_xor; |
---|
| 60 | input ctl_vis_log_invert_rs1; |
---|
| 61 | input ctl_vis_log_invert_rs2; |
---|
| 62 | input ctl_vis_log_constant; |
---|
| 63 | input ctl_vis_log_pass_const; |
---|
| 64 | input ctl_vis_log_pass_rs1; |
---|
| 65 | input ctl_vis_log_pass_rs2; |
---|
| 66 | |
---|
| 67 | output [63:0] vis_dp_rd_data; |
---|
| 68 | |
---|
| 69 | wire [71:0] align_data1; |
---|
| 70 | wire [63:0] align_rs1; |
---|
| 71 | wire [63:8] align_rs2; |
---|
| 72 | |
---|
| 73 | wire [63:0] add_out; |
---|
| 74 | wire [63:0] log_out; |
---|
| 75 | wire [63:0] align_out; |
---|
| 76 | wire [63:0] add_in_rs1; |
---|
| 77 | wire [63:0] add_in_rs2; |
---|
| 78 | |
---|
| 79 | wire [63:0] logic_nor; |
---|
| 80 | wire [63:0] logic_pass; |
---|
| 81 | wire [63:0] logic_xor; |
---|
| 82 | wire [63:0] logic_nand; |
---|
| 83 | wire [63:0] logic_rs1; |
---|
| 84 | wire [63:0] logic_rs2; |
---|
| 85 | |
---|
| 86 | ///////////////////////////////////////////////////////////////// |
---|
| 87 | // Logic for partitioned addition. |
---|
| 88 | //---------------------------------- |
---|
| 89 | // RS1 is normal RS1 data, RS2 is inverted by subtraction signal. |
---|
| 90 | ///////////////////////////////////////////////////////////////// |
---|
| 91 | assign add_in_rs1[63:0] = dp_vis_rs1_data[63:0]; |
---|
| 92 | assign add_in_rs2[63:0] = dp_vis_rs2_data[63:0] ^ {64{ctl_vis_subtract}}; |
---|
| 93 | sparc_ffu_part_add32 part_adder_hi(.z(add_out[63:32]), |
---|
| 94 | .add32(ctl_vis_add32), |
---|
| 95 | .a(add_in_rs1[63:32]), |
---|
| 96 | .b(add_in_rs2[63:32]), |
---|
| 97 | .cin(ctl_vis_cin)); |
---|
| 98 | sparc_ffu_part_add32 part_adder_lo(.z(add_out[31:0]), |
---|
| 99 | .add32(ctl_vis_add32), |
---|
| 100 | .a(add_in_rs1[31:0]), |
---|
| 101 | .b(add_in_rs2[31:0]), |
---|
| 102 | .cin(ctl_vis_cin)); |
---|
| 103 | |
---|
| 104 | /////////////////////////////////////////////////////////////////////////// |
---|
| 105 | // Datapath for FALIGNDATA |
---|
| 106 | //--------------------------------------------------------------- |
---|
| 107 | // FALIGNDATA concatenates rs1 and rs2 and shifts them by byte to create |
---|
| 108 | // an 8 byte value. The first mux creates a 72 bit value and the |
---|
| 109 | // 2nd mux picks 64 bits out of these for the output. |
---|
| 110 | /////////////////////////////////////////////////////////////////////////// |
---|
| 111 | dp_buffer #(64) align_rs1_buf(.dout(align_rs1[63:0]), .in(dp_vis_rs1_data[63:0])); |
---|
| 112 | dp_buffer #(56) align_rs2_buf(.dout(align_rs2[63:8]), .in(dp_vis_rs2_data[63:8])); |
---|
| 113 | mux4ds #(72) falign_mux1(.dout(align_data1[71:0]), |
---|
| 114 | .in0({align_rs1[63:0], align_rs2[63:56]}), |
---|
| 115 | .in1({align_rs1[47:0], align_rs2[63:40]}), |
---|
| 116 | .in2({align_rs1[31:0], align_rs2[63:24]}), |
---|
| 117 | .in3({align_rs1[15:0], align_rs2[63:8]}), |
---|
| 118 | .sel0(ctl_vis_align0), |
---|
| 119 | .sel1(ctl_vis_align2), |
---|
| 120 | .sel2(ctl_vis_align4), |
---|
| 121 | .sel3(ctl_vis_align6)); |
---|
| 122 | dp_mux2es #(64) falign_mux2(.dout(align_out[63:0]), |
---|
| 123 | .in0(align_data1[71:8]), |
---|
| 124 | .in1(align_data1[63:0]), |
---|
| 125 | .sel(ctl_vis_align_odd)); |
---|
| 126 | |
---|
| 127 | /////////////////////////////////////////////////////////////////////////// |
---|
| 128 | // Datapath for VIS logicals |
---|
| 129 | //----------------------------------------------------------------------- |
---|
| 130 | // VIS logicals perform 3 fundamental ops: NAND, NOR and XOR plus inverted |
---|
| 131 | // versions of the inputs to create the other versions. These 3 outputs are |
---|
| 132 | // muxed with a choice of 1, 0, rs1 or rs2. |
---|
| 133 | /////////////////////////////////////////////////////////////////////////// |
---|
| 134 | |
---|
| 135 | // create inverted versions of data if desired |
---|
| 136 | assign logic_rs1[63:0] = dp_vis_rs1_data[63:0] ^ {64{ctl_vis_log_invert_rs1}}; |
---|
| 137 | assign logic_rs2[63:0] = dp_vis_rs2_data[63:0] ^ {64{ctl_vis_log_invert_rs2}}; |
---|
| 138 | |
---|
| 139 | // 3 basic logical operations |
---|
| 140 | assign logic_nor[63:0] = ~(logic_rs1[63:0] | logic_rs2[63:0]); |
---|
| 141 | assign logic_nand[63:0] = ~(logic_rs1[63:0] & logic_rs2[63:0]); |
---|
| 142 | assign logic_xor[63:0] = (logic_rs1[63:0] ^ logic_rs2[63:0]); |
---|
| 143 | |
---|
| 144 | // mux for pass through data |
---|
| 145 | mux3ds #(64) pass_mux(.dout(logic_pass[63:0]), |
---|
| 146 | .in0({64{ctl_vis_log_constant}}), |
---|
| 147 | .in1(logic_rs1[63:0]), |
---|
| 148 | .in2(logic_rs2[63:0]), |
---|
| 149 | .sel0(ctl_vis_log_pass_const), |
---|
| 150 | .sel1(ctl_vis_log_pass_rs1), |
---|
| 151 | .sel2(ctl_vis_log_pass_rs2)); |
---|
| 152 | |
---|
| 153 | // pick between logic outputs |
---|
| 154 | mux4ds #(64) logic_mux(.dout(log_out[63:0]), |
---|
| 155 | .in0(logic_nor[63:0]), |
---|
| 156 | .in1(logic_nand[63:0]), |
---|
| 157 | .in2(logic_xor[63:0]), |
---|
| 158 | .in3(logic_pass[63:0]), |
---|
| 159 | .sel0(ctl_vis_log_sel_nor), |
---|
| 160 | .sel1(ctl_vis_log_sel_nand), |
---|
| 161 | .sel2(ctl_vis_log_sel_xor), |
---|
| 162 | .sel3(ctl_vis_log_sel_pass)); |
---|
| 163 | |
---|
| 164 | |
---|
| 165 | |
---|
| 166 | ////////////////////////////////////////////////////////// |
---|
| 167 | // output mux |
---|
| 168 | ////////////////////////////////////////////////////////// |
---|
| 169 | mux3ds #(64) output_mux(.dout(vis_dp_rd_data[63:0]), |
---|
| 170 | .in0(add_out[63:0]), |
---|
| 171 | .in1(log_out[63:0]), |
---|
| 172 | .in2(align_out[63:0]), |
---|
| 173 | .sel0(ctl_vis_sel_add), |
---|
| 174 | .sel1(ctl_vis_sel_log), |
---|
| 175 | .sel2(ctl_vis_sel_align)); |
---|
| 176 | |
---|
| 177 | endmodule // sparc_ffu_vis |
---|