Closed kazuma-t closed 1 year ago
When using a resolution of 720p and a sampling rate of 44.1kHz, the current calculation formula generates an excessively large value.
The diff with the correct calculation formula is as follows:
--- a/src/hdmi/audio_clock_regeneration_packet.sv +++ b/src/hdmi/audio_clock_regeneration_packet.sv @@ -16,7 +16,7 @@ module audio_clock_regeneration_packet ); // See Section 7.2.3, values derived from "Other" row in Tables 7-1, 7-2, 7-3. -localparam bit [19:0] N = AUDIO_RATE % 125 == 0 ? 20'(16 * AUDIO_RATE / 125) : AUDIO_RATE % 225 == 0 ? 20'(196 * AUDIO_RATE / 225) : 20'(AUDIO_RATE * 16 / 125); +localparam bit [19:0] N = AUDIO_RATE % 125 == 0 ? 20'(16 * AUDIO_RATE / 125) : AUDIO_RATE % 225 == 0 ? 20'(32 * AUDIO_RATE / 225) : 20'(AUDIO_RATE * 16 / 125); localparam int CLK_AUDIO_COUNTER_WIDTH = $clog2(N / 128); localparam bit [CLK_AUDIO_COUNTER_WIDTH-1:0] CLK_AUDIO_COUNTER_END = CLK_AUDIO_COUNTER_WIDTH'(N / 128 - 1);
The modified calculation formula will correctly calculate the value of N, ensuring it falls within the recommended range.
Thanks for finding this, I'll update the repo shortly :)
When using a resolution of 720p and a sampling rate of 44.1kHz, the current calculation formula generates an excessively large value.
The diff with the correct calculation formula is as follows:
The modified calculation formula will correctly calculate the value of N, ensuring it falls within the recommended range.