Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

Need some help-PwmAudio in VHDL

Status
Not open for further replies.

yuly330

Newbie level 1
Joined
May 31, 2019
Messages
1
Helped
0
Reputation
0
Reaction score
0
Trophy points
1
Activity points
14
Hello to all, I'm new here and I have some problems with the understanding of a piece of VHDL code and I will be very happy if someone could help me to understand it. I had found a tutorial on internet about how to create a VHDL PWM audio generator, and I don't understand this piece of code:

Code VHDL - [expand]
1
2
3
4
5
6
7
8
9
10
11
process(CLK100MHZ)
begin
    if rising_edge(CLK100MHZ) then
        if sine_count = sine_freq then
            lut_addr <= lut_addr + 1;
            sine_count <= (others => '0');
        else
            sine_count <= sine_count + 1;
        end if;
    end if;
end process;


From this project:View attachment PWMDriver.txtView attachment PWMAudio.txt
Thank you in advance!
 
Last edited by a moderator:

This is simply incrementing a counter from 0 to "sine _freq". When it reaches "sine_freq" it increments "lut_addr" and resets the counter and starts over again.

My guess is that it iw using "lut_addr" to index data in a lookup (sine) table.
 
Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top