Comments (9)
from hdmi.
from hdmi.
from hdmi.
Hi Jan, just wanted to give you an update on this -- I've completed a full first pass on audio and am planning on testing things out today.
I'm also looking for some feedback from you on the ideal paradigm for sending audio / other packet data, since you have a real-world use case.
The way I have it set up right now is:
- The HDMI module will output a clk_packet that rises at the same time as clk_pixel, every time a new packet is going to be transmitted (every 32 pixels before the video frame is sent)
- Use an 8-bit select to choose which packet type you intend to transmit (i.e. 0 for NULL, 1 for audio clock regeneration, 2 for audio samples, etc. listed in HDMI spec)
- If sending audio samples, send them through the
audio_sample_word
HDMI module input which allows for both left and right channels to be transmitted.
Let me know what you think.
from hdmi.
Hi Jan,
Sorry for the delay, I just got the audio working on my end. I had to write a bunch of testbenches to correct logic/timing mistakes, and my FPGA's 32kHz oscillator isn't working.
Let me know when you have some time to test things out.
from hdmi.
from hdmi.
Hi Sameer, Sorry for my delay as well. I am quite busy last days. I did’t have time to make progress of my project. But i shortly look to your work and there is a lot work done. Almoust all souce codes are chaged, some are updeted to System Verilog. This is not problem to me. I like System verilog.
Sorry about making so many changes, I was implementing audio in Verilog, but found that unpacked arrays in SystemVerilog would make things a lot more compact and clear.
Could you shortly explain basis of audio implemetation, please. Eg. Audio clock is gerated from pixel clock or i have to create it outside?
Sure -- I'm trying to keep things as simple as possible:
- Audio sample format: signed L-PCM, anywhere from 16-bit up to 24-bit.
- Audio clock: you create it (whether with PLL, or on-board generator) -- can be 32, 44.1, 48, etc. all listed in README
- Sending the samples: keep a circular buffer of samples filled by your audio generator at the rate of audio clock, which will be sent out whenever there is time to send a packet
Here is some example code for sending 16-bit 48 kHz mono audio:
logic clk_original;
logic clk_pixel;
logic clk_tmds;
logic clk_audio;
pll pll(.clk_original(clk_original), .clk_pixel(clk_pixel), .clk_tmds(clk_tmds), .clk_audio(clk_audio));
logic signed [15:0] audio_in = 16'sd0;
@always(posedge clk_audio) // Sawtooth wave generator
begin
audio_in <= audio_in + 16'sd638;
end
// Signed-ness is ignored here
logic packet_enable;
logic [7:0] remaining;
logic [15:0] audio_out;
circular_buffer buffer(.clk_audio(clk_audio), .clk_pixel(clk_pixel), .packet_enable(packet_enable && remaining > 0), .remaining(remaining), .audio_in(audio_in), .audio_out(audio_out));
logic [15:0] audio_sample = 0;
logic [7:0] packet_type;
@always(posedge clk_audio) // Decides when to send audio packets
begin
if (packet_enable) // The output of this clock will decide what kind of packet will be sent
begin
if (remaining > 0)
begin
audio_sample <= audio_out;
packet_type <= 8'h02; // Audio Sample Packet
end
else
begin
packet_type <= 8'h00; // NULL packet -- send nothing since no audio is ready
end
end
logic [23:0] rgb = 24'd0; // black video
logic [15:0] audio_sample_word [1:0] = '{audio_sample, audio_sample}; // Since the L-PCM audio is 2-channel by default, this is mono audio.
// More ports for this module are not listed
hdmi #(.VIDEO_ID_CODE(3), .AUDIO_RATE(48000), .AUDIO_BIT_WIDTH(16)) hdmi(.clk_pixel(clk_pixel), .clk_tmds(clk_tmds), .rgb(rgb), .packet_type(packet_type), .audio_sample_word(audio_sample_word));
Is there still option to use project in backward compatibility with DVI (without audio and other specificies of HDMI), please?
Yes, everything is still backwards compatible. Let me know if anything doesn't make sense.
from hdmi.
I've simplified things a lot now, so there's no need for packet management/buffers anymore.
You simply send the audio and its clock into the HDMI module now, the rest is handled for you.
module yourfpga_top (
output logic [2:0] tmds_p,
output logic tmds_clock_p,
output logic [2:0] tmds_n,
output logic tmds_clock_n,
);
logic clk_original;
logic clk_pixel;
logic clk_tmds;
logic clk_audio;
pll pll(.clk_original(clk_original), .clk_pixel(clk_pixel), .clk_tmds(clk_tmds), .clk_audio(clk_audio));
logic signed [15:0] audio_sample_word = 16'sd0; // Since the L-PCM audio is 2-channel by default, this is mono audio.
@always (posedge clk_audio) // Sawtooth wave generator
audio_sample_word <= audio_sample_word + 16'sd638;
logic [23:0] rgb = 24'd0; // black video
logic [9:0] cx, cy;
hdmi #(.VIDEO_ID_CODE(3), .AUDIO_RATE(48000), .AUDIO_BIT_WIDTH(16)) hdmi(.clk_tmds(clk_tmds), .clk_pixel(clk_pixel), .clk_audio(clk_audio), .rgb(rgb), .audio_sample_word('{audio_sample_word, audio_sample_word}), .tmds_p(tmds_p), .tmds_clock_p(tmds_clock_p), .tmds_n(tmds_n), .tmds_clock_n(tmds_clock_n), .cx(cx), .cy(cy));
endmodule
from hdmi.
Closing, discussed over email and resolved issues.
from hdmi.
Related Issues (20)
- Question: Have you successfully produced 4k60 on any board? HOT 1
- LCD Bus Compatible Input HOT 4
- Casting that is used in testbench is not in accordance with LRM HOT 1
- How to use in Spartan 6? How to translate to Verilog? HOT 7
- Works on ULX3S (Lattice ECP5) HOT 13
- sawtooth sound output problem HOT 7
- something wrong in audio HOT 6
- implmenting hdl-util/hdmi on a Spartan Edge Accelerator system HOT 1
- Tang Nano 9K HOT 3
- Need help... HOT 19
- Not apply
- IP-less serializer is not working HOT 1
- Source Product Description Infoframe checksum wrong HOT 1
- Distorted audio when 24bits are used HOT 1
- Can't Synthesis on Vivado 2022 HOT 1
- Incorrect Calculation Formula for N in Audio Regeneration HOT 1
- Potential violation of the HDMI 12 pixel minimum control period HOT 4
- Clarify license HOT 2
- DDR instead of LVDS output. HOT 1
- some information HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from hdmi.