summaryrefslogtreecommitdiffstats
path: root/de1/fpga-bbc-pq/master/audio-16bit-48k.patch
diff options
context:
space:
mode:
Diffstat (limited to 'de1/fpga-bbc-pq/master/audio-16bit-48k.patch')
-rw-r--r--de1/fpga-bbc-pq/master/audio-16bit-48k.patch186
1 files changed, 186 insertions, 0 deletions
diff --git a/de1/fpga-bbc-pq/master/audio-16bit-48k.patch b/de1/fpga-bbc-pq/master/audio-16bit-48k.patch
new file mode 100644
index 0000000..315a9fd
--- /dev/null
+++ b/de1/fpga-bbc-pq/master/audio-16bit-48k.patch
@@ -0,0 +1,186 @@
+diff --git a/bbc_micro_de1.vhd b/bbc_micro_de1.vhd
+index 5cc666c..462e507 100644
+--- a/bbc_micro_de1.vhd
++++ b/bbc_micro_de1.vhd
+@@ -437,7 +437,7 @@ component sn76489_top is
+ we_n_i : in std_logic;
+ ready_o : out std_logic;
+ d_i : in std_logic_vector(0 to 7);
+- aout_o : out signed(0 to 7)
++ aout_o : out signed(0 to 15)
+ );
+
+ end component;
+@@ -445,7 +445,7 @@ end component;
+ component i2s_intf is
+ generic(
+ mclk_rate : positive := 12000000;
+- sample_rate : positive := 8000;
++ sample_rate : positive := 48000;
+ preamble : positive := 1; -- I2S
+ word_length : positive := 16
+ );
+@@ -713,7 +713,7 @@ signal keyb_break : std_logic;
+ -- Sound generator
+ signal sound_ready : std_logic;
+ signal sound_di : std_logic_vector(7 downto 0);
+-signal sound_ao : signed(7 downto 0);
++signal sound_ao : signed(15 downto 0);
+ signal pcm_inl : std_logic_vector(15 downto 0);
+ signal pcm_inr : std_logic_vector(15 downto 0);
+
+@@ -938,13 +938,13 @@ begin
+ clock, mhz4_clken,
+ reset_n, '0', sound_enable_n,
+ sound_ready, sound_di,
+- sound_ao
++ sound_ao
+ );
+ i2s : i2s_intf port map (
+ CLOCK_24(0), reset_n,
+ pcm_inl, pcm_inr,
+- std_logic_vector(sound_ao) & "00000000",
+- std_logic_vector(sound_ao) & "00000000",
++ std_logic_vector(sound_ao),
++ std_logic_vector(sound_ao),
+ AUD_XCK, AUD_DACLRCK,
+ AUD_BCLK, AUD_DACDAT, AUD_ADCDAT
+ );
+diff --git a/i2c_loader.vhd b/i2c_loader.vhd
+index 61bdd22..e0a7115 100644
+--- a/i2c_loader.vhd
++++ b/i2c_loader.vhd
+@@ -84,8 +84,8 @@ constant init_regs : regs := (
+ X"0C", X"62",
+ -- Format 16-bit I2S, no bit inversion or phase changes
+ X"0E", X"02",
+- -- Sampling control, 8 kHz USB mode (MCLK = 250fs * 6)
+- X"10", X"0D",
++ -- Sampling control, 48 kHz USB mode (MCLK = 250fs)
++ X"10", X"01",
+ -- Activate
+ X"12", X"01"
+ );
+diff --git a/i2s_intf.vhd b/i2s_intf.vhd
+index 49b6efb..dc00622 100644
+--- a/i2s_intf.vhd
++++ b/i2s_intf.vhd
+@@ -43,7 +43,7 @@ use IEEE.STD_LOGIC_UNSIGNED.ALL;
+ entity i2s_intf is
+ generic(
+ mclk_rate : positive := 12000000;
+- sample_rate : positive := 8000;
++ sample_rate : positive := 48000;
+ preamble : positive := 1; -- I2S
+ word_length : positive := 16
+ );
+diff --git a/sn76489-1.0/sn76489_attenuator.vhd b/sn76489-1.0/sn76489_attenuator.vhd
+index 444064e..a160a05 100644
+--- a/sn76489-1.0/sn76489_attenuator.vhd
++++ b/sn76489-1.0/sn76489_attenuator.vhd
+@@ -53,7 +53,7 @@ entity sn76489_attenuator is
+ port (
+ attenuation_i : in std_logic_vector(0 to 3);
+ factor_i : in signed(0 to 1);
+- product_o : out signed(0 to 7)
++ product_o : out signed(0 to 15)
+ );
+
+ end sn76489_attenuator;
+@@ -83,7 +83,7 @@ begin
+
+ type volume_t is array (natural range 0 to 15) of natural;
+ constant volume_c : volume_t :=
+- (31, 25, 20, 16, 12, 10, 8, 6, 5, 4, 3, 2, 2, 2, 1, 0);
++ ( 1905, 1514, 1202, 955, 758, 602, 479, 380, 302, 240, 191, 151, 120, 95, 76, 0);
+
+ variable attenuation_v : unsigned(attenuation_i'range);
+ variable volume_v : signed(product_o'range);
+diff --git a/sn76489-1.0/sn76489_comp_pack-p.vhd b/sn76489-1.0/sn76489_comp_pack-p.vhd
+index c5fcc90..88c5c23 100644
+--- a/sn76489-1.0/sn76489_comp_pack-p.vhd
++++ b/sn76489-1.0/sn76489_comp_pack-p.vhd
+@@ -18,7 +18,7 @@ package sn76489_comp_pack is
+ port (
+ attenuation_i : in std_logic_vector(0 to 3);
+ factor_i : in signed(0 to 1);
+- product_o : out signed(0 to 7)
++ product_o : out signed(0 to 15)
+ );
+ end component;
+
+@@ -33,7 +33,7 @@ package sn76489_comp_pack is
+ rst_a_i : in std_logic_vector(0 to 3);
+ rst_cnt_i: in std_logic_vector(0 to 9);
+ ff_o : out std_logic;
+- tone_o : out signed(0 to 7)
++ tone_o : out signed(0 to 15)
+ );
+ end component;
+
+@@ -46,7 +46,7 @@ package sn76489_comp_pack is
+ d_i : in std_logic_vector(0 to 7);
+ addr_i : in std_logic_vector(0 to 1);
+ tone3_ff_i : in std_logic;
+- noise_o : out signed(0 to 7)
++ noise_o : out signed(0 to 15)
+ );
+ end component;
+
+@@ -74,7 +74,7 @@ package sn76489_comp_pack is
+ we_n_i : in std_logic;
+ ready_o : out std_logic;
+ d_i : in std_logic_vector(0 to 7);
+- aout_o : out signed(0 to 7)
++ aout_o : out signed(0 to 15)
+ );
+ end component;
+
+diff --git a/sn76489-1.0/sn76489_noise.vhd b/sn76489-1.0/sn76489_noise.vhd
+index 035adab..a19df77 100644
+--- a/sn76489-1.0/sn76489_noise.vhd
++++ b/sn76489-1.0/sn76489_noise.vhd
+@@ -58,7 +58,7 @@ entity sn76489_noise is
+ d_i : in std_logic_vector(0 to 7);
+ addr_i : in std_logic_vector(0 to 1);
+ tone3_ff_i : in std_logic;
+- noise_o : out signed(0 to 7)
++ noise_o : out signed(0 to 15)
+ );
+
+ end sn76489_noise;
+@@ -81,7 +81,7 @@ architecture rtl of sn76489_noise is
+ shift_source_q : std_logic;
+ signal shift_rise_edge_s : boolean;
+
+- signal lfsr_q : std_logic_vector(0 to 7);
++ signal lfsr_q : std_logic_vector(0 to 15);
+
+ signal freq_s : signed(0 to 1);
+
+diff --git a/sn76489-1.0/sn76489_tone.vhd b/sn76489-1.0/sn76489_tone.vhd
+index f1b6885..4421423 100644
+--- a/sn76489-1.0/sn76489_tone.vhd
++++ b/sn76489-1.0/sn76489_tone.vhd
+@@ -60,7 +60,7 @@ entity sn76489_tone is
+ rst_a_i : in std_logic_vector(0 to 3);
+ rst_cnt_i: in std_logic_vector(0 to 9);
+ ff_o : out std_logic;
+- tone_o : out signed(0 to 7)
++ tone_o : out signed(0 to 15)
+ );
+
+ end sn76489_tone;
+diff --git a/sn76489-1.0/sn76489_top.vhd b/sn76489-1.0/sn76489_top.vhd
+index 2f6a01c..512521f 100644
+--- a/sn76489-1.0/sn76489_top.vhd
++++ b/sn76489-1.0/sn76489_top.vhd
+@@ -72,7 +72,7 @@ entity sn76489_top is
+ we_n_i : in std_logic;
+ ready_o : out std_logic;
+ d_i : in std_logic_vector(0 to 7);
+- aout_o : out signed(0 to 7)
++ aout_o : out signed(0 to 15)
+ );
+
+ end sn76489_top;