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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [or1200/] [rtl/] [verilog/] [or1200_pm.v] - Blame information for rev 258

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

Line No. Rev Author Line
1 10 unneback
//////////////////////////////////////////////////////////////////////
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 141 marcus.erl
// $Log: or1200_pm.v,v $
47
// Revision 2.0  2010/06/30 11:00:00  ORSoC
48
// No update 
49
//
50
// Revision 1.1  2002/01/03 08:16:15  lampret
51
// New prefixes for RTL files, prefixed module names. Updated cache controllers and MMUs.
52
//
53 10 unneback
// 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:10  lampret
57
// MP3 version.
58
//
59
// Revision 1.1.1.1  2001/10/06 10:18:35  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:21  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_pm(
76
        // RISC Internal Interface
77
        clk, rst, pic_wakeup, spr_write, spr_addr, spr_dat_i, spr_dat_o,
78
 
79
        // Power Management Interface
80
        pm_clksd, pm_cpustall, pm_dc_gate, pm_ic_gate, pm_dmmu_gate,
81
        pm_immu_gate, pm_tt_gate, pm_cpu_gate, pm_wakeup, pm_lvolt
82
);
83
 
84
//
85
// RISC Internal Interface
86
//
87
input           clk;            // Clock
88
input           rst;            // Reset
89
input           pic_wakeup;     // Wakeup from the PIC
90
input           spr_write;      // SPR Read/Write
91
input   [31:0]   spr_addr;       // SPR Address
92
input   [31:0]   spr_dat_i;      // SPR Write Data
93
output  [31:0]   spr_dat_o;      // SPR Read Data
94
 
95
//
96
// Power Management Interface
97
//
98
input           pm_cpustall;    // Stall the CPU
99
output  [3:0]    pm_clksd;       // Clock Slowdown factor
100
output          pm_dc_gate;     // Gate DCache clock
101
output          pm_ic_gate;     // Gate ICache clock
102
output          pm_dmmu_gate;   // Gate DMMU clock
103
output          pm_immu_gate;   // Gate IMMU clock
104
output          pm_tt_gate;     // Gate Tick Timer clock
105
output          pm_cpu_gate;    // Gate main RISC/CPU clock
106
output          pm_wakeup;      // Activate (de-gate) all clocks
107
output          pm_lvolt;       // Lower operating voltage
108
 
109
`ifdef OR1200_PM_IMPLEMENTED
110
 
111
//
112
// Power Management Register bits
113
//
114
reg     [3:0]    sdf;    // Slow-down factor
115
reg             dme;    // Doze Mode Enable
116
reg             sme;    // Sleep Mode Enable
117
reg             dcge;   // Dynamic Clock Gating Enable
118
 
119
//
120
// Internal wires
121
//
122
wire            pmr_sel; // PMR select
123
 
124
//
125
// PMR address decoder (partial decoder)
126
//
127
`ifdef OR1200_PM_PARTIAL_DECODING
128
assign pmr_sel = (spr_addr[`OR1200_SPR_GROUP_BITS] == `OR1200_SPRGRP_PM) ? 1'b1 : 1'b0;
129
`else
130
assign pmr_sel = ((spr_addr[`OR1200_SPR_GROUP_BITS] == `OR1200_SPRGRP_PM) &&
131
                  (spr_addr[`OR1200_SPR_OFS_BITS] == `OR1200_PM_OFS_PMR)) ? 1'b1 : 1'b0;
132
`endif
133
 
134
//
135
// Write to PMR and also PMR[DME]/PMR[SME] reset when
136
// pic_wakeup is asserted
137
//
138
always @(posedge clk or posedge rst)
139
        if (rst)
140
                {dcge, sme, dme, sdf} <= 7'b0;
141
        else if (pmr_sel && spr_write) begin
142 258 julius
                sdf <=  spr_dat_i[`OR1200_PM_PMR_SDF];
143
                dme <=  spr_dat_i[`OR1200_PM_PMR_DME];
144
                sme <=  spr_dat_i[`OR1200_PM_PMR_SME];
145
                dcge <=  spr_dat_i[`OR1200_PM_PMR_DCGE];
146 10 unneback
        end
147
        else if (pic_wakeup) begin
148 258 julius
                dme <=  1'b0;
149
                sme <=  1'b0;
150 10 unneback
        end
151
 
152
//
153
// Read PMR
154
//
155
`ifdef OR1200_PM_READREGS
156
assign spr_dat_o[`OR1200_PM_PMR_SDF] = sdf;
157
assign spr_dat_o[`OR1200_PM_PMR_DME] = dme;
158
assign spr_dat_o[`OR1200_PM_PMR_SME] = sme;
159
assign spr_dat_o[`OR1200_PM_PMR_DCGE] = dcge;
160
`ifdef OR1200_PM_UNUSED_ZERO
161
assign spr_dat_o[`OR1200_PM_PMR_UNUSED] = 25'b0;
162
`endif
163
`endif
164
 
165
//
166
// Generate pm_clksd
167
//
168
assign pm_clksd = sdf;
169
 
170
//
171
// Statically generate all clock gate outputs
172
// TODO: add dynamic clock gating feature
173
//
174
assign pm_cpu_gate = (dme | sme) & ~pic_wakeup;
175
assign pm_dc_gate = pm_cpu_gate;
176
assign pm_ic_gate = pm_cpu_gate;
177
assign pm_dmmu_gate = pm_cpu_gate;
178
assign pm_immu_gate = pm_cpu_gate;
179
assign pm_tt_gate = sme & ~pic_wakeup;
180
 
181
//
182
// Assert pm_wakeup when pic_wakeup is asserted
183
//
184
assign pm_wakeup = pic_wakeup;
185
 
186
//
187
// Assert pm_lvolt when pm_cpu_gate or pm_cpustall are asserted
188
//
189
assign pm_lvolt = pm_cpu_gate | pm_cpustall;
190
 
191
`else
192
 
193
//
194
// When PM is not implemented, drive all outputs as would when PM is disabled
195
//
196
assign pm_clksd = 4'b0;
197
assign pm_cpu_gate = 1'b0;
198
assign pm_dc_gate = 1'b0;
199
assign pm_ic_gate = 1'b0;
200
assign pm_dmmu_gate = 1'b0;
201
assign pm_immu_gate = 1'b0;
202
assign pm_tt_gate = 1'b0;
203
assign pm_wakeup = 1'b1;
204
assign pm_lvolt = 1'b0;
205
 
206
//
207
// Read PMR
208
//
209
`ifdef OR1200_PM_READREGS
210
assign spr_dat_o[`OR1200_PM_PMR_SDF] = 4'b0;
211
assign spr_dat_o[`OR1200_PM_PMR_DME] = 1'b0;
212
assign spr_dat_o[`OR1200_PM_PMR_SME] = 1'b0;
213
assign spr_dat_o[`OR1200_PM_PMR_DCGE] = 1'b0;
214
`ifdef OR1200_PM_UNUSED_ZERO
215
assign spr_dat_o[`OR1200_PM_PMR_UNUSED] = 25'b0;
216
`endif
217
`endif
218
 
219
`endif
220
 
221
endmodule

powered by: WebSVN 2.1.0

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