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

Subversion Repositories s1_core

[/] [s1_core/] [trunk/] [hdl/] [rtl/] [sparc_core/] [sparc_exu_reg.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_reg.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
module sparc_exu_reg (/*AUTOARG*/
27
   // Outputs
28
   data_out,
29
   // Inputs
30
   clk, se, thr_out, wen_w, thr_w, data_in_w
31
   ) ;
32
   parameter SIZE = 3;
33
 
34
   input     clk;
35
   input     se;
36
   input [3:0]       thr_out;
37
   input             wen_w;
38
   input [3:0]       thr_w;
39
   input [SIZE -1:0] data_in_w;
40
 
41
   output [SIZE-1:0] data_out;
42
 
43
   wire [SIZE-1:0]   data_thr0;
44
   wire [SIZE-1:0]   data_thr1;
45
   wire [SIZE-1:0]   data_thr2;
46
   wire [SIZE-1:0]   data_thr3;
47
   wire [SIZE-1:0]   data_thr0_next;
48
   wire [SIZE-1:0]   data_thr1_next;
49
   wire [SIZE-1:0]   data_thr2_next;
50
   wire [SIZE-1:0]   data_thr3_next;
51
 
52
   wire          wen_thr0_w;
53
   wire          wen_thr1_w;
54
   wire          wen_thr2_w;
55
   wire          wen_thr3_w;
56
 
57
   //////////////////////////////////
58
   //  Output selection for reg
59
   //////////////////////////////////
60 113 albert.wat
`ifdef FPGA_SYN_1THREAD
61
   assign        data_out[SIZE -1:0] = data_thr0[SIZE -1:0];
62
   assign        wen_thr0_w = (thr_w[0] & wen_w);
63
   // mux between new and current value
64
   mux2ds #(SIZE) data_next0_mux(.dout(data_thr0_next[SIZE -1:0]),
65
                               .in0(data_thr0[SIZE -1:0]),
66
                               .in1(data_in_w[SIZE -1:0]),
67
                               .sel0(~wen_thr0_w),
68
                               .sel1(wen_thr0_w));
69
   dff_s #(SIZE) dff_reg_thr0(.din(data_thr0_next[SIZE -1:0]), .clk(clk), .q(data_thr0[SIZE -1:0]),
70
                       .se(se), `SIMPLY_RISC_SCANIN, .so());
71
`else // !`ifdef FPGA_SYN_1THREAD
72 95 fafa1971
 
73
   // mux between the 4 regs
74
   mux4ds #(SIZE) mux_data_out1(.dout(data_out[SIZE -1:0]), .sel0(thr_out[0]),
75
                               .sel1(thr_out[1]), .sel2(thr_out[2]),
76
                               .sel3(thr_out[3]), .in0(data_thr0[SIZE -1:0]),
77
                               .in1(data_thr1[SIZE -1:0]), .in2(data_thr2[SIZE -1:0]),
78
                               .in3(data_thr3[SIZE -1:0]));
79
 
80
   //////////////////////////////////////
81
   //  Storage of reg
82
   //////////////////////////////////////
83
   // enable input for each thread
84
   assign        wen_thr0_w = (thr_w[0] & wen_w);
85
   assign        wen_thr1_w = (thr_w[1] & wen_w);
86
   assign        wen_thr2_w = (thr_w[2] & wen_w);
87
   assign        wen_thr3_w = (thr_w[3] & wen_w);
88
 
89
   // mux between new and current value
90
   mux2ds #(SIZE) data_next0_mux(.dout(data_thr0_next[SIZE -1:0]),
91
                               .in0(data_thr0[SIZE -1:0]),
92
                               .in1(data_in_w[SIZE -1:0]),
93
                               .sel0(~wen_thr0_w),
94
                               .sel1(wen_thr0_w));
95
   mux2ds #(SIZE) data_next1_mux(.dout(data_thr1_next[SIZE -1:0]),
96
                               .in0(data_thr1[SIZE -1:0]),
97
                               .in1(data_in_w[SIZE -1:0]),
98
                               .sel0(~wen_thr1_w),
99
                               .sel1(wen_thr1_w));
100
   mux2ds #(SIZE) data_next2_mux(.dout(data_thr2_next[SIZE -1:0]),
101
                               .in0(data_thr2[SIZE -1:0]),
102
                               .in1(data_in_w[SIZE -1:0]),
103
                               .sel0(~wen_thr2_w),
104
                               .sel1(wen_thr2_w));
105
   mux2ds #(SIZE) data_next3_mux(.dout(data_thr3_next[SIZE -1:0]),
106
                               .in0(data_thr3[SIZE -1:0]),
107
                               .in1(data_in_w[SIZE -1:0]),
108
                               .sel0(~wen_thr3_w),
109
                               .sel1(wen_thr3_w));
110
 
111
   // store new value
112 113 albert.wat
   dff_s #(SIZE) dff_reg_thr0(.din(data_thr0_next[SIZE -1:0]), .clk(clk), .q(data_thr0[SIZE -1:0]),
113
                       .se(se), `SIMPLY_RISC_SCANIN, .so());
114
   dff_s #(SIZE) dff_reg_thr1(.din(data_thr1_next[SIZE -1:0]), .clk(clk), .q(data_thr1[SIZE -1:0]),
115
                       .se(se), `SIMPLY_RISC_SCANIN, .so());
116
   dff_s #(SIZE) dff_reg_thr2(.din(data_thr2_next[SIZE -1:0]), .clk(clk), .q(data_thr2[SIZE -1:0]),
117
                       .se(se), `SIMPLY_RISC_SCANIN, .so());
118
   dff_s #(SIZE) dff_reg_thr3(.din(data_thr3_next[SIZE -1:0]), .clk(clk), .q(data_thr3[SIZE -1:0]),
119
                       .se(se), `SIMPLY_RISC_SCANIN, .so());
120
`endif // !`ifdef FPGA_SYN_1THREAD
121 95 fafa1971
 
122
endmodule // sparc_exu_reg

powered by: WebSVN 2.1.0

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