Revision 124
Added by markw over 11 years ago
| chameleon/atari800core_chameleon.vhd | ||
|---|---|---|
|
LIBRARY work;
|
||
|
|
||
|
entity atari800core_chameleon is
|
||
|
GENERIC
|
||
|
(
|
||
|
TV : integer; -- 1 = PAL, 0=NTSC
|
||
|
VIDEO : integer; -- 1 = RGB, 2 = VGA
|
||
|
COMPOSITE_SYNC : integer; --0 = no, 1 = yes!
|
||
|
SCANDOUBLE : integer -- 1 = YES, 0=NO, (+ later scanlines etc)
|
||
|
);
|
||
|
port
|
||
|
(
|
||
|
-- VGA
|
||
| ... | ... | |
|
signal pause_atari : std_logic;
|
||
|
SIGNAL speed_6502 : std_logic_vector(5 downto 0);
|
||
|
|
||
|
SIGNAL PAL : std_logic;
|
||
|
SIGNAL PAL : std_logic;
|
||
|
SIGNAL COMPOSITE_ON_HSYNC : std_logic;
|
||
|
SIGNAL VGA : std_logic;
|
||
|
|
||
|
-- spi
|
||
|
signal spi_cs_n : std_logic;
|
||
|
signal spi_mosi : std_logic;
|
||
|
signal spi_clk : std_logic;
|
||
|
|
||
|
-- scandoubler
|
||
|
signal half_scandouble_enable_reg : std_logic;
|
||
|
signal half_scandouble_enable_next : std_logic;
|
||
|
signal VIDEO_B : std_logic_vector(7 downto 0);
|
||
|
signal VGA_VS : std_logic;
|
||
|
signal VGA_HS : std_logic;
|
||
|
|
||
|
begin
|
||
|
pal <= '1' when tv=1 else '0';
|
||
|
vga <= '1' when video=2 else '0';
|
||
|
composite_on_hsync <= '1' when composite_sync=1 else '0';
|
||
|
RESET_N <= PLL_LOCKED;
|
||
|
PAL <= '1';
|
||
|
|
||
|
-- disable unused parts
|
||
|
-- sdram
|
||
| ... | ... | |
|
cycle_length => 32,
|
||
|
internal_rom => 1,
|
||
|
internal_ram => 0,
|
||
|
video_bits => 5
|
||
|
video_bits => 8,
|
||
|
palette => 0
|
||
|
)
|
||
|
PORT MAP
|
||
|
(
|
||
| ... | ... | |
|
RESET_N => RESET_N and SDRAM_RESET_N and not(reset_atari),
|
||
|
|
||
|
-- VIDEO OUT - PAL/NTSC, original Atari timings approx (may be higher res)
|
||
|
VIDEO_VS => vga_vs_raw,
|
||
|
VIDEO_HS => vga_hs_raw,
|
||
|
VIDEO_B => blu,
|
||
|
VIDEO_G => grn,
|
||
|
VIDEO_R => red,
|
||
|
VIDEO_VS => VGA_VS_RAW,
|
||
|
VIDEO_HS => VGA_HS_RAW,
|
||
|
VIDEO_B => VIDEO_B,
|
||
|
VIDEO_G => open,
|
||
|
VIDEO_R => open,
|
||
|
|
||
|
-- AUDIO OUT - Pokey/GTIA 1-bit and Covox all mixed
|
||
|
AUDIO_L => audio_l_raw,
|
||
| ... | ... | |
|
);
|
||
|
|
||
|
-- video glue
|
||
|
nHSync <= (VGA_HS_RAW xor VGA_VS_RAW);
|
||
|
nVSync <= (VGA_VS_RAW);
|
||
|
--nHSync <= (VGA_HS_RAW xor VGA_VS_RAW);
|
||
|
--nVSync <= (VGA_VS_RAW);
|
||
|
|
||
|
-- audio glue
|
||
|
dac_left : hq_dac
|
||
| ... | ... | |
|
generic map (COUNT=>32) -- cycle_length
|
||
|
port map(clk=>clk,reset_n=>reset_n,enable_in=>'1',enable_out=>zpu_pokey_enable);
|
||
|
|
||
|
-----
|
||
|
-- scandoubler
|
||
|
-----
|
||
|
process(clk,RESET_N,SDRAM_RESET_N,reset_atari)
|
||
|
begin
|
||
|
if ((RESET_N and SDRAM_RESET_N and not(reset_atari))='0') then
|
||
|
half_scandouble_enable_reg <= '0';
|
||
|
elsif (clk'event and clk='1') then
|
||
|
half_scandouble_enable_reg <= half_scandouble_enable_next;
|
||
|
end if;
|
||
|
end process;
|
||
|
|
||
|
half_scandouble_enable_next <= not(half_scandouble_enable_reg);
|
||
|
|
||
|
scandoubler1: entity work.scandoubler
|
||
|
GENERIC MAP
|
||
|
(
|
||
|
video_bits=>5
|
||
|
)
|
||
|
PORT MAP
|
||
|
(
|
||
|
CLK => CLK,
|
||
|
RESET_N => RESET_N and SDRAM_RESET_N and not(reset_atari),
|
||
|
|
||
|
VGA => vga,
|
||
|
COMPOSITE_ON_HSYNC => composite_on_hsync,
|
||
|
|
||
|
colour_enable => half_scandouble_enable_reg,
|
||
|
doubled_enable => '1',
|
||
|
|
||
|
-- GTIA interface
|
||
|
colour_in => VIDEO_B,
|
||
|
vsync_in => VGA_VS_RAW,
|
||
|
hsync_in => VGA_HS_RAW,
|
||
|
|
||
|
-- TO TV...
|
||
|
R => red,
|
||
|
G => grn,
|
||
|
B => blu,
|
||
|
|
||
|
VSYNC => VGA_VS,
|
||
|
HSYNC => VGA_HS
|
||
|
);
|
||
|
nHSync <= not(VGA_HS);
|
||
|
nVSync <= not(VGA_VS);
|
||
|
|
||
|
end vhdl;
|
||
| chameleon/build.sh | ||
|---|---|---|
|
rm -rf build
|
||
|
mkdir build
|
||
|
cp atari800core_chameleon.vhd build
|
||
|
cp pll.* build
|
||
|
cp zpu_rom.* build
|
||
|
cp atari800core.sdc build
|
||
|
cp atari800core.cdf build
|
||
|
cp chameleon_* build
|
||
|
#!/usr/bin/perl -w
|
||
|
use strict;
|
||
|
|
||
|
mkdir build/common
|
||
|
mkdir build/common/a8core
|
||
|
mkdir build/common/components
|
||
|
mkdir build/common/zpu
|
||
|
cp ../common/a8core/* ./build/common/a8core
|
||
|
cp ../common/components/* ./build/common/components
|
||
|
cp ../common/zpu/* ./build/common/zpu
|
||
|
my $wanted_variant = shift @ARGV;
|
||
|
|
||
|
cd build
|
||
|
../makeqsf ../atari800core.qsf ./common/a8core ./common/components ./common/zpu
|
||
|
#variants...
|
||
|
my $PAL = 1;
|
||
|
my $NTSC = 0;
|
||
|
|
||
|
quartus_sh --flow compile atari800core
|
||
|
my $RGB = 1; # i.e. not scandoubled
|
||
|
my $VGA = 2;
|
||
|
|
||
|
#Added like this to the generated qsf
|
||
|
#set_parameter -name TV 1
|
||
|
|
||
|
my %variants =
|
||
|
(
|
||
|
"PAL_RGB" =>
|
||
|
{
|
||
|
"TV" => $PAL,
|
||
|
"SCANDOUBLE" => 0,
|
||
|
"VIDEO" => $RGB,
|
||
|
"COMPOSITE_SYNC" => 1
|
||
|
},
|
||
|
"PAL_VGA" =>
|
||
|
{
|
||
|
"TV" => $PAL,
|
||
|
"SCANDOUBLE" => 1,
|
||
|
"VIDEO" => $VGA,
|
||
|
"COMPOSITE_SYNC" => 0
|
||
|
},
|
||
|
"PAL_VGA_CS" =>
|
||
|
{
|
||
|
"TV" => $PAL,
|
||
|
"SCANDOUBLE" => 1,
|
||
|
"VIDEO" => $VGA,
|
||
|
"COMPOSITE_SYNC" => 1
|
||
|
},
|
||
|
"NTSC_RGB" =>
|
||
|
{
|
||
|
"TV" => $NTSC,
|
||
|
"SCANDOUBLE" => 0,
|
||
|
"VIDEO" => $RGB,
|
||
|
"COMPOSITE_SYNC" => 1
|
||
|
},
|
||
|
"NTSC_VGA" =>
|
||
|
{
|
||
|
"TV" => $NTSC,
|
||
|
"SCANDOUBLE" => 1,
|
||
|
"VIDEO" => $VGA,
|
||
|
"COMPOSITE_SYNC" => 0
|
||
|
},
|
||
|
"NTSC_VGA_CS" =>
|
||
|
{
|
||
|
"TV" => $NTSC,
|
||
|
"SCANDOUBLE" => 1,
|
||
|
"VIDEO" => $VGA,
|
||
|
"COMPOSITE_SYNC" => 1
|
||
|
}
|
||
|
);
|
||
|
|
||
|
if (not defined $wanted_variant or (not exists $variants{$wanted_variant} and $wanted_variant ne "ALL"))
|
||
|
{
|
||
|
die "Provide variant of ALL or ".join ",",sort keys %variants;
|
||
|
}
|
||
|
|
||
|
foreach my $variant (sort keys %variants)
|
||
|
{
|
||
|
next if ($wanted_variant ne $variant and $wanted_variant ne "ALL");
|
||
|
print "Building $variant\n";
|
||
|
|
||
|
my $dir = "build_$variant";
|
||
|
`rm -rf $dir`;
|
||
|
mkdir $dir;
|
||
|
`cp atari800core_chameleon.vhd $dir`;
|
||
|
`cp *pll*.* $dir`;
|
||
|
`cp *.vhdl $dir`;
|
||
|
`cp chameleon_*.* $dir`;
|
||
|
`cp zpu_rom.vhdl $dir`;
|
||
|
`cp atari800core.sdc $dir`;
|
||
|
`mkdir $dir/common`;
|
||
|
`mkdir $dir/common/a8core`;
|
||
|
`mkdir $dir/common/components`;
|
||
|
`mkdir $dir/common/zpu`;
|
||
|
`cp ../common/a8core/* ./$dir/common/a8core`;
|
||
|
`cp ../common/components/* ./$dir/common/components`;
|
||
|
`cp ../common/zpu/* ./$dir/common/zpu`;
|
||
|
|
||
|
chdir $dir;
|
||
|
`../makeqsf ../atari800core.qsf ./common/a8core ./common/components ./common/zpu`;
|
||
|
|
||
|
foreach my $key (sort keys %{$variants{$variant}})
|
||
|
{
|
||
|
my $val = $variants{$variant}->{$key};
|
||
|
`echo set_parameter -name $key $val >> atari800core.qsf`;
|
||
|
}
|
||
|
|
||
|
`quartus_sh --flow compile atari800core > build.log 2> build.err`;
|
||
|
|
||
|
`quartus_cpf --convert ../output_file.cof`;
|
||
|
|
||
|
chdir "..";
|
||
|
}
|
||
|
|
||
Added scandoubler