[6] | 1 | // ========== Copyright Header Begin ========================================== |
---|
| 2 | // |
---|
| 3 | // OpenSPARC T1 Processor File: bw_r_frf.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: bw_r_frf |
---|
| 24 | // Description: This is the floating point register file. It has one R/W port that is |
---|
| 25 | // 78 bits (64 bits data, 14 bits ecc) wide. |
---|
| 26 | */ |
---|
| 27 | |
---|
| 28 | //FPGA_SYN enables all FPGA related modifications |
---|
| 29 | `ifdef FPGA_SYN |
---|
| 30 | `define FPGA_SYN_FRF |
---|
| 31 | `endif |
---|
| 32 | |
---|
| 33 | module bw_r_frf (/*AUTOARG*/ |
---|
| 34 | // Outputs |
---|
| 35 | so, frf_dp_data, |
---|
| 36 | // Inputs |
---|
| 37 | rclk, si, se, sehold, rst_tri_en, ctl_frf_wen, ctl_frf_ren, |
---|
| 38 | dp_frf_data, ctl_frf_addr |
---|
| 39 | ) ; |
---|
| 40 | input rclk; |
---|
| 41 | input si; |
---|
| 42 | input se; |
---|
| 43 | input sehold; |
---|
| 44 | input rst_tri_en; |
---|
| 45 | input [1:0] ctl_frf_wen; |
---|
| 46 | input ctl_frf_ren; |
---|
| 47 | input [77:0] dp_frf_data; |
---|
| 48 | input [6:0] ctl_frf_addr; |
---|
| 49 | |
---|
| 50 | output so; |
---|
| 51 | output [77:0] frf_dp_data; |
---|
| 52 | |
---|
| 53 | wire [7:0] regfile_index; |
---|
| 54 | //XST WA CR436004 |
---|
| 55 | (* keep = "yes" *) wire [7:0] regfile_index_low; |
---|
| 56 | (* keep = "yes" *) wire [7:0] regfile_index_high; |
---|
| 57 | // |
---|
| 58 | |
---|
| 59 | `ifdef FPGA_SYN_FRF |
---|
| 60 | reg [38:0] regfile_high [127:0]; |
---|
| 61 | reg [38:0] regfile_low [127:0]; |
---|
| 62 | `else |
---|
| 63 | reg [38:0] regfile [255:0]; |
---|
| 64 | `endif |
---|
| 65 | |
---|
| 66 | reg rst_tri_en_negedge; |
---|
| 67 | wire [77:0] read_data; |
---|
| 68 | wire ren_d1; |
---|
| 69 | wire [6:0] addr_d1; |
---|
| 70 | wire [1:0] wen_d1; |
---|
| 71 | wire [77:0] write_data_d1; |
---|
| 72 | wire [77:0] sehold_write_data; |
---|
| 73 | wire [9:0] sehold_cntl_data; |
---|
| 74 | |
---|
| 75 | wire [9:0] cntl_scan_data; |
---|
| 76 | wire [38:0] write_scan_data_hi; |
---|
| 77 | wire [38:0] write_scan_data_lo; |
---|
| 78 | wire [38:0] read_scan_data_hi; |
---|
| 79 | wire [38:0] read_scan_data_lo; |
---|
| 80 | |
---|
| 81 | wire real_se; |
---|
| 82 | assign real_se = se & ~sehold; |
---|
| 83 | |
---|
| 84 | // This is for sas comparisons |
---|
| 85 | assign regfile_index[7:0] = {ctl_frf_addr[6:0], 1'b0}; |
---|
| 86 | |
---|
| 87 | assign regfile_index_low[7:0] = {addr_d1[6:0], 1'b0}; |
---|
| 88 | assign regfile_index_high[7:0] = {addr_d1[6:0], 1'b1}; |
---|
| 89 | |
---|
| 90 | assign sehold_write_data[77:0] = (sehold)? write_data_d1[77:0]: dp_frf_data[77:0]; |
---|
| 91 | assign sehold_cntl_data[9:0] = (sehold)? {addr_d1[6:0],wen_d1[1:0], ren_d1}: |
---|
| 92 | {ctl_frf_addr[6:0],ctl_frf_wen[1:0],ctl_frf_ren}; |
---|
| 93 | // All inputs go through flop |
---|
| 94 | dff_s #(39) datain_dff1(.din(sehold_write_data[77:39]), .clk(rclk), .q(write_data_d1[77:39]), |
---|
| 95 | .se(real_se), .si({cntl_scan_data[0],write_scan_data_lo[38:1]}), |
---|
| 96 | .so(write_scan_data_hi[38:0])); |
---|
| 97 | dff_s #(39) datain_dff2(.din(sehold_write_data[38:0]), .clk(rclk), .q(write_data_d1[38:0]), |
---|
| 98 | .se(real_se), .si(write_scan_data_hi[38:0]), .so(write_scan_data_lo[38:0])); |
---|
| 99 | dff_s #(10) controlin_dff(.din(sehold_cntl_data[9:0]), |
---|
| 100 | .q({addr_d1[6:0],wen_d1[1:0],ren_d1}), |
---|
| 101 | .clk(rclk), .se(real_se), .si({si,cntl_scan_data[9:1]}), .so(cntl_scan_data[9:0])); |
---|
| 102 | |
---|
| 103 | // Read logic |
---|
| 104 | `ifdef FPGA_SYN_FRF |
---|
| 105 | assign read_data[77:0] = (~ren_d1)? 78'b0: |
---|
| 106 | (wen_d1[1]|wen_d1[0])? {78{1'bx}}: |
---|
| 107 | {regfile_high[regfile_index_high[7:1]],regfile_low[regfile_index_low[7:1]]}; |
---|
| 108 | `else |
---|
| 109 | assign read_data[77:0] = (~ren_d1)? 78'b0: |
---|
| 110 | (wen_d1[1]|wen_d1[0])? {78{1'bx}}: |
---|
| 111 | {regfile[regfile_index_high],regfile[regfile_index_low]}; |
---|
| 112 | `endif |
---|
| 113 | |
---|
| 114 | |
---|
| 115 | dff_s #(39) dataout_dff1(.din(read_data[77:39]), .clk(rclk), .q(frf_dp_data[77:39]), |
---|
| 116 | .se(real_se), .si(read_scan_data_lo[38:0]), .so(read_scan_data_hi[38:0])); |
---|
| 117 | dff_s #(39) dataout_dff2(.din(read_data[38:0]), .clk(rclk), .q(frf_dp_data[38:0]), |
---|
| 118 | .se(real_se), .si({read_scan_data_hi[37:0],write_scan_data_lo[0]}), |
---|
| 119 | .so(read_scan_data_lo[38:0])); |
---|
| 120 | assign so = read_scan_data_hi[38]; |
---|
| 121 | |
---|
| 122 | always @ (posedge rclk) begin |
---|
| 123 | // Write port |
---|
| 124 | // write is gated by rst_tri_en |
---|
| 125 | `ifdef FPGA_SYN_FRF |
---|
| 126 | if (wen_d1[0] & ~ren_d1 & ~rst_tri_en_negedge) begin |
---|
| 127 | regfile_low[regfile_index_low[7:1]] <= write_data_d1[38:0]; |
---|
| 128 | end |
---|
| 129 | if (wen_d1[1] & ~ren_d1 & ~rst_tri_en_negedge) begin |
---|
| 130 | regfile_high[regfile_index_high[7:1]] <= write_data_d1[77:39]; |
---|
| 131 | end |
---|
| 132 | `else |
---|
| 133 | if (wen_d1[0] & ~ren_d1 & ~rst_tri_en_negedge) begin |
---|
| 134 | regfile[regfile_index_low] <= write_data_d1[38:0]; |
---|
| 135 | end |
---|
| 136 | if (wen_d1[1] & ~ren_d1 & ~rst_tri_en_negedge) begin |
---|
| 137 | regfile[regfile_index_high] <= write_data_d1[77:39]; |
---|
| 138 | end |
---|
| 139 | `endif |
---|
| 140 | end |
---|
| 141 | always @ (negedge rclk) begin |
---|
| 142 | // latch rst_tri_en |
---|
| 143 | rst_tri_en_negedge <= rst_tri_en; |
---|
| 144 | end |
---|
| 145 | |
---|
| 146 | endmodule // sparc_ffu_frf |
---|
| 147 | |
---|