Project

General

Profile

« Previous | Next » 

Revision 56

Added by markw over 11 years ago

Antic refresh always takes one original cycle - this fixes turbo mode up to 4x on mcc

View differences:

common/a8core/antic.vhdl
begin
increment_refresh_count <= '0';
refresh_pending_next <= refresh_pending_reg;
refresh_fetch_next <= '0';
refresh_fetch_next <= refresh_fetch_reg;
if (colour_clock_1x = '1') then
if (colour_clock_1x = '1' and hcount_reg(0) = '0') then
refresh_fetch_next <= '0';
-- do pending refresh once we have a spare cycle
if (refresh_pending_reg='1' and (dma_fetch_next='0' or allow_real_dma_next='0') and hcount_reg(0) = '0') then
if (refresh_pending_reg='1' and (dma_fetch_next='0' or allow_real_dma_next='0')) then
refresh_fetch_next <= '1';
refresh_pending_next <= '0';
end if;
-- do scheduled refresh - if block, enable pending one
if (hcount_reg(2 downto 0) = "010" and unsigned(refresh_count_reg)<9) then
if (hcount_reg(2 downto 1) = "01" and unsigned(refresh_count_reg)<9) then
increment_refresh_count <= '1';
refresh_fetch_next <= not(dma_fetch_next);
refresh_pending_next <= dma_fetch_next;
......
end if;
end process;
process(refresh_fetch_next)
begin
end process;
-- nmi handling
-- edge senstive, single cycle is enough (unless cpu disabled or clashes)
-- antic asserts for 2 old cycles - if we stick to that then in turbo mode it fixes most nmi bugs, in normal mode they still exist... which is the goal.
common/a8core/atari800core.vhd
-- ANTIC lightpen
ANTIC_LIGHTPEN : IN std_logic;
ANTIC_REFRESH : out STD_LOGIC; -- 1 cycle high when antic doing refresh cycle..., propose locking out for the next 'cycle_length'
ANTIC_REFRESH : out STD_LOGIC; -- 1 'original' cycle high when antic doing refresh cycle...
-----------------------
-- After here all FPGA implementation specific
common/a8core/atari800core_simple_sdram.vhd
-- ANTIC
signal ANTIC_LIGHTPEN : std_logic;
signal ANTIC_REFRESH : std_logic;
signal ANTIC_REFRESH_END : std_logic;
signal SDRAM_REFRESH_NEXT : std_logic;
signal SDRAM_REFRESH_REG : std_logic;
-- CARTRIDGE ACCESS
SIGNAL CART_RD4 : STD_LOGIC;
......
-- ANTIC lightpen
ANTIC_LIGHTPEN <= JOY2_n(4) and JOY1_n(4);
-- ANTIC REFRESH - provide hint to SDRAM of a good time to refresh
process(clk,reset_n)
begin
if (reset_n='0') then
SDRAM_REFRESH_REG <= '0';
elsif (clk'event and clk='1') then
SDRAM_REFRESH_REG <= SDRAM_REFRESH_NEXT;
end if;
end process;
process(ANTIC_REFRESH, ANTIC_REFRESH_END, SDRAM_REFRESH_REG)
begin
SDRAM_REFRESH_NEXT <= SDRAM_REFRESH_REG;
if (ANTIC_REFRESH = '1') then
SDRAM_REFRESH_NEXT <= '1';
end if;
if (ANTIC_REFRESH_END = '1') then
SDRAM_REFRESH_NEXT <= '0';
end if;
end process;
refresh_delay : entity work.delay_line
generic map (COUNT=>cycle_length)
port map(clk=>clk,sync_reset=>'0',data_in=>ANTIC_REFRESH,enable=>'1',reset_n=>reset_n,data_out=>ANTIC_REFRESH_END);
SDRAM_REFRESH <= SDRAM_REFRESH_NEXT;
-- GTIA triggers
GTIA_TRIG <= CART_RD5&"1"&JOY2_n(4)&JOY1_n(4);
......
GTIA_TRIG => GTIA_TRIG,
ANTIC_LIGHTPEN => ANTIC_LIGHTPEN,
ANTIC_REFRESH => ANTIC_REFRESH,
ANTIC_REFRESH => SDRAM_REFRESH,
SDRAM_REQUEST => SDRAM_REQUEST,
SDRAM_REQUEST_COMPLETE => SDRAM_REQUEST_COMPLETE,

Also available in: Unified diff