Here is a sawtooth wave I found, i'm trying to get a 400Hz square wave, it compiles, any help will be appreciated. Thanks
library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
use IEEE.STD_LOGIC_ARITH.ALL;
use IEEE.STD_LOGIC_UNSIGNED.ALL;
entity SquareWave is
port (clk : in std_logic;
wave_out : out std_logic_vector(7 downto 0);
reset :in std_logic
);
end SquareWave;
architecture Behavioral of SquareWave is
signal count : integer := 0;
begin
process(clk,reset)
begin
if(reset = '1') then
count <= 0;
elsif(rising_edge(clk)) then
if(count = 10000000000) then
count <= 0;
else
count <= count + 1;
end if;
end if;
end process;
wave_out <= conv_std_logic_vector(count,8);
end Behavioral;