Ignore RTC write.

This commit is contained in:
sorgelig
2018-08-20 19:41:12 +08:00
parent 7d7901932f
commit 4348feb625

View File

@ -105,36 +105,35 @@ begin
end if; end if;
flg := RTC(64); flg := RTC(64);
if RESET = '1' then -- if RESET = '1' then
b_reg <= "00000010"; -- b_reg <= "00000010";
-- RTC register write -- elsif WR = '1' and CS = '1' then
elsif WR = '1' and CS = '1' then -- case A(7 downto 0) is
case A(7 downto 0) is -- when x"00" => seconds_reg <= DI;
when x"00" => seconds_reg <= DI; -- when x"01" => seconds_alarm_reg <= DI;
when x"01" => seconds_alarm_reg <= DI; -- when x"02" => minutes_reg <= DI;
when x"02" => minutes_reg <= DI; -- when x"03" => minutes_alarm_reg <= DI;
when x"03" => minutes_alarm_reg <= DI; -- when x"04" => hours_reg <= DI;
when x"04" => hours_reg <= DI; -- when x"05" => hours_alarm_reg <= DI;
when x"05" => hours_alarm_reg <= DI; -- when x"06" => weeks_reg <= DI;
when x"06" => weeks_reg <= DI; -- when x"07" => days_reg <= DI;
when x"07" => days_reg <= DI; -- when x"08" => month_reg <= DI;
when x"08" => month_reg <= DI; -- when x"09" => year_reg <= DI;
when x"09" => year_reg <= DI; -- when x"0b" => b_reg <= DI;
when x"0b" => b_reg <= DI; --
-- if b_reg(2) = '0' then -- BCD to BIN convertion
if b_reg(2) = '0' then -- BCD to BIN convertion -- if DI(4) = '0' then
if DI(4) = '0' then -- leap_reg <= DI(1 downto 0);
leap_reg <= DI(1 downto 0); -- else
else -- leap_reg <= (not DI(1)) & DI(0);
leap_reg <= (not DI(1)) & DI(0); -- end if;
end if; -- else
else -- leap_reg <= DI(1 downto 0);
leap_reg <= DI(1 downto 0); -- end if;
end if; --
-- when others => null;
when others => null; -- end case;
end case; -- end if;
end if;
if RESET = '1' then if RESET = '1' then
a_reg <= "00100110"; a_reg <= "00100110";
@ -154,7 +153,7 @@ begin
c_reg(5) <= '1'; c_reg(5) <= '1';
end if; end if;
-- DM binary-coded-decimal (BCD) data mode -- DM binary-coded-decimal (BCD) data mode
if b_reg(2) = '0' then --if b_reg(2) = '0' then
if seconds_reg(3 downto 0) /= "1001" then if seconds_reg(3 downto 0) /= "1001" then
seconds_reg(3 downto 0) <= seconds_reg(3 downto 0) + 1; seconds_reg(3 downto 0) <= seconds_reg(3 downto 0) + 1;
else else
@ -231,59 +230,59 @@ begin
end if; end if;
end if; end if;
-- DM binary data mode -- DM binary data mode
else -- else
if seconds_reg /= x"3B" then -- if seconds_reg /= x"3B" then
seconds_reg <= seconds_reg + 1; -- seconds_reg <= seconds_reg + 1;
else -- else
seconds_reg <= (others => '0'); -- seconds_reg <= (others => '0');
if minutes_reg /= x"3B" then -- if minutes_reg /= x"3B" then
minutes_reg <= minutes_reg + 1; -- minutes_reg <= minutes_reg + 1;
else -- else
minutes_reg <= (others => '0'); -- minutes_reg <= (others => '0');
if b_reg(1) & hours_reg(7) & hours_reg(3 downto 0) = "001100" then -- if b_reg(1) & hours_reg(7) & hours_reg(3 downto 0) = "001100" then
hours_reg(7 downto 0) <= "10000001"; -- hours_reg(7 downto 0) <= "10000001";
elsif ((b_reg(1) & hours_reg(7) & hours_reg(3 downto 0) /= "011100") and -- elsif ((b_reg(1) & hours_reg(7) & hours_reg(3 downto 0) /= "011100") and
(b_reg(1) & hours_reg(4 downto 0) /= "110111")) then -- (b_reg(1) & hours_reg(4 downto 0) /= "110111")) then
hours_reg(4 downto 0) <= hours_reg(4 downto 0) + 1; -- hours_reg(4 downto 0) <= hours_reg(4 downto 0) + 1;
else -- else
if b_reg(1) = '0' then -- if b_reg(1) = '0' then
hours_reg(7 downto 0) <= "00000001"; -- hours_reg(7 downto 0) <= "00000001";
else -- else
hours_reg <= (others => '0'); -- hours_reg <= (others => '0');
end if; -- end if;
if weeks_reg /= x"07" then -- if weeks_reg /= x"07" then
weeks_reg <= weeks_reg + 1; -- weeks_reg <= weeks_reg + 1;
else -- else
weeks_reg <= x"01"; -- Sunday = 1 -- weeks_reg <= x"01"; -- Sunday = 1
end if; -- end if;
if ((month_reg & days_reg & leap_reg = X"021C" & "01") or -- if ((month_reg & days_reg & leap_reg = X"021C" & "01") or
(month_reg & days_reg & leap_reg = X"021C" & "10") or -- (month_reg & days_reg & leap_reg = X"021C" & "10") or
(month_reg & days_reg & leap_reg = X"021C" & "11") or -- (month_reg & days_reg & leap_reg = X"021C" & "11") or
(month_reg & days_reg & leap_reg = X"021D" & "00") or -- (month_reg & days_reg & leap_reg = X"021D" & "00") or
(month_reg & days_reg = X"041E") or -- (month_reg & days_reg = X"041E") or
(month_reg & days_reg = X"061E") or -- (month_reg & days_reg = X"061E") or
(month_reg & days_reg = X"091E") or -- (month_reg & days_reg = X"091E") or
(month_reg & days_reg = X"0B1E") or -- (month_reg & days_reg = X"0B1E") or
( days_reg = X"1F")) then -- ( days_reg = X"1F")) then
days_reg <= x"01"; -- days_reg <= x"01";
if month_reg /= x"0C" then -- if month_reg /= x"0C" then
month_reg <= month_reg + 1; -- month_reg <= month_reg + 1;
else -- else
month_reg <= x"01"; -- month_reg <= x"01";
leap_reg(1 downto 0) <= leap_reg(1 downto 0) + 1; -- leap_reg(1 downto 0) <= leap_reg(1 downto 0) + 1;
if year_reg /= x"63" then -- if year_reg /= x"63" then
year_reg <= year_reg + 1; -- year_reg <= year_reg + 1;
else -- else
year_reg <= x"00"; -- year_reg <= x"00";
end if; -- end if;
end if; -- end if;
else -- else
days_reg <= days_reg + 1; -- days_reg <= days_reg + 1;
end if; -- end if;
end if; -- end if;
end if; -- end if;
end if; -- end if;
end if; -- end if;
end if; end if;
end if; end if;
end if; end if;