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

Subversion Repositories or1200_hp

[/] [or1200_hp/] [trunk/] [rtl/] [rtl_cm2/] [verilog/] [or1200_operandmuxes.v] - Blame information for rev 2

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 2 tobil
//////////////////////////////////////////////////////////////////////
2
////                                                              ////
3
////  OR1200's register file read operands mux                    ////
4
////                                                              ////
5
////  This file is part of the OpenRISC 1200 project              ////
6
////  http://www.opencores.org/cores/or1k/                        ////
7
////                                                              ////
8
////  Description                                                 ////
9
////  Mux for two register file read operands.                    ////
10
////                                                              ////
11
////  To Do:                                                      ////
12
////   - make it smaller and faster                               ////
13
////                                                              ////
14
////  Author(s):                                                  ////
15
////      - Damjan Lampret, lampret@opencores.org                 ////
16
////                                                              ////
17
//////////////////////////////////////////////////////////////////////
18
////                                                              ////
19
//// Copyright (C) 2000 Authors and OPENCORES.ORG                 ////
20
////                                                              ////
21
//// This source file may be used and distributed without         ////
22
//// restriction provided that this copyright statement is not    ////
23
//// removed from the file and that any derivative work contains  ////
24
//// the original copyright notice and the associated disclaimer. ////
25
////                                                              ////
26
//// This source file is free software; you can redistribute it   ////
27
//// and/or modify it under the terms of the GNU Lesser General   ////
28
//// Public License as published by the Free Software Foundation; ////
29
//// either version 2.1 of the License, or (at your option) any   ////
30
//// later version.                                               ////
31
////                                                              ////
32
//// This source is distributed in the hope that it will be       ////
33
//// useful, but WITHOUT ANY WARRANTY; without even the implied   ////
34
//// warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR      ////
35
//// PURPOSE.  See the GNU Lesser General Public License for more ////
36
//// details.                                                     ////
37
////                                                              ////
38
//// You should have received a copy of the GNU Lesser General    ////
39
//// Public License along with this source; if not, download it   ////
40
//// from http://www.opencores.org/lgpl.shtml                     ////
41
////                                                              ////
42
//////////////////////////////////////////////////////////////////////
43
//
44
// CVS Revision History
45
//
46
// $Log: not supported by cvs2svn $
47
// Revision 1.1  2002/01/03 08:16:15  lampret
48
// New prefixes for RTL files, prefixed module names. Updated cache controllers and MMUs.
49
//
50
// Revision 1.9  2001/11/12 01:45:40  lampret
51
// Moved flag bit into SR. Changed RF enable from constant enable to dynamic enable for read ports.
52
//
53
// Revision 1.8  2001/10/21 17:57:16  lampret
54
// Removed params from generic_XX.v. Added translate_off/on in sprs.v and id.v. Removed spr_addr from dc.v and ic.v. Fixed CR+LF.
55
//
56
// Revision 1.7  2001/10/14 13:12:09  lampret
57
// MP3 version.
58
//
59
// Revision 1.1.1.1  2001/10/06 10:18:36  igorm
60
// no message
61
//
62
// Revision 1.2  2001/08/09 13:39:33  lampret
63
// Major clean-up.
64
//
65
// Revision 1.1  2001/07/20 00:46:05  lampret
66
// Development version of RTL. Libraries are missing.
67
//
68
//
69
 
70
// synopsys translate_off
71
`include "timescale.v"
72
// synopsys translate_on
73
`include "or1200_defines.v"
74
 
75
module or1200_operandmuxes_cm2(
76
                clk_i_cml_1,
77
 
78
        // Clock and reset
79
        clk, rst,
80
 
81
        // Internal i/f
82
        id_freeze, ex_freeze, rf_dataa, rf_datab, ex_forw, wb_forw,
83
        simm, sel_a, sel_b, operand_a, operand_b, muxed_b
84
);
85
 
86
 
87
input clk_i_cml_1;
88
reg [ 32 - 1 : 0 ] wb_forw_cml_1;
89
reg [ 32 - 1 : 0 ] operand_a_cml_1;
90
reg [ 32 - 1 : 0 ] operand_b_cml_1;
91
reg  saved_a_cml_1;
92
reg  saved_b_cml_1;
93
 
94
 
95
 
