Project

General

Profile

« Previous | Next » 

Revision 1325

Added by markw almost 4 years ago

sidmax changes. Also silent pokey interference support

View differences:

atari_chips/pokeyv2/convert_secure.cof
<?xml version="1.0" encoding="US-ASCII" standalone="yes"?>
<cof>
<output_filename>output_files/pokeymax.pof</output_filename>
<n_pages>1</n_pages>
<width>1</width>
<mode>14</mode>
<sof_data>
<user_name>Page_0</user_name>
<page_flags>1</page_flags>
<bit0>
<sof_filename>output_files/pokeymax.sof<compress_bitstream>1</compress_bitstream></sof_filename>
</bit0>
</sof_data>
<version>10</version>
<create_cvp_file>0</create_cvp_file>
<create_hps_iocsr>0</create_hps_iocsr>
<auto_create_rpd>0</auto_create_rpd>
<rpd_little_endian>1</rpd_little_endian>
<options>
<map_file>1</map_file>
</options>
<MAX10_device_options>
<por>0</por>
<io_pullup>1</io_pullup>
<config_from_cfm0_only>0</config_from_cfm0_only>
<isp_source>0</isp_source>
<verify_protect>1</verify_protect>
<epof>0</epof>
<ufm_source>2</ufm_source>
<ufm_filepath>../init.hex</ufm_filepath>
</MAX10_device_options>
<advanced_options>
<ignore_epcs_id_check>1</ignore_epcs_id_check>
<ignore_condone_check>2</ignore_condone_check>
<plc_adjustment>0</plc_adjustment>
<post_chain_bitstream_pad_bytes>-1</post_chain_bitstream_pad_bytes>
<post_device_bitstream_pad_bytes>-1</post_device_bitstream_pad_bytes>
<bitslice_pre_padding>1</bitslice_pre_padding>
</advanced_options>
</cof>
atari_chips/pokeyv2/build.sh
#Added like this to the generated qsf
#set_parameter -name TV 1
my $version = "123";
my $version = "000";
my %variants =
(
......
"cs0_bit" => 0, #force low
"version" => $version . "M02SA"
},
# "10M02_stereo_u1mb_auto" =>
# {
# "pokeys" => 2,
# "enable_auto_stereo" => 1,
# "a4_bit" => 1,
# "fancy_switch_bit" => 2,
# "gtia_audio_bit" => 3,
# "fpga" => "10M02SCU169C8G",
# "version" => $version . "M02SU"
# },
# "10M02_mark" =>
# {
# "pokeys" => 1,
# "enable_auto_stereo" => 1,
# "enable_covox" => 0,
# "a4_bit" => 1,
# "a7_bit" => 2,
# "gtia_audio_bit" => 3,
# "fpga" => "10M02SCU169C8G",
# "version" => $version."M02SC"
# },
# "10M02_stereo_covox_auto" =>
# {
# "pokeys" => 2,
# "enable_auto_stereo" => 1,
# "enable_covox" => 1,
# "a4_bit" => 1,
# "a7_bit" => 2,
# "gtia_audio_bit" => 3,
# "fpga" => "10M02SCU169C8G",
# "version" => $version."M02SC"
# },
# "10M02_stereo_covox_no_right_detect" =>
# {
# "pokeys" => 2,
# "enable_auto_stereo" => 0,
# "enable_covox" => 1,
# "detect_right_on_by_default" => 0,
# "a4_bit" => 1,
# "a7_bit" => 2,
# "gtia_audio_bit" => 3,
# "fpga" => "10M02SCU169C8G",
# "version" => $version."M02SC"
# },
"10M02_mono_linear" =>
{
"saturate_on_by_default" => 0,
"pokeys" => 1,
"fpga" => "10M02SCU169C8G",
"enable_auto_stereo" => 1,
"gtia_audio_bit" => 3,
"a4_bit" => 1, #to access config!
"version" => $version . "M02MO"
},
"10M02_stereo_xel_auto_linear" =>
{
"saturate_on_by_default" => 0,
"pokeys" => 2,
"enable_auto_stereo" => 1,
"a4_bit" => 1,
"cs1_bit" => 20,
"gtia_audio_bit" => 3,
"fpga" => "10M02SCU169C8G",
"version" => $version . "M02SX"
},
"10M02_stereo_covox_no_right_detect_linear" =>
{
"saturate_on_by_default" => 0,
"pokeys" => 2,
"enable_auto_stereo" => 0,
"enable_covox" => 1,
"detect_right_on_by_default" => 0,
"a4_bit" => 1,
"a7_bit" => 2,
"gtia_audio_bit" => 3,
"fpga" => "10M02SCU169C8G",
"version" => $version."M02SC"
},
"10M02_stereo_auto_linear" =>
{
"saturate_on_by_default" => 0,
"pokeys" => 2,
"enable_auto_stereo" => 1,
"a4_bit" => 1,
"gtia_audio_bit" => 3,
"fpga" => "10M02SCU169C8G",
"version" => $version . "M02SA"
},
"10M02_stereo_u1mb_auto_linear" =>
{
"saturate_on_by_default" => 0,
"pokeys" => 2,
"enable_auto_stereo" => 1,
"a4_bit" => 1,
"fancy_switch_bit" => 2,
"gtia_audio_bit" => 3,
"fpga" => "10M02SCU169C8G",
"version" => $version . "M02SU"
},
"10M02_stereo_covox_auto_linear" =>
{
"saturate_on_by_default" => 0,
"pokeys" => 2,
"enable_auto_stereo" => 1,
"enable_covox" => 1,
"a4_bit" => 1,
"a7_bit" => 2,
"gtia_audio_bit" => 3,
"fpga" => "10M02SCU169C8G",
"version" => $version."M02SC"
},
"10M02_mono" =>
{
"pokeys" => 1,
"fpga" => "10M02SCU169C8G",
"enable_auto_stereo" => 1,
"gtia_audio_bit" => 3,
"a4_bit" => 1, #to access config!
"version" => $version . "M02MO"
},
"10M02_stereo_xel_auto" =>
{
"pokeys" => 2,
"enable_auto_stereo" => 1,
"a4_bit" => 1,
"cs1_bit" => 20,
"gtia_audio_bit" => 3,
"fpga" => "10M02SCU169C8G",
"version" => $version . "M02SX"
},
"10M02_stereo_covox_no_right_detect" =>
{
"pokeys" => 2,
"enable_auto_stereo" => 0,
"enable_covox" => 1,
"detect_right_on_by_default" => 0,
"a4_bit" => 1,
"a7_bit" => 2,
"gtia_audio_bit" => 3,
"fpga" => "10M02SCU169C8G",
"version" => $version."M02SC"
},
"10M02_stereo_auto" =>
{
"pokeys" => 2,
"enable_auto_stereo" => 1,
"a4_bit" => 1,
"gtia_audio_bit" => 3,
"fpga" => "10M02SCU169C8G",
"version" => $version . "M02SA"
},
"10M02_stereo_u1mb_auto" =>
{
"pokeys" => 2,
"enable_auto_stereo" => 1,
"a4_bit" => 1,
"fancy_switch_bit" => 2,
"gtia_audio_bit" => 3,
"fpga" => "10M02SCU169C8G",
"version" => $version . "M02SU"
},
"10M02_stereo_covox_auto" =>
{
"pokeys" => 2,
"enable_auto_stereo" => 1,
"enable_covox" => 1,
"a4_bit" => 1,
"a7_bit" => 2,
"gtia_audio_bit" => 3,
"fpga" => "10M02SCU169C8G",
"version" => $version."M02SC"
},
"10M04_mono" =>
{
"pokeys" => 1,
......
"fpga" => "10M08SCU169C8G",
"version" => $version . "M08SS"
},
"sidmax_10M08_full" =>
{
"pokeys" => 2,
"enable_auto_stereo" => 1,
"enable_flash" => 1,
"enable_psg" => 1,
"enable_covox" => 1,
"enable_sample" => 1,
"ext_bits"=> 4,
"bus" => "c64",
"a5_bit" => 1, #STEREO
"a6_bit" => 2,
"a7_bit" => 3,
"irq_bit" => 4,
#"a6_bit" => 20, #force high
#"a7_bit" => 0, #force low
"type" => "sidmax",
"board" => "v1",
#"cs1_bit" => 20, #force high
"fpga" => "10M08SCU169C8G",
"version" => $version . "S08HK"
},
"10M08_stereo_u1mb_auto" =>
{
"pokeys" => 2,
......
my $fpga = $variants{$variant}->{"fpga"};
my $flashver = $fpga;
$flashver =~ s/..M(..).*/$1/;
if (not exists $variants{$variant}->{"type"})
{
$variants{$variant}->{"type"} = "pokeymax";
}
my $type = $variants{$variant}->{"type"};
my $board = $variants{$variant}->{"board"};
my $bus = $variants{$variant}->{"bus"};
......
`cp *.vhd* $dir`;
`cp iox_glue.vhdl $dir/iox_glue.vhdl`;
`cp pokeymax.vhd $dir/pokeymax.vhd`;
`cp iox_glue$board.vhdl $dir/iox_glue.vhdl`;
`cp pokeymax$board.vhd $dir/pokeymax.vhd`;
`cp $type$board.vhd $dir/$type.vhd`;
`cp $type$board.qsf $dir/$type.qsf`;
`cp slave_timing_6502$bus.vhd $dir/slave_timing_6502.vhd`;
`cp swapbits $dir`;
`cp pokeymax*.sdc $dir`;
`cp pokeymax*.qpf $dir`;
`cp pokeymax$board.qsf $dir/pokeymax.qsf`;
`cp $type*.sdc $dir`;
`cp $type*.qpf $dir`;
`cp -r int_osc* $dir`;
`cp -r pll* $dir`;
`cp -r lvds* $dir`;
`cp -r flash_$flashver/flash* $dir`;
`cp -r PSG $dir`;
`cp -r SID $dir`;
......
chdir $dir;
`echo set_global_assignment -name DEVICE $fpga >> pokeymax.qsf`;
`echo set_global_assignment -name DEVICE $fpga >> $type.qsf`;
foreach my $key (sort keys %{$variants{$variant}})
{
my $val = $variants{$variant}->{$key};
`echo 'set_parameter -name $key $val' >> pokeymax.qsf`;
`echo 'set_parameter -name $key $val' >> $type.qsf`;
}
if (exists $variants{$variant}->{"optimisearea"})
{
`echo 'set_global_assignment -name CYCLONEII_OPTIMIZATION_TECHNIQUE AREA' >>pokeymax.qsf`;
`echo 'set_global_assignment -name CYCLONEII_OPTIMIZATION_TECHNIQUE AREA' >>$type.qsf`;
}
`quartus_sh --flow compile pokeymax > build.log 2> build.err`;
`quartus_cpf --convert ../convert_secure.cof`;
`../modifypof_$flashver ./output_files/pokeymax.pof`;
`quartus_cpf -c -q 10MHz -g 3.3 -n p output_files/pokeymax.pof output_files/pokeymax.svf`;
`../makeflash_$flashver ./output_files/pokeymax.pof $versioncode output_files/core.bin`;
`quartus_sh --flow compile $type > build.log 2> build.err`;
`quartus_cpf --convert ../convert_secure_$type.cof`;
`../modifypof_$flashver $type ./output_files/$type.pof`;
`quartus_cpf -c -q 10MHz -g 3.3 -n p output_files/$type.pof output_files/$type.svf`;
`../makeflash_$flashver $type ./output_files/$type.pof $versioncode output_files/core.bin`;
`touch UFM1 UFM0 CFM1 CFM0`;
`../openocd_flash/extractbinfromsvf.pl output_files/pokeymax.svf`;
`../openocd_flash/extractbinfromsvf.pl output_files/$type.svf`;
`cat UFM1.bin UFM0.bin > UFMboth.bin`;
`cat CFM1.bin CFM0.bin > CFMboth.bin`;
atari_chips/pokeyv2/convert_secure_pokeymax.cof
<?xml version="1.0" encoding="US-ASCII" standalone="yes"?>
<cof>
<output_filename>output_files/pokeymax.pof</output_filename>
<n_pages>1</n_pages>
<width>1</width>
<mode>14</mode>
<sof_data>
<user_name>Page_0</user_name>
<page_flags>1</page_flags>
<bit0>
<sof_filename>output_files/pokeymax.sof<compress_bitstream>1</compress_bitstream></sof_filename>
</bit0>
</sof_data>
<version>10</version>
<create_cvp_file>0</create_cvp_file>
<create_hps_iocsr>0</create_hps_iocsr>
<auto_create_rpd>0</auto_create_rpd>
<rpd_little_endian>1</rpd_little_endian>
<options>
<map_file>1</map_file>
</options>
<MAX10_device_options>
<por>0</por>
<io_pullup>1</io_pullup>
<config_from_cfm0_only>0</config_from_cfm0_only>
<isp_source>0</isp_source>
<verify_protect>1</verify_protect>
<epof>0</epof>
<ufm_source>2</ufm_source>
<ufm_filepath>../init.hex</ufm_filepath>
</MAX10_device_options>
<advanced_options>
<ignore_epcs_id_check>1</ignore_epcs_id_check>
<ignore_condone_check>2</ignore_condone_check>
<plc_adjustment>0</plc_adjustment>
<post_chain_bitstream_pad_bytes>-1</post_chain_bitstream_pad_bytes>
<post_device_bitstream_pad_bytes>-1</post_device_bitstream_pad_bytes>
<bitslice_pre_padding>1</bitslice_pre_padding>
</advanced_options>
</cof>
atari_chips/pokeyv2/init.c
buffer[0] |= (irq_en&1)<<3;
buffer[0] |= (detect_right&1)<<4;
buffer[0] |= (pal&1)<<5;
int post_divide = 0b10100000;
int post_divide = 0b10100101;
buffer[1] |= (post_divide&0xff)<<0;
int gtia_enable = 0b1100;
buffer[2] |= (gtia_enable&0xf)<<0;
......
buffer[4] = 0x11; // 6581 filter
buffer[5] = 0xff; // enable_all
buffer[6] = 0x10; // enable_all
// 0x80(0x200 8-bit) adpcm step table - 90
for (i=0x0; i!=89; ++i)
{
atari_chips/pokeyv2/makeflash_04
rm pokeymax.pofswap
TYPE=$1
rm ${TYPE}.pofswap
rm flash2.bin
rm core2.bin
rm version
./swapbits $1 pokeymax.pofswap
dd if=pokeymax.pofswap bs=1 skip=18600 count=16384 of=init2.bin
dd if=pokeymax.pofswap bs=1 skip=118952 count=202752 of=core2.bin
cat init2.bin core2.bin > $3
echo $2 > version
dd conv=notrunc if=version bs=1 count=8 of=$3
./swapbits $2 ${TYPE}.pofswap
dd if=${TYPE}.pofswap bs=1 skip=18600 count=16384 of=init2.bin
dd if=${TYPE}.pofswap bs=1 skip=118952 count=202752 of=core2.bin
cat init2.bin core2.bin > $4
echo $3 > version
dd conv=notrunc if=version bs=1 count=8 of=$4
atari_chips/pokeyv2/makeflash_08
rm pokeymax.pofswap
TYPE=$1
rm ${TYPE}.pofswap
rm flash2.bin
rm core2.bin
rm version
./swapbits $1 pokeymax.pofswap
dd if=pokeymax.pofswap bs=1 skip=2216 count=32768 of=init2.bin
dd if=pokeymax.pofswap bs=1 skip=118952 count=202752 of=core2.bin
cat init2.bin core2.bin > $3
echo $2 > version
dd conv=notrunc if=version bs=1 count=8 of=$3
./swapbits $2 ${TYPE}.pofswap
dd if=${TYPE}.pofswap bs=1 skip=2216 count=32768 of=init2.bin
dd if=${TYPE}.pofswap bs=1 skip=118952 count=202752 of=core2.bin
cat init2.bin core2.bin > $4
echo $3 > version
dd conv=notrunc if=version bs=1 count=8 of=$4
atari_chips/pokeyv2/makeflash_16
#TODO: Probably wrong!
rm pokeymax.pofswap
TYPE=$1
rm ${TYPE}.pofswap
rm flash2.bin
rm core2.bin
rm version
./swapbits $1 pokeymax.pofswap
dd if=pokeymax.pofswap bs=1 skip=4264 count=32768 of=init2.bin
dd if=pokeymax.pofswap bs=1 skip=192680 count=385024 of=core2.bin
cat init2.bin core2.bin > $3
echo $2 > version
dd conv=notrunc if=version bs=1 count=8 of=$3
./swapbits $2 ${TYPE}.pofswap
dd if=${TYPE}.pofswap bs=1 skip=4264 count=32768 of=init2.bin
dd if=${TYPE}.pofswap bs=1 skip=192680 count=385024 of=core2.bin
cat init2.bin core2.bin > $4
echo $3 > version
dd conv=notrunc if=version bs=1 count=8 of=$4
atari_chips/pokeyv2/modifypof_08
cp $1 pokeymax_orig.pof
TYPE=$1
cp $2 ${TYPE}_orig.pof
./swapbits sidwavedata.bin sidwavedata_swap.bin
dd if=sidwavedata_swap.bin bs=1 seek=256168 count=65536 of=$1 conv=notrunc
truncate -s -2 $1
HASHCODE=`../rehashr/rehash $1 -norecur -none -fcs16 | grep FCS | sed -e 's/.*:\s*//'`
../addhash.pl $1 $HASHCODE
dd if=sidwavedata_swap.bin bs=1 seek=256168 count=65536 of=$2 conv=notrunc
truncate -s -2 $2
HASHCODE=`../rehashr/rehash $2 -norecur -none -fcs16 | grep FCS | sed -e 's/.*:\s*//'`
../addhash.pl $2 $HASHCODE
atari_chips/pokeyv2/modifypof_16
#TODO probably wrong
cp $1 pokeymax_orig.pof
TYPE=$1
cp $2 ${TYPE}_orig.pof
./swapbits sidwavedata.bin sidwavedata_swap.bin
dd if=sidwavedata_swap.bin bs=1 seek=479400 count=65536 of=$1 conv=notrunc
truncate -s -2 $1
HASHCODE=`../rehashr/rehash $1 -norecur -none -fcs16 | grep FCS | sed -e 's/.*:\s*//'`
../addhash.pl $1 $HASHCODE
dd if=sidwavedata_swap.bin bs=1 seek=479400 count=65536 of=$2 conv=notrunc
truncate -s -2 $2
HASHCODE=`../rehashr/rehash $2 -norecur -none -fcs16 | grep FCS | sed -e 's/.*:\s*//'`
../addhash.pl $2 $HASHCODE
atari_chips/pokeyv2/pokeymax.sdc
create_clock -period 1.9MHz [get_ports PHI2]
create_clock -period 85MHz [get_ports CLK_SLOW]
create_clock -period 87.36MHz [get_ports CLK_SLOW]
derive_pll_clocks
derive_clock_uncertainty
atari_chips/pokeyv2/pokeymax.vhd
fancy_switch_bit : integer := 20; -- 0=ext is low => mono
gtia_audio_bit : integer := 0; -- 0=no gtia on l/r,1=gtia mixed on l/r
detect_right_on_by_default : integer := 1;
saturate_on_by_default : integer := 1;
a4_bit : integer := 0;
a5_bit : integer := 0;
a6_bit : integer := 0;
......
SIGNAL POKEY_WRITE_ENABLE : STD_LOGIC_VECTOR(3 downto 0);
SIGNAL SID_WRITE_ENABLE : STD_LOGIC_VECTOR(1 downto 0);
SIGNAL SID_READ_ENABLE : STD_LOGIC_VECTOR(1 downto 0);
SIGNAL PSG_WRITE_ENABLE : STD_LOGIC_VECTOR(1 downto 0);
......
signal SIO_TXD : std_logic;
signal SIO_RXD : std_logic;
signal SIO_RXD_SYNC : std_logic;
signal POKEY_IRQ : std_logic_vector(3 downto 0);
......
ENABLE => SID_CLK_ENABLE, --1MHz
WRITE_ENABLE => SID_WRITE_ENABLE(0),
READ_ENABLE => SID_READ_ENABLE(0),
ADDR => ADDR_IN(4 downto 0),
DI => WRITE_DATA(7 downto 0),
DO => SID_DO(0),
......
--EXTFILTER_EN => '0',
AUDIO => SID_AUDIO(0),
SIDTYPE => SID_FILTER1_REG,
SIDTYPE => SID_FILTER1_REG(0),
EXT => "0"&SID_FILTER1_REG(1),
EXT_ADC => (others=>'0'),
POT_X => '0',
POT_Y => '0',
rom_addr => sid_flash1_addr,
rom_data => flash_do_slow,
rom_request => sid_flash1_romrequest,
......
ENABLE => SID_CLK_ENABLE, --1MHz
WRITE_ENABLE => SID_WRITE_ENABLE(1),
READ_ENABLE => SID_READ_ENABLE(1),
ADDR => ADDR_IN(4 downto 0),
DI => WRITE_DATA(7 downto 0),
DO => SID_DO(1),
......
--EXTFILTER_EN => '0',
AUDIO => SID_AUDIO(1),
SIDTYPE => SID_FILTER2_REG,
SIDTYPE => SID_FILTER2_REG(0),
EXT => "0"&SID_FILTER2_REG(1),
EXT_ADC => (others=>'0'),
POT_X => '0',
POT_Y => '0',
rom_addr => sid_flash2_addr,
rom_data => flash_do_slow,
rom_request => sid_flash2_romrequest,
......
RESTRICT_CAPABILITY_REG
)
variable writereq : std_logic;
variable readreq : std_logic;
variable enable_region : std_logic;
begin
writereq := not(write_n) and request;
readreq := write_n and request;
POKEY_WRITE_ENABLE <= (others=>'0');
SID_WRITE_ENABLE <= (others=>'0');
SID_READ_ENABLE <= (others=>'0');
PSG_WRITE_ENABLE <= (others=>'0');
SAMPLE_WRITE_ENABLE <= '0';
CONFIG_WRITE_ENABLE <= '0';
......
DO_MUX <= SID_DO(0);
DRIVE_DO_MUX <= SID_DRIVE_DO(0);
SID_WRITE_ENABLE(0) <= writereq;
SID_READ_ENABLE(0) <= readreq;
when "0110"|"0111" =>
enable_region := RESTRICT_CAPABILITY_REG(2);
DO_MUX <= SID_DO(1);
DRIVE_DO_MUX <= SID_DRIVE_DO(1);
SID_WRITE_ENABLE(1) <= writereq;
SID_READ_ENABLE(0) <= readreq;
when "1000"|"1001" =>
enable_region := RESTRICT_CAPABILITY_REG(4);
DO_MUX <= SAMPLE_DO;
......
end if;
IRQ_EN_REG <= '0';
CHANNEL_MODE_REG <= '0';
SATURATE_REG <= '1';
if saturate_on_by_default=1 then
SATURATE_REG <= '1';
else
SATURATE_REG <= '0';
end if;
POST_DIVIDE_REG <= "10100000"; -- 1/2 5v, 3/4 1v
GTIA_ENABLE_REG <= "1100"; -- external only
CONFIG_ENABLE_REG <= '0';
......
CH7 => unsigned(SID_AUDIO(1)),
CH8 => unsigned(PSG_AUDIO(0)),
CH9 => unsigned(PSG_AUDIO(1)),
CHA(14 downto 0) => (others=>'0'),
CHA(14 downto 12) => (others=>'0'),
CHA(11) => SIO_RXD_SYNC,
CHA(10 downto 0) => (others=>'0'),
CHA(15) => GTIA_AUDIO,
AUDIO_0_UNSIGNED => AUDIO_0_UNSIGNED,
......
SOD <= '0' when SIO_TXD='0' else 'Z';
SIO_RXD <= SID;
synchronizer_SIO : entity work.synchronizer
port map (clk=>clk, raw=>SID, sync=>SIO_RXD_SYNC);
--1->pin37
atari_chips/pokeyv2/slave_timing_6502c64.vhd
phi2_falling_edge,
phi2_sync,
cs_sync,
phi_addr_reg,
phi_rw_n_reg,
bus_addr,
bus_rw_n,

Also available in: Unified diff