
Untitled
By:
tristanseifert on
Jul 15th, 2012 | syntax:
VHDL | size: 1.98 KB | hits: 18 | expires: Never
library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
use IEEE.STD_LOGIC_ARITH.ALL;
use IEEE.STD_LOGIC_UNSIGNED.ALL;
entity VDP is
-- RAM schits and output to DAC
Port ( RGBOut : out STD_LOGIC_VECTOR (23 downto 0);
RAM_Data: inout STD_LOGIC_VECTOR (31 downto 0);
RAM_Addr: out STD_LOGIC_VECTOR (10 downto 0);
RAM_bank: out STD_LOGIC_VECTOR (1 downto 0);
RAM_CLK : out STD_LOGIC;
RAM_CS : out STD_LOGIC;
RAM_RAS : out STD_LOGIC;
RAM_CAS : out STD_LOGIC;
RAM_WE : out STD_LOGIC;
-- Interface lines from 68k
CS : in STD_LOGIC;
RW : in STD_LOGIC;
AS : in STD_LOGIC;
RESET : in STD_LOGIC;
DMAREQ : out STD_LOGIC;
DTACK : out STD_LOGIC;
CPU_DATA: inout STD_LOGIC_VECTOR (15 downto 0);
CPU_ADDR: inout STD_LOGIC_VECTOR (23 downto 0);
-- Various other I/O moopers
DIPCfg : in STD_LOGIC_VECTOR (3 downto 0);
-- Clocks and various video pulses
PCLK : in STD_LOGIC;
VSync : out STD_LOGIC;
HSync : out STD_LOGIC;
VInt : out STD_LOGIC);
end VDP;
-- The VDP is designed 66.5 MHz pixel clock
architecture Behavioral of VDP is
shared variable pixelCount: integer range 0 to 1355;
shared variable lineCount: integer range 0 to 807;
begin
process(PCLK)
begin
if falling_edge(PCLK) then
pixelCount := pixelCount + 1;
-- Have we reached the right end of the screen?
if (pixelCount = 1024) then
HSync <= '1';
lineCount := lineCount + 1;
end if;
-- Have we completed horizontal blanking?
if (pixelCount = 1354) then
HSync <= '0';
pixelCount := 0;
end if;
-- Have we reached the bottom of the screen?
if (lineCount = 768) then
VSync <= '1';
VInt <= '1';
end if;
-- Have we completed vertical blanking?
if (lineCount = 806) then
VInt <= '0';
VSync <= '0';
lineCount := 0;
pixelCount := 0;
end if;
end if;
end process;
end Behavioral;