Altera_Forum
Honored Contributor
7 years agoAbout My VHDL Task
Hi, as a beginner in VHDL, I like to hear comments and ideas from you.
I have a task to do, my lecturer sent me a code but I couldn't find out. This's the code. -- library ieee; use ieee.std_logic_1164.all; entity singen is port ( clk : in std_logic; q : out std_logic_vector(7 downto 0) ); end entity; architecture rtl of singen is type regtype IS array (0 to 15) of std_logic_vector(7 downto 0); signal reg : regtype := (X"00", X"18", X"2d", X"3b", X"40", X"3b", X"2d", X"18", X"00", X"e8", X"d3", X"c5", X"c0", X"c5", X"d3", X"e8"); signal c : integer range 0 to 15 := 0; begin process begin wait until rising_edge(clk); if (c < 15) then c <= c + 1; else c <= 0; end if; end process; q <= reg(c); end rtl; -- He told me that "Use this file as component in VHDL and create design, where two sinusoidal signals with different frequencies (31250 Hz and 78125 Hz) are summed or subtracted (depending on outside signal)." With this above code how to generate two signals with different frequencies. It's generating only one signal and it's being q. But I don't know how he adjusted its frequency like he desired. Do you guys mind if explaining me? Thanks in advance.