| Line 7... |
Line 7... |
-- : tick for external use.
|
-- : tick for external use.
|
--
|
--
|
-- Register Map:
|
-- Register Map:
|
-- Offset Bitfield Description Read/Write
|
-- Offset Bitfield Description Read/Write
|
-- 0x0 AAAAAAAA Periodic Interval Timer in uS (RW)
|
-- 0x0 AAAAAAAA Periodic Interval Timer in uS (RW)
|
-- 0x1 -AAAAAAA Tenths (0x00 - 0x99) (RW)
|
-- 0x1 -AAAAAAA Tenths (0x00 - 0x63) (RW)
|
-- 0x2 --AAAAAA Seconds (0x00 - 0x59) (RW)
|
-- 0x2 --AAAAAA Seconds (0x00 - 0x3B) (RW)
|
-- 0x3 --AAAAAA Minutes (0x00 - 0x59) (RW)
|
-- 0x3 --AAAAAA Minutes (0x00 - 0x3B) (RW)
|
-- 0x4 ---AAAAA Hours (0x00 - 0x23) (RW)
|
-- 0x4 ---AAAAA Hours (0x00 - 0x17) (RW)
|
-- 0x5 -----AAA Day of Week (0x00 - 0x06) (RW)
|
-- 0x5 -----AAA Day of Week (0x00 - 0x06) (RW)
|
-- 0x6 -------- Update RTC regs from Shadow Regs (WO)
|
-- 0x6 -------- Update RTC regs from Shadow Regs (WO)
|
-- 0x7 A------- Update Shadow Regs from RTC regs (RW)
|
-- 0x7 A------- Update Shadow Regs from RTC regs (RW)
|
-- A = Update is Busy
|
-- A = Update is Busy
|
--
|
|
-- Note that values are stored in packed BCD, not hex
|
|
|
|
|
|
library ieee;
|
library ieee;
|
use ieee.std_logic_1164.all;
|
use ieee.std_logic_1164.all;
|
use ieee.std_logic_unsigned.all;
|
use ieee.std_logic_unsigned.all;
|
use ieee.std_logic_arith.all;
|
use ieee.std_logic_arith.all;
|
| Line 30... |
Line 27... |
library work;
|
library work;
|
use work.open8_pkg.all;
|
use work.open8_pkg.all;
|
|
|
entity o8_rtc is
|
entity o8_rtc is
|
generic(
|
generic(
|
Address : ADDRESS_TYPE;
|
Sys_Freq : real;
|
Reset_Level : std_logic;
|
Reset_Level : std_logic;
|
Sys_Freq : real
|
Address : ADDRESS_TYPE
|
);
|
);
|
port(
|
port(
|
Clock : in std_logic;
|
Clock : in std_logic;
|
Reset : in std_logic;
|
Reset : in std_logic;
|
uSec_Tick : out std_logic;
|
uSec_Tick : out std_logic;
|
| Line 52... |
Line 49... |
);
|
);
|
end entity;
|
end entity;
|
|
|
architecture behave of o8_rtc is
|
architecture behave of o8_rtc is
|
|
|
-- The ceil_log2 function returns the minimum register width required to
|
|
-- hold the supplied integer.
|
|
function ceil_log2 (x : in natural) return natural is
|
|
variable retval : natural;
|
|
begin
|
|
retval := 1;
|
|
while ((2**retval) - 1) < x loop
|
|
retval := retval + 1;
|
|
end loop;
|
|
return retval;
|
|
end ceil_log2;
|
|
|
|
constant User_Addr : std_logic_vector(15 downto 3)
|
constant User_Addr : std_logic_vector(15 downto 3)
|
:= Address(15 downto 3);
|
:= Address(15 downto 3);
|
alias Comp_Addr is Bus_Address(15 downto 3);
|
alias Comp_Addr is Bus_Address(15 downto 3);
|
signal Addr_Match : std_logic;
|
signal Addr_Match : std_logic;
|
|
|
| Line 210... |
Line 195... |
|
|
uSec_Cntr <= uSec_Cntr - 1;
|
uSec_Cntr <= uSec_Cntr - 1;
|
uSec_Tick_i <= '0';
|
uSec_Tick_i <= '0';
|
if( uSec_Cntr = 0 )then
|
if( uSec_Cntr = 0 )then
|
uSec_Cntr <= DLY_1USEC;
|
uSec_Cntr <= DLY_1USEC;
|
uSec_Tick_i <= '1';
|
uSec_Tick_i <= or_reduce(Interval);
|
end if;
|
end if;
|
|
|
pit.timer_ro <= '0';
|
pit.timer_ro <= '0';
|
|
|
rtc.frac_ro <= '0';
|
rtc.frac_ro <= '0';
|