1 |
15 |
lampret |
//////////////////////////////////////////////////////////////////////
|
2 |
|
|
//// ////
|
3 |
|
|
//// WISHBONE Real-Time Clock Definitions ////
|
4 |
|
|
//// ////
|
5 |
|
|
//// This file is part of the RTC project ////
|
6 |
|
|
//// http://www.opencores.org/cores/rtc/ ////
|
7 |
|
|
//// ////
|
8 |
|
|
//// Description ////
|
9 |
|
|
//// RTC definitions. ////
|
10 |
|
|
//// ////
|
11 |
|
|
//// To Do: ////
|
12 |
|
|
//// Nothing ////
|
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 |
18 |
ezhangyong |
// Revision 1.1 2001/09/18 22:55:39 lampret
|
48 |
|
|
// Changed rtc into rtc_top. Changed defines.v into rtc_defines.v. Fixed a bug with two defines for alarms.
|
49 |
|
|
//
|
50 |
15 |
lampret |
// Revision 1.1 2001/08/21 12:53:11 lampret
|
51 |
|
|
// Changed directory structure, uniquified defines and changed design's port names.
|
52 |
|
|
//
|
53 |
|
|
// Revision 1.2 2001/07/16 01:08:45 lampret
|
54 |
|
|
// Added additional parameters to make RTL more configurable. Added bunch of comments to defines.v
|
55 |
|
|
//
|
56 |
|
|
// Revision 1.1 2001/06/05 07:45:43 lampret
|
57 |
|
|
// Added initial RTL and test benches. There are still some issues with these files.
|
58 |
|
|
//
|
59 |
|
|
//
|
60 |
|
|
//
|
61 |
|
|
// Undefine this one if you don't want to remove RTC block from your design
|
62 |
|
|
// but you also don't need it. When it is undefined, all RTC ports still
|
63 |
|
|
// remain valid and the core can be synthesized however internally there is
|
64 |
|
|
// no RTC funationality.
|
65 |
|
|
//
|
66 |
|
|
// Defined by default (duhh !).
|
67 |
|
|
//
|
68 |
|
|
`define RTC_IMPLEMENTED
|
69 |
|
|
|
70 |
|
|
//
|
71 |
|
|
// Undefine if you don't need to read RTC registers.
|
72 |
|
|
// When it is undefined all reads of RTC registers return zero. This
|
73 |
|
|
// is usually useful if you want really small area (for example when
|
74 |
|
|
// implemented in FPGA).
|
75 |
|
|
//
|
76 |
|
|
// To follow RTC IP core specification document this one must be defined.
|
77 |
|
|
// Also to successfully run the test bench it must be defined. By default
|
78 |
|
|
// it is defined.
|
79 |
|
|
//
|
80 |
|
|
`define RTC_READREGS
|
81 |
|
|
|
82 |
|
|
//
|
83 |
|
|
// Undefine if you don't need RTC internal clock divider circuitry. Without
|
84 |
|
|
// divider RTC is clocked directly by WISHBONE or external clock.
|
85 |
|
|
//
|
86 |
|
|
// To follow RTC IP core specification document this one must be defined. Also to
|
87 |
|
|
// successfully run the test bench it must be defined. By default it is defined.
|
88 |
|
|
//
|
89 |
|
|
`define RTC_DIVIDER
|
90 |
|
|
|
91 |
|
|
//
|
92 |
|
|
// Full WISHBONE address decoding
|
93 |
|
|
//
|
94 |
|
|
// It is is undefined, partial WISHBONE address decoding is performed.
|
95 |
|
|
// Undefine it if you need to save some area.
|
96 |
|
|
//
|
97 |
|
|
// By default it is defined.
|
98 |
|
|
//
|
99 |
|
|
`define RTC_FULL_DECODE
|
100 |
|
|
|
101 |
|
|
//
|
102 |
|
|
// Strict 32-bit WISHBONE access
|
103 |
|
|
//
|
104 |
|
|
// If this one is defined, all WISHBONE accesses must be 32-bit. If it is
|
105 |
|
|
// not defined, err_o is asserted whenever 8- or 16-bit access is made.
|
106 |
|
|
// Undefine it if you need to save some area.
|
107 |
|
|
//
|
108 |
|
|
// By default it is defined.
|
109 |
|
|
//
|
110 |
|
|
`define RTC_STRICT_32BIT_ACCESS
|
111 |
|
|
|
112 |
|
|
//
|
113 |
|
|
// WISHBONE address bits used for full decoding of RTC registers.
|
114 |
|
|
//
|
115 |
|
|
`define RTC_ADDRHH 15
|
116 |
|
|
`define RTC_ADDRHL 5
|
117 |
|
|
`define RTC_ADDRLH 1
|
118 |
|
|
`define RTC_ADDRLL 0
|
119 |
|
|
|
120 |
|
|
//
|
121 |
|
|
// Bits of WISHBONE address used for partial decoding of RTC registers.
|
122 |
|
|
//
|
123 |
|
|
// Default 4:2.
|
124 |
|
|
//
|
125 |
|
|
`define RTC_OFS_BITS `RTC_ADDRHL-1:`RTC_ADDRLH+1
|
126 |
|
|
|
127 |
|
|
//
|
128 |
|
|
// Addresses of RTC registers
|
129 |
|
|
//
|
130 |
|
|
// To comply with RTC IP core specification document they must go from
|
131 |
|
|
// address 0 to address 0x10 in the following order: RRTC_TIME, RRTC_DATE,
|
132 |
|
|
// RRTC_TALRM, RRTC_DALRM and RRTC_CTRL
|
133 |
|
|
//
|
134 |
|
|
// If particular alarm/ctrl register is not needed, it's address definition
|
135 |
|
|
// can be omitted and the register will not be implemented. Instead a fixed
|
136 |
|
|
// default value will
|
137 |
|
|
// be used.
|
138 |
|
|
//
|
139 |
|
|
`define RTC_RRTC_TIME 3'h0 // Address 0x00
|
140 |
|
|
`define RTC_RRTC_DATE 3'h1 // Address 0x04
|
141 |
|
|
`define RTC_RRTC_TALRM 3'h2 // Address 0x08
|
142 |
|
|
`define RTC_RRTC_DALRM 3'h3 // Address 0x0c
|
143 |
|
|
`define RTC_RRTC_CTRL 3'h4 // Address 0x10
|
144 |
|
|
|
145 |
|
|
//
|
146 |
|
|
// Default values for unimplemented RTC registers
|
147 |
|
|
//
|
148 |
|
|
`define RTC_DEF_RRTC_TALRM 32'h00000000 // No time alarms
|
149 |
|
|
`define RTC_DEF_RRTC_DALRM 31'h00000000 // No date alarms
|
150 |
|
|
`define RTC_DEF_RRTC_CTRL 32'h80000000 // RRTC_CTRL[EN] = 1
|
151 |
|
|
|
152 |
|
|
//
|
153 |
|
|
// RRTC_TIME bits
|
154 |
|
|
//
|
155 |
|
|
// To comply with the RTC IP core specification document they must go from
|
156 |
|
|
// bit 0 to bit 26 in the following order: TOS, S, TS, M, TM, H, TH, DOW
|
157 |
|
|
//
|
158 |
|
|
`define RTC_RRTC_TIME_TOS 3:0
|
159 |
|
|
`define RTC_RRTC_TIME_S 7:4
|
160 |
|
|
`define RTC_RRTC_TIME_TS 10:8
|
161 |
|
|
`define RTC_RRTC_TIME_M 14:11
|
162 |
|
|
`define RTC_RRTC_TIME_TM 17:15
|
163 |
|
|
`define RTC_RRTC_TIME_H 21:18
|
164 |
|
|
`define RTC_RRTC_TIME_TH 23:22
|
165 |
|
|
`define RTC_RRTC_TIME_DOW 26:24
|
166 |
|
|
|
167 |
|
|
//
|
168 |
|
|
// RRTC_DATE bits
|
169 |
|
|
//
|
170 |
|
|
// To comply with the RTC IP core specification document they must go from
|
171 |
|
|
// bit 0 to bit 26 in the following order: D, TD, M, TM, Y, TY, C, TC
|
172 |
|
|
//
|
173 |
|
|
`define RTC_RRTC_DATE_D 3:0
|
174 |
|
|
`define RTC_RRTC_DATE_TD 5:4
|
175 |
|
|
`define RTC_RRTC_DATE_M 9:6
|
176 |
|
|
`define RTC_RRTC_DATE_TM 10
|
177 |
|
|
`define RTC_RRTC_DATE_Y 14:11
|
178 |
|
|
`define RTC_RRTC_DATE_TY 18:15
|
179 |
|
|
`define RTC_RRTC_DATE_C 22:19
|
180 |
|
|
`define RTC_RRTC_DATE_TC 26:23
|
181 |
|
|
|
182 |
|
|
//
|
183 |
|
|
// RRTC_TALRM bits
|
184 |
|
|
//
|
185 |
|
|
// To comply with the RTC IP core specification document they must go from
|
186 |
|
|
// bit 0 to bit 31 in the following order: TOS, S, TS, M, TM, H, TH, DOW,
|
187 |
|
|
// CTOS, CS, CM, CH, CDOW
|
188 |
|
|
//
|
189 |
|
|
`define RTC_RRTC_TALRM_TOS 3:0
|
190 |
|
|
`define RTC_RRTC_TALRM_S 7:4
|
191 |
|
|
`define RTC_RRTC_TALRM_TS 10:8
|
192 |
|
|
`define RTC_RRTC_TALRM_M 14:11
|
193 |
|
|
`define RTC_RRTC_TALRM_TM 17:15
|
194 |
|
|
`define RTC_RRTC_TALRM_H 21:18
|
195 |
|
|
`define RTC_RRTC_TALRM_TH 23:22
|
196 |
|
|
`define RTC_RRTC_TALRM_DOW 26:24
|
197 |
|
|
`define RTC_RRTC_TALRM_CTOS 27
|
198 |
|
|
`define RTC_RRTC_TALRM_CS 28
|
199 |
|
|
`define RTC_RRTC_TALRM_CM 29
|
200 |
|
|
`define RTC_RRTC_TALRM_CH 30
|
201 |
|
|
`define RTC_RRTC_TALRM_CDOW 31
|
202 |
|
|
|
203 |
|
|
//
|
204 |
|
|
// RRTC_DALRM bits
|
205 |
|
|
//
|
206 |
|
|
// To comply with the RTC IP core specification document they must go from
|
207 |
|
|
// bit 0 to bit 30 in the following order: D, TD, M, TM, Y, TY, C, TC,
|
208 |
|
|
// CD, CM, CY, CC
|
209 |
|
|
//
|
210 |
|
|
`define RTC_RRTC_DALRM_D 3:0
|
211 |
|
|
`define RTC_RRTC_DALRM_TD 5:4
|
212 |
|
|
`define RTC_RRTC_DALRM_M 9:6
|
213 |
|
|
`define RTC_RRTC_DALRM_TM 10
|
214 |
|
|
`define RTC_RRTC_DALRM_Y 14:11
|
215 |
|
|
`define RTC_RRTC_DALRM_TY 18:15
|
216 |
|
|
`define RTC_RRTC_DALRM_C 22:19
|
217 |
|
|
`define RTC_RRTC_DALRM_TC 26:23
|
218 |
|
|
`define RTC_RRTC_DALRM_CD 27
|
219 |
|
|
`define RTC_RRTC_DALRM_CM 28
|
220 |
|
|
`define RTC_RRTC_DALRM_CY 29
|
221 |
|
|
`define RTC_RRTC_DALRM_CC 30
|
222 |
|
|
|
223 |
|
|
//
|
224 |
|
|
// RRTC_CTRL bits
|
225 |
|
|
//
|
226 |
|
|
// To comply with the RTC IP core specification document they must go from
|
227 |
|
|
// bit 0 to bit 31 in the following order: DIV, BTOS, ECLK, INTE, ALRM, EN
|
228 |
|
|
//
|
229 |
|
|
`define RTC_RRTC_CTRL_DIV 26:0
|
230 |
|
|
`define RTC_RRTC_CTRL_BTOS 27
|
231 |
|
|
`define RTC_RRTC_CTRL_ECLK 28
|
232 |
|
|
`define RTC_RRTC_CTRL_INTE 29
|
233 |
|
|
`define RTC_RRTC_CTRL_ALRM 30
|
234 |
|
|
`define RTC_RRTC_CTRL_EN 31
|