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

Subversion Repositories rtcclock

[/] [rtcclock/] [trunk/] [doc/] [src/] [spec.tex] - Blame information for rev 4

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

Line No. Rev Author Line
1 2 dgisselq
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2
%%
3
%% Filename:    spec.tex
4
%%
5
%% Project:     A Wishbone Controlled Real-Time clock Core
6
%%
7
%% Purpose:     This LaTeX file contains all of the documentation/description
8
%%              currently provided with this FPGA Real-time Clock Core.
9
%%              It's not nearly as interesting as the PDF file it creates,
10
%%              so I'd recommend reading that before diving into this file.
11
%%              You should be able to find the PDF file in the SVN distribution
12
%%              together with this PDF file and a copy of the GPL-3.0 license
13
%%              this file is distributed under.  If not, just type 'make'
14
%%              in the doc directory and it (should) build without a problem.
15
%%
16
%%
17
%% Creator:     Dan Gisselquist
18
%%              Gisselquist Technology, LLC
19
%%
20
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
21
%%
22
%% Copyright (C) 2015, Gisselquist Technology, LLC
23
%%
24
%% This program is free software (firmware): you can redistribute it and/or
25
%% modify it under the terms of  the GNU General Public License as published
26
%% by the Free Software Foundation, either version 3 of the License, or (at
27
%% your option) any later version.
28
%%
29
%% This program is distributed in the hope that it will be useful, but WITHOUT
30
%% ANY WARRANTY; without even the implied warranty of MERCHANTIBILITY or
31
%% FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
32
%% for more details.
33
%%
34
%% You should have received a copy of the GNU General Public License along
35
%% with this program.  (It's in the $(ROOT)/doc directory, run make with no
36
%% target there if the PDF file isn't present.)  If not, see
37
%% <http://www.gnu.org/licenses/> for a copy.
38
%%
39
%% License:     GPL, v3, as defined and found on www.gnu.org,
40
%%              http://www.gnu.org/licenses/gpl.html
41
%%
42
%%
43
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
44
\documentclass{gqtekspec}
45
\project{Real-Time Clock}
46
\title{Specification}
47
\author{Dan Gisselquist, Ph.D.}
48 4 dgisselq
\email{dgisselq (at) opencores.org}
49 2 dgisselq
\revision{Rev.~0.1}
50
\begin{document}
51
\pagestyle{gqtekspecplain}
52
\titlepage
53
\begin{license}
54
Copyright (C) \theyear\today, Gisselquist Technology, LLC
55
 
56
This project is free software (firmware): you can redistribute it and/or
57
modify it under the terms of  the GNU General Public License as published
58
by the Free Software Foundation, either version 3 of the License, or (at
59
your option) any later version.
60
 
61
This program is distributed in the hope that it will be useful, but WITHOUT
62
ANY WARRANTY; without even the implied warranty of MERCHANTIBILITY or
63
FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
64
for more details.
65
 
66
You should have received a copy of the GNU General Public License along
67
with this program.  If not, see \hbox{<http://www.gnu.org/licenses/>} for a
68
copy.
69
\end{license}
70
\begin{revisionhistory}
71
0.1 & 5/25/2015 & Gisselquist & First Draft \\\hline
72
\end{revisionhistory}
73
% Revision History
74
% Table of Contents, named Contents
75
\tableofcontents
76
% \listoffigures
77
\listoftables
78
\begin{preface}
79
Every FPGA project needs to start with a very simple core.  Then, working
80
from simplicity, more and more complex cores can be built until an eventual
81
application comes from all the tiny details.
82
 
83
This real time clock is one such simple core.  All of the pieces to this
84
clock are simple.  Nothing is inherently complex.  However, placing this
85
clock into a larger FPGA structure requires a Wishbone bus, and being able
86
to command and control an FPGA over a wishbone bus is an achievement in
87
itself.  Further, the clock produces seven segment display output values
88
and LED output values.  These are also simple outputs, but still take a lot
89
of work to complete.  Finally, this clock will strobe an interrupt line.
90
Reading and processing that interrupt line requires a whole 'nuther bit of
91
logic and the ability to capture, recognize, and respond to interrupts.
92
Hence, once you get a simple clock working, you have a lot working.
93
\end{preface}
94
 
95
\chapter{Introduction}
96
\pagenumbering{arabic}
97
\setcounter{page}{1}
98
 
99
This Real--Time Clock implements a twenty four hour clock, count-down timer,
100
stopwatch
101
and alarm.  It is designed to be configurable to adjust to whatever clock
102
speed the underlying architecture is running on, so with only minor changes
103
should run on any fundamental clock rate from about 66~kHz on up to
104
250~TeraHertz with varying levels of accuracy along the way.
105
 
106
This clock offers a fairly full feature set of capability: time, alarms,
107
a countdown timer and a stopwatch, all features which are available from the
108
wishbone bus.
109
 
110
Other interfaces exist as well.
111
 
112
Should you wish to investigate your clock's
113
stability or try to guarantee it's fine precision accuracy, it is possible to
114
provide a time hack pulse to the clock and subsequently read what all of the
115
internal registers were set to at that time.
116
 
117
When either the count--down timer reaches zero or the clock reaches the alarm
118
time (if set), the clock module will produce an impulse which can be used
119
as an interrupt trigger.
120
 
121
This clock will also provide outputs sufficient to drive an external seven
122
segment display driver and 16 LED's.
123
 
124
Future enhancements may allow for button control and fine precision clock
125
adjustment.
126
 
127
The layout of this specification follows the format set by OpenCores.
128
This introduction is the first chapter.  Following this introduction is
129
a short chapter describing how this clock is implemented,
130
Chapt.~\ref{chap:arch}.  Following this description, the Chapt.~\ref{chap:ops}
131
gives a brief overview of how to operate the clock.  Most of the details,
132
however, are in the registers and their definitions.  These you can find in
133
Chapt.~\ref{chap:regs}.  As for the wishbone, the wishbone spec requires a
134
wishbone datasheet which you can find in Chapt.~\ref{chap:wishbone}.
135
That leaves the final pertinent information necessary for implementing this
136
core in Chapt.~\ref{chap:ioports}, the definitions and meanings of the
137
various I/O ports.
138
 
139
As always, write me if you have any questions or problems.
140
 
141
\chapter{Architecture}\label{chap:arch}
142
 
143
Central to this real time clock architecture is a 48~bit sub--second register.
144
This register is incremented every clock by a user defined 32~bit value,
145
{\tt CKSPEED}.
146
When the register turns over at the end of each second, a second has taken
147
place and all of the various clock registers are adjusted.
148
 
149
Well, not quite but almost.  The 48~bit register is actually split into a
150
lower 40~bit register that is common to all clock components, as well as
151
separate eight bit upper registers for the clock, timer, and stopwatch.  In
152
this fashion, these separate components can have different definitions for
153
when seconds begin and end, and with sufficient precision to satisfy most
154
applications.
155
 
156
The next thing to note about this architecture is the format of the various
157
clock registers: Binary Coded Decimal, or BCD.  Hence an {\tt 8'h59} refers
158
to a value of 59, rather than 89.  In this fashion, setting the time to
159
{\tt 24'h231520} will set it to 23~hours, 15~minutes, and 20~seconds.  The
160
only exception to this BCD format are the subseconds fields found in the
161
stopwatch and time hack registers.  Seconds and above are all encoded as BCD.
162
 
163
\chapter{Operation}\label{chap:ops}
164
 
165
\section{Time}
166
To set the time, simply write to the clock register the current value of the
167
time.  If the seconds hand is written as zero, subsecond time will be cleared
168
as well.  The new clock value takes place one clock period after the value
169
is written to the bus.
170
 
171
To set only some parts of the time and not others, such as the minutes but
172
not seconds or hours, write all '1's to the seconds and hours.  In this way,
173
writing a {\tt 24'h3f17ff} will set the minutes to 17, but not affect the
174
rest of the clock.
175
 
176
This is also the way to adjust the display without adjusting time.  Suppose
177
you wish to switch to display option '1', just write a {\tt 32'h013fffff} to
178
the register and the display will switch without adjusting time.
179
 
180
\section{Count-down Timer}
181
To use the count down timer, set it to the amount of time you wish to count
182
down for.  When ready, or even in the same cycle, enable the count--down
183
timer by setting the RUN bit high.  At this point in time, the count--down
184
timer is running.  When it gets to zero, it will stop and trigger an interrupt.
185
You can tell if the alarm has been triggered by the TRIGGER bit being set.
186
Any write to the timer register will clear the alarm condition.
187
 
188
While the timer is running, writing a '0' to the timer register will stop it
189
without clearing the time remaining.  In this state, writing to the register
190
the RUN bit by itself will restart the timer, while anything else will set the
191
timer to a new value.  Further, if the timer is stopped at zero, then writing
192
zero to the timer will reset the timer to the last start time it had.
193
 
194
\section{Stopwatch}
195
The stop watch supports three operations: start, stop, and clear.  Writing a
196
'1' to the stop watch register will start the stopwatch, while writing a '0'
197
will stop it.  When it starts next, it will start where it left off unless the
198
register is cleared.  To clear the register and set it back to zero, write a
199
'2' to the register.  This will effectively stop the register and clear it in
200
one step.  If the register is already stopped, writing a '3' will clear and
201
start it in one step.  However, the register can only be cleared while stopped.
202
If the register is running, writing a '3' will have no effect.
203
 
204
\section{Alarm}
205
To set the alarm, just write the alarm time to the alarm register together
206
with alarm enable bit.  As with the time register, setting any field,
207
whether hours, minutes, or seconds, to {\tt 8'hff} has no effect on that
208
field.  Hence, the alarm may be activated by writing {\tt 25'h13fffff} to
209
the register and deactivated by writing {\tt 25'h03fffff}.
210
 
211
Once the alarm is tripped, the RTC core will generate an interrupt.  Further,
212
the tripped bit in the alarm register will be set.  To clear this bit and the
213
alarm tripped condition, either disable the alarm or write a '1' to this bit.
214
 
215
\section{Time Hacks}
216
 
217
For finer precision timing, the RTC module allows for setting a time
218
hack and reading the value from the device.  On the clock following the
219
time hack being high, the internal state, to include the time and the 48~bit
220
counter, will be recorded and may then be read out.  In this fashion,
221
it is possible to capture, with as much precision as the device offers,
222
the current time within the device.
223
 
224
It is the users responsibility to read the time hack registers before a
225
subsequent time hack pulse sets them to new values.
226
 
227
\chapter{Registers}\label{chap:regs}
228
This RTC clock module supports eight registers, as listed in
229
Tbl.~\ref{tbl:reglist}.  Of these eight, the first four have been so placed
230
as to be the more routine or user used registers, while the latter four are
231
more lower level.
232
\begin{table}[htbp]
233
\begin{center}
234
\begin{reglist}
235
CLOCK   & 0 & 32 & R/W & Wall clock time register\\\hline
236
TIMER   & 1 & 32 & R/W & Count--down timer\\\hline
237
STPWTCH & 2 & 32 & R/W & Stopwatch control and value\\\hline
238
ALARM   & 3 & 32 & R/W & Alarm time, and setting\\\hline\hline
239
CKSPEED & 4 & 32 & R/W & Clock speed control.\\\hline
240
HACKTIME &5 & 32 & R & Wall clock time at last hack.\\\hline
241
HACKCNTHI&6 & 32 & R & Wall clock time.\\\hline
242
HACKCNTLO&7 & 32 & R & Wall clock time.\\\hline
243
\end{reglist}\caption{List of Registers}\label{tbl:reglist}
244
\end{center}\end{table}
245
Each register will be discussed in detail in this chapter.
246
 
247
\section{Clock Time Register}
248
The various bit fields associated with the current time may be found in
249
the {\tt CLOCK} register, shown in Tbl.~\ref{tbl:clockreg}.
250
\begin{table}[htbp]\begin{center}
251
\begin{bitlist}
252
28--31 & R & Always return zero.\\\hline
253
24--27 & R/W & Seven Segment Display Mode.\\\hline
254
22--23 & R & Always return zero.\\\hline
255
16--21 & R/W & Current time, BCD hours\\\hline
256
8--15 & R/W & Current time, BCD minutes\\\hline
257
0--7 & R/W & Current time, BCD seconds\\\hline
258
\end{bitlist}
259
\caption{Clock Time Register Bit Definitions}\label{tbl:clockreg}
260
\end{center}\end{table}
261
This register contains six clock digits: two each for hours, minutes, and
262
seconds.  Each of these digits is encoded in Binary Coded Decimal (BCD).
263
Therefore, 23~hours would be encoded as 6'h23 and not 6'h17.  Writes to each
264
of the various subcomponent registers will set that register, unless the
265
write value is a 8'hff.  The behaviour of the clock when non--decimal
266
values are written, other than all F's, is undefined.
267
 
268
Separate from the time, however, is the seven segment display mode.  Four
269
values are currently supported: 4'h0 to display the hours and minutes,
270
4'h1 to display the timer in minutes and seconds, 4'h2 to display the
271
stopwatch in lower order minutes, seconds, and sixteenths of a second, and
272
4'h3 to display the minutes and seconds of the current time.  In all cases,
273
the decimal point will appear to the right of the lowest order digit
274
and will blink with the second hand.  That is, the decimal will be high for
275
the second half of any second, and low at the top of the second.
276
 
277
\section{Countdown Timer Register}
278
The countdown timer register, whose bit--wise values are shown in
279
Tbl.~\ref{tbl:timer},
280
\begin{table}[htbp]
281
\begin{center}
282
\begin{bitlist}
283
26--31 & R & Unused, always read as '0'.\\\hline
284
25 & R/W & Alarm condition.  Write a '1' to clear.\\\hline
285
24 & R/W & Running, stopped on '0'\\\hline
286
16--23 & R/W & BCD Hours\\\hline
287
8--15 & R/W & BCD Minutes\\\hline
288
0--7 & R/W & BCD Seconds\\\hline
289
\end{bitlist}
290
\caption{Count--down Timer register}\label{tbl:timer}
291
\end{center}\end{table}
292
controls the operation of the count--down timer.  To use this timer, write
293
some amount of time to the register, then write zeros with bit 24 set.  The
294
register will then reach an alarm condition after counting down that amount
295
of time.  (Alternatively, you could set bit 24 while writing the register,
296
to set and start it in one operation.)  To stop the register while it is
297
running, just write all zeros.  To restart the register, provided more than a
298
second remains, write a {\tt 26'h1000000} to set it running again.  Once
299
the timer alarms, the timer will stop and the alarm condition will be set.
300
Any write to the timer register after the alarm condition has been set will
301
clear the alarm condition.
302
 
303
\section{Stopwatch Register}
304
The various bits of the stopwatch register are shown in
305
Tbl.~\ref{tbl:stopwatch}.
306
\begin{table}[htbp]
307
\begin{center}
308
\begin{bitlist}
309
24--31 & R & Hours\\\hline
310
16--23 & R & Minutes\\\hline
311
8--15 & R & Sub Seconds\\\hline
312
1--7 & R & Sub Seconds\\\hline
313
1 & W & Clear\\\hline
314
 
315
\end{bitlist}
316
\caption{Stopwatch Register}\label{tbl:stopwatch}
317
\end{center}\end{table}
318
Of note is the bottom bit that, when set, means the stop watch is running.
319
Set this bit to '1' to start the stopwatch, or to '0' to stop the stopwatch.
320
Further, while the stopwatch is stopped, a '1' can be written to the clear
321
bit.  This will zero out the stopwatch and set it back to zero.
322
 
323
\section{Alarm Register}
324
The various bits of the alarm register are shown in Tbl.~\ref{tbl:alarm}.
325
\begin{table}[htbp]
326
\begin{center}
327
\begin{bitlist}
328
26--31 & R & Always reads zeros. \\\hline
329
25 & R/W & Alarm tripped.  Write a '1' to this register to clear any alarm
330
        condition.  (A tripped alarm will not trip again.)\\\hline
331
24 & R/W & Alarm enabled\\\hline
332
16--23 & R & Alarm time, BCD hours\\\hline
333
8--15 & R & Alarm time, BCD minutes\\\hline
334
0--7 & R/W & Alarm time, BCD Seconds\\\hline
335
\end{bitlist}
336
\caption{Alarm Register}\label{tbl:alarm}
337
\end{center}\end{table}
338
Basically, the alarm register consists a time and two more bits.  The extra
339
two bits encode whether or not the alarm is enabled, and whether or not it has
340
been tripped.  The alarm will be {\em tripped} whenever it is enabled, and the
341
time changes to equal the alarm time.  Once tripped, the alarm will stay
342
in the alarmed or tripped condition until either a '1' is written to the
343
tripped bit, or the alarm is disabled.
344
 
345
As with the clock and timer registers, writing eight ones to any of the
346
BCD fields when writing to this register will leave those fields untouched.
347
 
348
\section{Clock Speed Register}
349
The actual speed of the clock is controlled by the {\tt CKSPEED} register,
350
shown in Tbl.~\ref{tbl:ckspeed}.
351
\begin{table}[htbp]
352
\begin{center}
353
\begin{bitlist}
354
0--31 & R/W & 48~bit counter time increment\\\hline
355
\end{bitlist}
356
\caption{Clock Speed Register}\label{tbl:ckspeed}
357
\end{center}\end{table}
358
This register contains a simple 32~bit unsigned value.  To step the clock,
359
this value is extended to 48~bits and added to the fractional seconds value.
360
 
361
This value should be set to $2^{48}$ divided by the clock frequency of the
362
controlling clock.  Hence, for a 100~MHz clock, this value would be set to
363
{\tt 32'd2814750}.  For clocks near 100~MHz, this allows adjusting speed
364
within about 40~clocks per second.  For clocks near 500~MHz, this allows
365
time adjustment to an accuracy of about about 800~clocks per second.  In
366
both cases, this is good enough to maintain a clock with less than a
367
microsecond loss over the course of a year.  Hence, this RTC module provides
368
more logical stability than most hardware clocks on the market today.
369
 
370
\section{Time--hack time}
371
To support finer precision clock control, the time--hack capability exists.
372
This capability consists of three registers, the time--hack time register
373
shown in Tbl.~\ref{tbl:hacktime},
374
\begin{table}[htbp]
375
\begin{center}
376
\begin{bitlist}
377
24--31 & R & BCD Hours.\\\hline
378
16--23 & R & BCD Minutes.\\\hline
379
8--15 & R & BCD seconds.\\\hline
380
0--7 & R & Subseconds, encoded in 256ths of a second\\\hline
381
\end{bitlist}
382
\caption{Time Hack Time Register}\label{tbl:hacktime}
383
\end{center}\end{table}
384
and two registers (Tbls.~\ref{tbl:hackcnthi}
385
\begin{table}[htbp]
386
\begin{center}
387
\begin{bitlist}
388
0--31 & R & Upper 32 bits of the internal 40~bit counter.\\\hline
389
\end{bitlist}
390
\caption{Time Hack Counter, High}\label{tbl:hackcnthi}
391
\end{center}\end{table}
392
and~\ref{tbl:hackcntlo})
393
\begin{table}[htbp]
394
\begin{center}
395
\begin{bitlist}
396
24--31 & R & Bottom 8~bits of the internal 40~bit counter.\\\hline
397
0--23 & R & Always read as '0'.\\\hline
398
\end{bitlist}
399
\caption{Time Hack Counter, Low}\label{tbl:hackcntlo}
400
\end{center}\end{table}
401
capturing the contents of the 40~bit internal counter at the time of the hack.
402
 
403
The time--hack time register is perhaps the simplest to understand.  This
404
captures the time of the time--hack in hours, minutes, seconds, and 8~fractional
405
subsecond bits.  The top 24~bits of this register will match the bottom 24~bits
406
of the clock~time register at the time of the time hack.  The bottom eight
407
bits are the top eight bits of the 48~bit subsecond time counter.  The
408
rest of those 48~bits may then be returned in the other two time hack counter
409
registers.
410
 
411
At present, this functionality isn't yet truly fully featured.  Once fully
412
featured, there will (should) be a mechanism for adjusting this counter based
413
upon information gleaned from the hack time.  Implementation details have
414
to date prevented this portion of the design from being implemented.
415
 
416
\chapter{Wishbone Datasheet}\label{chap:wishbone}
417
Tbl.~\ref{tbl:wishbone}
418
\begin{table}[htbp]
419
\begin{center}
420
\begin{wishboneds}
421
Revision level of wishbone & WB B4 spec \\\hline
422
Type of interface & Slave, Read/Write \\\hline
423
Port size & 32--bit \\\hline
424
Port granularity & 32--bit \\\hline
425
Maximum Operand Size & 32--bit \\\hline
426
Data transfer ordering & (Irrelevant) \\\hline
427
Clock constraints & Faster than 66~kHz \\\hline
428
Signal Names & \begin{tabular}{ll}
429
                Signal Name & Wishbone Equivalent \\\hline
430
                {\tt i\_clk} & {\tt CLK\_I} \\
431
                {\tt i\_wb\_cyc} & {\tt CYC\_I} \\
432
                {\tt i\_wb\_stb} & {\tt STB\_I} \\
433
                {\tt i\_wb\_we} & {\tt WE\_I} \\
434
                {\tt i\_wb\_addr} & {\tt ADR\_I} \\
435
                {\tt i\_wb\_data} & {\tt DAT\_I} \\
436
                {\tt o\_wb\_ack} & {\tt ACK\_O} \\
437
                {\tt o\_wb\_stall} & {\tt STALL\_O} \\
438
                {\tt o\_wb\_data} & {\tt DAT\_O}
439
                \end{tabular}\\\hline
440
\end{wishboneds}
441
\caption{Wishbone Datasheet}\label{tbl:wishbone}
442
\end{center}\end{table}
443
is required by the wishbone specification, and so
444
it is included here.  The big thing to notice is that this real time clock
445
acts as a wishbone slave, and that all accesses to the
446
clock registers are 32--bit reads and writes.  The address bus does not offer
447
byte level, but rather 32--bit word level resolution.  Select lines are not
448
implemented.  Bit ordering is the normal ordering where bit~31 is the most
449
significant bit and so forth.  Although the stall line is implemented, it is
450
always zero.  Access delays are a single clock, so the clock after a read or
451
write is placed on the bus the {\tt i\_wb\_ack} line will be high.
452
 
453
\iffalse
454
\chapter{Clocks}\label{chap:clocks}
455
 
456
This core is based upon the Basys--3 design.  The Basys--3 development board
457
contains one external 100~MHz clock, which is sufficient to run this
458
core.  The logic within the core can also be run faster, or slower, as is
459
necessary to meet the timing constraints associated with the internal
460
operations of the core and it's surrounding environment.  See
461
Table.~\ref{tbl:clocks}.
462
\begin{table}[htbp]
463
\begin{center}
464
\begin{clocklist}
465
i\_clk & External & 250~THz & 66~kHz & System clock.\\\hline
466
\end{clocklist}
467
\caption{List of Clocks}\label{tbl:clocks}
468
\end{center}\end{table}
469
 
470
\fi
471
 
472
\chapter{I/O Ports}\label{chap:ioports}
473
The I/O ports for this core are shown in Tbls.~\ref{tbl:iowishbone}
474
\begin{table}[htbp]
475
\begin{center}
476
\begin{portlist}
477
i\_wb\_cyc & 1 & Input & Wishbone bus cycle wire.\\\hline
478
i\_wb\_stb & 1 & Input & Wishbone strobe.\\\hline
479
i\_wb\_we & 1 & Input & Wishbone write enable.\\\hline
480
i\_wb\_addr & 5 & Input & Wishbone address.\\\hline
481
i\_wb\_data & 32 & Input & Wishbone bus data register for use when writing
482
        (configuring) the core from the bus.\\\hline
483
o\_wb\_ack & 1 & Output & Return value acknowledging a wishbone write, or
484
                signifying valid data in the case of a wishbone read request.
485
                \\\hline
486
o\_wb\_stall & 1 & Output & Indicates the device is not yet ready for another
487
                wishbone access, effectively stalling the bus.\\\hline
488
o\_wb\_data & 32 & Output & Wishbone data bus, returning data values read
489
                from the interface.\\\hline
490
\end{portlist}
491
\caption{Wishbone I/O Ports}\label{tbl:iowishbone}
492
\end{center}\end{table}
493
and~Tbl.~\ref{tbl:ioother}.
494
\begin{table}[htbp]
495
\begin{center}
496
\begin{portlist}
497
o\_sseg & 32 & Output & Lines to control a seven segment display, to be
498
                sent to that display's driver.  Each eight bit byte controls
499
                one digit in the display, with the bottom bit in the byte
500
                controlling the decimal point.\\\hline
501
o\_led & 16 & Output & Output LED's, consisting of a 16--bit counter counting
502
                from zero to all ones each minute, and synchronized with each
503
                minute so as to create an indicator of when the next minute
504
                will take place when only the hours and minutes can be
505
                displayed.\\\hline
506
o\_interrupt & 1 & Output & A pulsed/strobed interrupt line.  When the
507
                clock needs to generate an interrupt, it will set this line
508
                high for one clock cycle.  \\\hline
509
i\_hack & 1 & Input & When this line is raised, copies are made of the
510
        internal state registers on the next clock.  These registers can then
511
        be used for an accurate time hack regarding the state of the clock
512
        at the time this line was strobed.\\\hline
513
\end{portlist}
514
\caption{Other I/O Ports}\label{tbl:ioother}
515
\end{center}\end{table}
516
Tbl.~\ref{tbl:iowishbone} reiterates the wishbone I/O values just discussed in
517
Chapt.~\ref{chap:wishbone}, and so need no further discussion here.
518
 
519
This clock is designed for command and control via the wishbone.  No other
520
registers, beyond the wishbone bus, are required.  However, several other
521
may be valuable.  These other registers are listed in Tbl.~\ref{tbl:ioother}.
522
We'll discuss each of these in turn.
523
 
524
First of the other I/O registers is the {\tt o\_sseg} register.  This register
525
encodes which outputs of a seven segment display need to be turned on to
526
represent the value of the clock requested.  This register consists of four
527
eight bit bytes, with the highest order byte referencing the highest order
528
display segment value.  In each byte, the low order bit references a decimal
529
point.  The other bits are ordered around the zero, with the top bit being
530
the top bar of a '0', the next highest order bit and so on following the
531
zero clockwise.  The final bit of each byte, the bit in the two's place,
532
encodes whether or not the middle line is to be displayed.  When either timer
533
or alarm is triggered, this display will blink until the triggering conditions
534
are cleared.
535
 
536
This output is expected to be the input to a seven segment display driver,
537
rather than being the output to the display itself.
538
 
539
The next output lines are the 16~lines of the {\tt o\_led} bus.  When connected
540
with 16~LED's, these lines will create a counting display that will count up
541
to each minute, synchronized to the minute.  When either timer or alarm has
542
triggered, all of the LED's will flash together until the triggered condition
543
is reset.
544
 
545
The third other line is the {\tt o\_interrupt} line.  This line will be
546
strobed by the RTC module any time the alarm is triggered or the timer runs
547
out.  The line will not remain high, but neither will it trigger a second
548
time until the underlying interrupt is cleared.  That is, the timer will only
549
trigger once until cleared as will the alarm, but the alarm may trigger after
550
the timer has triggered and before the timer clears.
551
 
552
The final other I/O line is a simple input line.  This line is expected to be
553
strobed for one clock cycle any time a time hack is required.  For example,
554
should you wish to read and synchronize to a GPS PPS signal, strobe the device
555
with the PPS (after dealing with any metastability issues), and read the time
556
hacks that are produced.
557
 
558
% Appendices
559
% Index
560
\end{document}
561
 
562
 

powered by: WebSVN 2.1.0

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