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

Subversion Repositories openriscdevboard

[/] [openriscdevboard/] [trunk/] [cyc2-openrisc/] [rtl/] [or1200/] [or1200_pm.v] - Blame information for rev 3

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 2 sfielding
//////////////////////////////////////////////////////////////////////
2
////                                                              ////
3
////  OR1200's Power Management                                   ////
4
////                                                              ////
5
////  This file is part of the OpenRISC 1200 project              ////
6
////  http://www.opencores.org/cores/or1k/                        ////
7
////                                                              ////
8
////  Description                                                 ////
9
////  PM according to OR1K architectural specification.           ////
10
////                                                              ////
11
////  To Do:                                                      ////
12
////   - add support for dynamic clock gating                     ////
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  2006/12/21 16:46:58  vak
48
// Initial revision imported from
49
// http://www.opencores.org/cvsget.cgi/or1k/orp/orp_soc/rtl/verilog.
50
//
51
// Revision 1.1  2002/01/03 08:16:15  lampret
52
// New prefixes for RTL files, prefixed module names. Updated cache controllers and MMUs.
53
//
54
// Revision 1.8  2001/10/21 17:57:16  lampret
55
// 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.
56
//
57
// Revision 1.7  2001/10/14 13:12:10  lampret
58
// MP3 version.
59
//
60
// Revision 1.1.1.1  2001/10/06 10:18:35  igorm
61
// no message
62
//
63
// Revision 1.2  2001/08/09 13:39:33  lampret
64
// Major clean-up.
65
//
66
// Revision 1.1  2001/07/20 00:46:21  lampret
67
// Development version of RTL. Libraries are missing.
68
//
69
//
70
 
71
// synopsys translate_off
72
`include "timescale.v"
73
// synopsys translate_on
74
`include "or1200_defines.v"
75
 
76
module or1200_pm(
77
        // RISC Internal Interface
78
        clk, rst, pic_wakeup, spr_write, spr_addr, spr_dat_i, spr_dat_o,
79
 
80
        // Power Management Interface
81
        pm_clksd, pm_cpustall, pm_dc_gate, pm_ic_gate, pm_dmmu_gate,
82
        pm_immu_gate, pm_tt_gate, pm_cpu_gate, pm_wakeup, pm_lvolt
83
);
84
 
85
//
86
// RISC Internal Interface
87
//
88
input           clk;            // Clock
89
input           rst;            // Reset
90
input           pic_wakeup;     // Wakeup from the PIC
91
input           spr_write;      // SPR Read/Write
92
input   [31:0]   spr_addr;       // SPR Address
93
input   [31:0]   spr_dat_i;      // SPR Write Data
94
output  [31:0]   spr_dat_o;      // SPR Read Data
95
 
96
//
97
// Power Management Interface
98
//
99
input           pm_cpustall;    // Stall the CPU
100
output  [3:0]    pm_clksd;       // Clock Slowdown factor
101
output          pm_dc_gate;     // Gate DCache clock
102
output          pm_ic_gate;     // Gate ICache clock
103
output          pm_dmmu_gate;   // Gate DMMU clock
104
output          pm_immu_gate;   // Gate IMMU clock
105
output          pm_tt_gate;     // Gate Tick Timer clock
106
output          pm_cpu_gate;    // Gate main RISC/CPU clock
107
output          pm_wakeup;      // Activate (de-gate) all clocks
108
output          pm_lvolt;       // Lower operating voltage
109
 
110
`ifdef OR1200_PM_IMPLEMENTED
111
 
112
//
113
// Power Management Register bits
114
//
115
reg     [3:0]    sdf;    // Slow-down factor
116
reg             dme;    // Doze Mode Enable
117
reg             sme;    // Sleep Mode Enable
118
reg             dcge;   // Dynamic Clock Gating Enable
119
 
120
//
121
// Internal wires
122
//
123
wire            pmr_sel; // PMR select
124
 
125
//
126
// PMR address decoder (partial decoder)
127
//
128
`ifdef OR1200_PM_PARTIAL_DECODING
129
assign pmr_sel = (spr_addr[`OR1200_SPR_GROUP_BITS] == `OR1200_SPRGRP_PM) ? 1'b1 : 1'b0;
130
`else
131
assign pmr_sel = ((spr_addr[`OR1200_SPR_GROUP_BITS] == `OR1200_SPRGRP_PM) &&
132
                  (spr_addr[`OR1200_SPR_OFS_BITS] == `OR1200_PM_OFS_PMR)) ? 1'b1 : 1'b0;
133
`endif
134
 
