forked from robinsonb5/fpgagen
-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
9 changed files
with
176 additions
and
41 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,5 @@ | ||
set_global_assignment -name VHDL_FILE [file join $::quartus(qip_path) SSP160x.vhd ] | ||
set_global_assignment -name VHDL_FILE [file join $::quartus(qip_path) SSP160x_PKG.vhd ] | ||
set_global_assignment -name VHDL_FILE [file join $::quartus(qip_path) SVP.vhd ] | ||
set_global_assignment -name VHDL_FILE [file join $::quartus(qip_path) dpram_dclk.vhd ] | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
-- Generic dual-port RAM implementation - | ||
-- will hopefully work for both Altera and Xilinx parts | ||
|
||
library ieee; | ||
USE ieee.std_logic_1164.all; | ||
use ieee.numeric_std.all; | ||
|
||
|
||
ENTITY dpram_dclk IS | ||
GENERIC | ||
( | ||
addrbits : integer := 9; | ||
databits : integer := 7 | ||
); | ||
PORT | ||
( | ||
rdaddress : IN STD_LOGIC_VECTOR (addrbits-1 downto 0); | ||
wraddress : IN STD_LOGIC_VECTOR (addrbits-1 downto 0); | ||
rdclock : IN STD_LOGIC := '1'; | ||
wrclock : IN STD_LOGIC := '1'; | ||
data : IN STD_LOGIC_VECTOR (databits-1 downto 0); | ||
wren : IN STD_LOGIC := '0'; | ||
q : OUT STD_LOGIC_VECTOR (databits-1 downto 0) | ||
); | ||
END dpram_dclk; | ||
|
||
architecture arch of dpram_dclk is | ||
|
||
type ram_type is array(natural range ((2**addrbits)-1) downto 0) of std_logic_vector(databits-1 downto 0); | ||
shared variable ram : ram_type; | ||
|
||
begin | ||
|
||
-- Port A | ||
process (rdclock) | ||
begin | ||
if (rdclock'event and rdclock = '1') then | ||
q <= ram(to_integer(unsigned(rdaddress))); | ||
end if; | ||
end process; | ||
|
||
-- Port B | ||
process (wrclock) | ||
begin | ||
if (wrclock'event and wrclock = '1') then | ||
if wren='1' then | ||
ram(to_integer(unsigned(wraddress))) := data; | ||
end if; | ||
end if; | ||
end process; | ||
|
||
|
||
end architecture; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
library IEEE; | ||
use IEEE.STD_LOGIC_1164.ALL; | ||
use IEEE.numeric_std.ALL; | ||
|
||
|
||
entity gen_cart is | ||
port( | ||
reset_n : in std_logic; | ||
MCLK : in std_logic; -- 54MHz | ||
DL_CLK : in std_logic; | ||
|
||
ext_reset_n : in std_logic := '1'; | ||
ext_bootdone : in std_logic := '0'; | ||
ext_data : in std_logic_vector(15 downto 0) := (others => '0'); | ||
ext_data_ack : in std_logic := '0'; | ||
|
||
svp_en : out std_logic | ||
); | ||
|
||
end entity; | ||
|
||
|
||
architecture rtl of gen_cart is | ||
|
||
signal romwr_a : unsigned(23 downto 1); | ||
signal cart_id : std_logic_vector(87 downto 0); | ||
|
||
function to_slv(s: string) return std_logic_vector is | ||
constant ss: string(1 to s'length) := s; | ||
variable rval: std_logic_vector(1 to 8 * s'length); | ||
variable p: integer; | ||
variable c: integer; | ||
begin | ||
for i in ss'range loop | ||
p := 8 * i; | ||
c := character'pos(ss(i)); | ||
rval(p - 7 to p) := std_logic_vector(to_unsigned(c,8)); | ||
end loop; | ||
return rval; | ||
end function; | ||
|
||
begin | ||
|
||
process (DL_CLK) begin | ||
if rising_edge( DL_CLK ) then | ||
if ext_reset_n = '0' then | ||
romwr_a <= (others => '0'); | ||
svp_en <= '0'; | ||
elsif ext_data_ack = '1' then | ||
romwr_a <= romwr_a + 1; | ||
if(romwr_a = 384/2) then cart_id(87 downto 72) <= ext_data; end if; | ||
if(romwr_a = 386/2) then cart_id(71 downto 56) <= ext_data; end if; | ||
if(romwr_a = 388/2) then cart_id(55 downto 40) <= ext_data; end if; | ||
if(romwr_a = 390/2) then cart_id(39 downto 24) <= ext_data; end if; | ||
if(romwr_a = 392/2) then cart_id(23 downto 8) <= ext_data; end if; | ||
if(romwr_a = 394/2) then cart_id( 7 downto 0) <= ext_data(15 downto 8); end if; | ||
elsif ext_bootdone = '1' then | ||
if (cart_id(63 downto 0) = to_slv("MK-1229 ")) then svp_en <= '1'; -- Virtua Racing EU/US | ||
elsif(cart_id(63 downto 0) = to_slv("G-7001 ")) then svp_en <= '1'; -- Virtua Racing JP | ||
end if; | ||
end if; | ||
end if; | ||
end process; | ||
|
||
end rtl; |