© 2001-2018 HT-Lab
The HTL146818 is a synchronous implementation of the industry standard 146818 Real
Time Clock (RTC). The RTC provides a real-time clock, calendar and alarm function. In
addition, 50 bytes of user memory, a programmable periodic interrupt and a square
wave function are also provided.
The RTC provides a real-time clock function in either 24 or 12-hour format with AM/PM
indication. A time alarm can be programmed to trigger from once a second up to once a
day. The calendar function compensates for leap-years up to the year 2099. The time,
alarm and calendar values can be programmed in either binary or BCD format. Three
maskable interrupts (IRQ output) are provided to inform the processor of a Alarm trigger,
End of Update trigger and a general purpose Periodic trigger. The End of Update trigger is provided so that registers can be
updated without conflicting with the internal update function. The Periodic interrupt can be programmed to trigger from 30.5us up
to 500ms. The square wave output pin (SQW) can output one of the 13 taps from the internal 22 bits divider creating a 50% duty
cycle signal which can range from 8.192KHz down to 2Hz. The RTC is clocked from a 32.768KHz oscillator (OSC1) which is
internally synchronised to the main processor clock.
Key Features
All trademarks mentioned on this web page are trademarks of their respective owners.
RTC-146818 Real Time Clock
HTL146818
Area and Performance
The table below shows a push button implementation of the standalone core for the 3 major FPGA vendors. The values given are
an indication of the required area and performance. No pin number, slewrate or I/O type was specified. Mentor Graphic's
Precision RTL 2007a.8 was used for synthesis.
Programming Model
It is recommended to download one of the many commercial 146818 datasheets to understand the programming model. The
HTL146818 contains a number of differences between these devices:
•
The HTL146818 only provides a single 32.768KHz time basis. It is trivial to add other (multiple) frequencies.
•
There is no restriction in changing the Data Mode (DM) bit, i.e. the driver can change this bit without re-initialising the
registers. However, the DM bit must be set to the correct value during a write cycle to the Time, Date and Alarm
registers (address 0x00 to 0x09).
•
The HTL146818 logic is clocked from the clk input pin and not from the OSC1 input. The OSC1 clock edges are only
used as an enable for the update logic. This means generally that the update time is significantly faster than the
original 146818 device. The worst case update time is 6 clk cycles.
•
Register D is added for compatibility reasons, the VRT bit is not used and will always read back as '1'.
•
The Daylight Saving Mode is not implemented hence the DSE bit in Register B is ignored.
•
The first update after writing "010" to DV2:0 occurs 500msec later.
Vendor |
FPGA Type |
Area |
Fmax (note1) |
P&R |
Actel |
ProASIC3 A3P125-2 |
2022 Tiles (65%) |
110MHz (130MHz) |
Designer 8.1 |
|
Iglo AGL125V2 |
1897 Tiles (62%) |
83MHz (100MHz) |
|
Altera |
CycloneIII EP3C5 |
931 LE (18%) |
240MHz (250MHz) |
Quartus 7.2 |
|
StratixIII EP3SE50-2 |
575 CAluts (2%), 521 Regs(1%) |
271MHz (275MHz |
|
Xilinx |
Spartan3E 3s100 |
261 Slices (27%) |
184MHz (200MHz) |
ISE 9.2i |
|
Virtex5 5VLX30 |
136 SlicesR (1%), 263 SliceL (1%) |
379MHz (380MHz) |
|
Deliverables
The HTL146818 is delivered in synthesisable vendor independent VHDL source code. The source code is fully documented and
can be synthesized using any modern synthesis tool. A self-checking VHDL testbench is included which verifies the different
functions. Software driver examples are provided in assembly (x86 processor family only).
For evaluation the HTL146818 can be supplied on a low-cost FPGA development board from Enterpoint Ltd. The HTL146818 is
instantiated together with the HTL80186 processor, an 8259 Interrupt controller, an 8255 Parallel Interface unit (to drive an
optional HD44780 LCD), a UART and 40Kbyte of SSRAM. No VHDL source files will be supplied in this case.
•
Functional compatible with the 146818 RTC
•
Fully Synchronous with generic
processor/controller interface
•
Counts seconds/minutes/hours/days/day of the
month/day of the week/years
•
Compensates for leap-years up to 2099
•
Binary of BCD Time representation
•
12 or 24 Hour clock with AM/PM indicator
•
Time of Day alarm from once a second up to once
a day
•
Square Wave output with frequencies from
8.192KHz down to 2Hz
•
End of Update Interrupt.
•
Periodic Interrupt from 30.5us up to 500ms
•
Three maskable interrupts
•
50 user Bytes.
•
Clocked from a 32.768KHz oscillator
•
Written in technology independent VHDL
•
Asynchronous reset
•
Lowest cost commercial 146818 compatible core