135
//
136
// Write to PMR and also PMR[DME]/PMR[SME] reset when
137
// pic_wakeup is asserted
138
//
139
always @(posedge clk or posedge rst)
140
        if (rst)
141
                {dcge, sme, dme, sdf} <= 7'b0;
142
        else if (pmr_sel && spr_write) begin
143
                sdf <= #1 spr_dat_i[`OR1200_PM_PMR_SDF];
144
                dme <= #1 spr_dat_i[`OR1200_PM_PMR_DME];
145
                sme <= #1 spr_dat_i[`OR1200_PM_PMR_SME];
146
                dcge <= #1 spr_dat_i[`OR1200_PM_PMR_DCGE];
147
        end
148
        else if (pic_wakeup) begin
149
                dme <= #1 1'b0;
150
                sme <= #1 1'b0;
151
        end
152
 
153
//
154
// Read PMR
155
//
156
`ifdef OR1200_PM_READREGS
157
assign spr_dat_o[`OR1200_PM_PMR_SDF] = sdf;
158
assign spr_dat_o[`OR1200_PM_PMR_DME] = dme;
159
assign spr_dat_o[`OR1200_PM_PMR_SME] = sme;
160
assign spr_dat_o[`OR1200_PM_PMR_DCGE] = dcge;
161
`ifdef OR1200_PM_UNUSED_ZERO
162
assign spr_dat_o[`OR1200_PM_PMR_UNUSED] = 25'b0;
163
`endif
164
`endif
165
 
166
//
167
// Generate pm_clksd
168
//
169
assign pm_clksd = sdf;
170
 
171
//
172
// Statically generate all clock gate outputs
173
// TODO: add dynamic clock gating feature
174
//
175
assign pm_cpu_gate = (dme | sme) & ~pic_wakeup;
176
assign pm_dc_gate = pm_cpu_gate;
177
assign pm_ic_gate = pm_cpu_gate;
178
assign pm_dmmu_gate = pm_cpu_gate;
179
assign pm_immu_gate = pm_cpu_gate;
180
assign pm_tt_gate = sme & ~pic_wakeup;
181
 
182
//
183
// Assert pm_wakeup when pic_wakeup is asserted
184
//
185
assign pm_wakeup = pic_wakeup;
186
 
187
//
188
// Assert pm_lvolt when pm_cpu_gate or pm_cpustall are asserted
189
//
190
assign pm_lvolt = pm_cpu_gate | pm_cpustall;
191
 
192
`else
193
 
194
//
195
// When PM is not implemented, drive all outputs as would when PM is disabled
196
//
197
assign pm_clksd = 4'b0;
198
assign pm_cpu_gate = 1'b0;
199
assign pm_dc_gate = 1'b0;
200
assign pm_ic_gate = 1'b0;
201
assign pm_dmmu_gate = 1'b0;
202
assign pm_immu_gate = 1'b0;
203
assign pm_tt_gate = 1'b0;
204
assign pm_wakeup = 1'b1;
205
assign pm_lvolt = 1'b0;
206
 
207
//
208
// Read PMR
209
//
210
`ifdef OR1200_PM_READREGS
211
assign spr_dat_o[`OR1200_PM_PMR_SDF] = 4'b0;
212
assign spr_dat_o[`OR1200_PM_PMR_DME] = 1'b0;
213
assign spr_dat_o[`OR1200_PM_PMR_SME] = 1'b0;
214
assign spr_dat_o[`OR1200_PM_PMR_DCGE] = 1'b0;
215
`ifdef OR1200_PM_UNUSED_ZERO
216
assign spr_dat_o[`OR1200_PM_PMR_UNUSED] = 25'b0;
217
`endif
218
`endif
219
 
220
`endif
221
 
222
endmodule

powered by: WebSVN 2.1.0

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