Giter Site home page Giter Site logo

Long time test - OK about hdmi HOT 9 CLOSED

hdl-util avatar hdl-util commented on July 16, 2024
Long time test - OK

from hdmi.

Comments (9)

LMN128 avatar LMN128 commented on July 16, 2024 1

from hdmi.

LMN128 avatar LMN128 commented on July 16, 2024 1

from hdmi.

sameer avatar sameer commented on July 16, 2024

from hdmi.

sameer avatar sameer commented on July 16, 2024

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:

  1. 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)
  2. 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)
  3. 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.

sameer avatar sameer commented on July 16, 2024

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.

LMN128 avatar LMN128 commented on July 16, 2024

from hdmi.

sameer avatar sameer commented on July 16, 2024

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.

sameer avatar sameer commented on July 16, 2024

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.

sameer avatar sameer commented on July 16, 2024

Closing, discussed over email and resolved issues.

from hdmi.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.