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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [orpsocv2/] [rtl/] [verilog/] [or1200/] [or1200_wbmux.v] - Blame information for rev 746

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 350 julius
//////////////////////////////////////////////////////////////////////
2
////                                                              ////
3
////  OR1200's Write-back Mux                                     ////
4
////                                                              ////
5
////  This file is part of the OpenRISC 1200 project              ////
6
////  http://www.opencores.org/project,or1k                       ////
7
////                                                              ////
8
////  Description                                                 ////
9
////  CPU's write-back stage of the pipeline                      ////
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
//
45
// $Log: or1200_wbmux.v,v $
46
// Revision 2.0  2010/06/30 11:00:00  ORSoC
47
// No update 
48
 
49
// synopsys translate_off
50
`include "timescale.v"
51
// synopsys translate_on
52
`include "or1200_defines.v"
53
 
54
module or1200_wbmux(
55
        // Clock and reset
56
        clk, rst,
57
 
58
        // Internal i/f
59
        wb_freeze, rfwb_op,
60
        muxin_a, muxin_b, muxin_c, muxin_d, muxin_e,
61
        muxout, muxreg, muxreg_valid
62
);
63
 
64
parameter width = `OR1200_OPERAND_WIDTH;
65
 
66
//
67
// I/O
68
//
69
 
70
//
71
// Clock and reset
72
//
73
input                           clk;
74
input                           rst;
75
 
76
//
77
// Internal i/f
78
//
79
input                           wb_freeze;
80
input   [`OR1200_RFWBOP_WIDTH-1:0]       rfwb_op;
81
input   [width-1:0]              muxin_a;
82
input   [width-1:0]              muxin_b;
83
input   [width-1:0]              muxin_c;
84
input   [width-1:0]              muxin_d;
85
input   [width-1:0]              muxin_e;
86
output  [width-1:0]              muxout;
87
output  [width-1:0]              muxreg;
88
output                          muxreg_valid;
89
 
90
//
91
// Internal wires and regs
92
//
93
reg     [width-1:0]              muxout;
94
reg     [width-1:0]              muxreg;
95
reg                             muxreg_valid;
96
 
97
//
98
// Registered output from the write-back multiplexer
99
//
100 358 julius
always @(posedge clk or `OR1200_RST_EVENT rst) begin
101
        if (rst == `OR1200_RST_VALUE) begin
102 350 julius
                muxreg <=  32'd0;
103
                muxreg_valid <=  1'b0;
104
        end
105
        else if (!wb_freeze) begin
106
                muxreg <=  muxout;
107
                muxreg_valid <=  rfwb_op[0];
108
        end
109
end
110
 
111
//
112
// Write-back multiplexer
113
//
114
always @(muxin_a or muxin_b or muxin_c or muxin_d or muxin_e or rfwb_op) begin
115
`ifdef OR1200_ADDITIONAL_SYNOPSYS_DIRECTIVES
116 363 julius
        casez(rfwb_op[`OR1200_RFWBOP_WIDTH-1:1]) // synopsys parallel_case infer_mux
117 350 julius
`else
118 363 julius
        casez(rfwb_op[`OR1200_RFWBOP_WIDTH-1:1]) // synopsys parallel_case
119 350 julius
`endif
120
                `OR1200_RFWBOP_ALU: muxout = muxin_a;
121
                `OR1200_RFWBOP_LSU: begin
122
                        muxout = muxin_b;
123
`ifdef OR1200_VERBOSE
124
// synopsys translate_off
125
                        $display("  WBMUX: muxin_b %h", muxin_b);
126
// synopsys translate_on
127
`endif
128
                end
129
                `OR1200_RFWBOP_SPRS: begin
130
                        muxout = muxin_c;
131
`ifdef OR1200_VERBOSE
132
// synopsys translate_off
133
                        $display("  WBMUX: muxin_c %h", muxin_c);
134
// synopsys translate_on
135
`endif
136
                end
137
                `OR1200_RFWBOP_LR: begin
138
                        muxout = muxin_d + 32'h8;
139
`ifdef OR1200_VERBOSE
140
// synopsys translate_off
141
                        $display("  WBMUX: muxin_d %h", muxin_d + 4'h8);
142
// synopsys translate_on
143
`endif
144
                end
145
`ifdef OR1200_FPU_IMPLEMENTED
146
                `OR1200_RFWBOP_FPU : begin
147
             muxout = muxin_e;
148
 `ifdef OR1200_VERBOSE
149
// synopsys translate_off
150
                        $display("  WBMUX: muxin_e %h", muxin_e);
151
// synopsys translate_on
152
`endif
153
               end
154 363 julius
`endif
155
          default : begin
156
             muxout = 0;
157
          end
158
 
159 350 julius
        endcase
160
end
161
 
162
endmodule

powered by: WebSVN 2.1.0

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