Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

soc/audio: Align DC toggle with actual data from PCM path #118

Merged
merged 1 commit into from
Nov 15, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion soc/audio/audio_mix.v
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ module audio_mix (
reg [35:0] pa_l;
reg [35:0] pa_r;

reg pcm_ena_1, pcm_ena_2;
reg [15:0] pdm_offset;

// PCM volume
Expand All @@ -93,9 +94,16 @@ module audio_mix (
assign out_l = pa_l[23:8];
assign out_r = pa_r[23:8];

// Align PCM enable
always @(posedge clk)
begin
pcm_ena_1 <= pcm_ena;
pcm_ena_2 <= pcm_ena_1;
end

// Apply variable DC offset for PDM output
always @(*)
if (pcm_ena | force_pdm_offset)
if (pcm_ena_2 | force_pdm_offset)
pdm_offset = 16'h8000;
else if (synth_dc[11:10] != 2'b00)
pdm_offset = 16'h8000;
Expand Down