96
parameter width = `OR1200_OPERAND_WIDTH;
97
 
98
//
99
// I/O
100
//
101
input                           clk;
102
input                           rst;
103
input                           id_freeze;
104
input                           ex_freeze;
105
input   [width-1:0]              rf_dataa;
106
input   [width-1:0]              rf_datab;
107
input   [width-1:0]              ex_forw;
108
input   [width-1:0]              wb_forw;
109
input   [width-1:0]              simm;
110
input   [`OR1200_SEL_WIDTH-1:0]  sel_a;
111
input   [`OR1200_SEL_WIDTH-1:0]  sel_b;
112
output  [width-1:0]              operand_a;
113
output  [width-1:0]              operand_b;
114
output  [width-1:0]              muxed_b;
115
 
116
//
117
// Internal wires and regs
118
//
119
reg     [width-1:0]              operand_a;
120
reg     [width-1:0]              operand_b;
121
reg     [width-1:0]              muxed_a;
122
reg     [width-1:0]              muxed_b;
123
reg                             saved_a;
124
reg                             saved_b;
125
 
126
//
127
// Operand A register
128
//
129
 
130
// SynEDA CoreMultiplier
131
// assignment(s): operand_a, saved_a
132
// replace(s): operand_a, saved_a
133
always @(posedge clk or posedge rst) begin
134
        if (rst) begin
135
                operand_a <= #1 32'd0;
136
                saved_a <= #1 1'b0;
137
        end else begin  saved_a <= saved_a_cml_1; operand_a <= operand_a_cml_1; if (!ex_freeze && id_freeze && !saved_a_cml_1) begin
138
                operand_a <= #1 muxed_a;
139
                saved_a <= #1 1'b1;
140
        end else if (!ex_freeze && !saved_a_cml_1) begin
141
                operand_a <= #1 muxed_a;
142
        end else if (!ex_freeze && !id_freeze)
143
                saved_a <= #1 1'b0; end
144
end
145
 
146
//
147
// Operand B register
148
//
149
 
150
// SynEDA CoreMultiplier
151
// assignment(s): operand_b, saved_b
152
// replace(s): operand_b, saved_b
153
always @(posedge clk or posedge rst) begin
154
        if (rst) begin
155
                operand_b <= #1 32'd0;
156
                saved_b <= #1 1'b0;
157
        end else begin  saved_b <= saved_b_cml_1; operand_b <= operand_b_cml_1; if (!ex_freeze && id_freeze && !saved_b_cml_1) begin
158
                operand_b <= #1 muxed_b;
159
                saved_b <= #1 1'b1;
160
        end else if (!ex_freeze && !saved_b_cml_1) begin
161
                operand_b <= #1 muxed_b;
162
        end else if (!ex_freeze && !id_freeze)
163
                saved_b <= #1 1'b0; end
164
end
165
 
166
//
167
// Forwarding logic for operand A register
168
//
169
 
170
// SynEDA CoreMultiplier
171
// assignment(s): muxed_a
172
// replace(s): wb_forw
173
always @(ex_forw or wb_forw_cml_1 or rf_dataa or sel_a) begin
174
`ifdef OR1200_ADDITIONAL_SYNOPSYS_DIRECTIVES
175
        casex (sel_a)   // synopsys parallel_case infer_mux
176
`else
177
        casex (sel_a)   // synopsys parallel_case
178
`endif
179
                `OR1200_SEL_EX_FORW:
180
                        muxed_a = ex_forw;
181
                `OR1200_SEL_WB_FORW:
182
                        muxed_a = wb_forw_cml_1;
183
                default:
184
                        muxed_a = rf_dataa;
185
        endcase
186
end
187
 
188
//
189
// Forwarding logic for operand B register
190
//
191
 
192
// SynEDA CoreMultiplier
193
// assignment(s): muxed_b
194
// replace(s): wb_forw
195
always @(simm or ex_forw or wb_forw_cml_1 or rf_datab or sel_b) begin
196
`ifdef OR1200_ADDITIONAL_SYNOPSYS_DIRECTIVES
197
        casex (sel_b)   // synopsys parallel_case infer_mux
198
`else
199
        casex (sel_b)   // synopsys parallel_case
200
`endif
201
                `OR1200_SEL_IMM:
202
                        muxed_b = simm;
203
                `OR1200_SEL_EX_FORW:
204
                        muxed_b = ex_forw;
205
                `OR1200_SEL_WB_FORW:
206
                        muxed_b = wb_forw_cml_1;
207
                default:
208
                        muxed_b = rf_datab;
209
        endcase
210
end
211
 
212
 
213
always @ (posedge clk_i_cml_1) begin
214
wb_forw_cml_1 <= wb_forw;
215
operand_a_cml_1 <= operand_a;
216
operand_b_cml_1 <= operand_b;
217
saved_a_cml_1 <= saved_a;
218
saved_b_cml_1 <= saved_b;
219
end
220
endmodule
221
 

powered by: WebSVN 2.1.0

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