I'm very new to the world of VHDL programming and I am having issues implementing a frequency divider along with the detection of the edges of a signal. The code consists of 6 button inputs in which each one will operate and outputting pulse at 1KHz from 50MHz.
The issue I am experimenting as seen in the picture: I'm getting U in every input variable. I have searched the web for multiple frequency dividers but have had no success thus far. Also i am aware of the implementation of a specific way of the code for uploading it to the fpga and another for the simulation in xilinx.
use IEEE.STD_LOGIC_1164.ALL;
use IEEE.NUMERIC_STD.ALL;
use ieee.std_logic_unsigned.all;
entity armmov is
port(
CLK_50MHz: in std_logic;
rst : in std_logic;
BTN1 : in std_logic;
BTN2 : in std_logic;
BTN3 : in std_logic;
BTN4 : in std_logic;
BTN5 : in std_logic;
BTN6 : in std_logic;
PUL1 : out std_logic;
PUL2 : out std_logic;
PUL3 : out std_logic;
PUL4 : out std_logic;
PUL5 : out std_logic;
PUL6 : out std_logic
);
end armmov;
architecture Behavioral of armmov is
signal Counter : integer := 1;
signal CLK_1KHz: std_logic := '0';
begin
process (CLK_50MHz,rst)
begin
if (rst = '1') then
Counter <= 1;
CLK_1KHz <= '0';
elsif(CLK_50MHz'event and CLK_50MHz='1') then
Counter <= Counter + 1;
if (Counter = 25000) then
CLK_1KHz <= NOT CLK_1KHz;
Counter <= 1;
end if;
end if;
end process;
process(CLK_1KHz)
begin
if BTN1='1' then
PUL1<=CLK_1KHz;
else
PUL1 <='0';
end if;
if BTN2='1' then
PUL2<=CLK_1KHz;
else
PUL2 <='0';
end if;
if BTN3='1' then
PUL3<=CLK_1KHz;
else
PUL3 <='0';
end if;
if BTN4='1' then
PUL4<=CLK_1KHz;
else
PUL4 <='0';
end if;
if BTN1='1' then
PUL1<=CLK_1KHz;
else
PUL1<='0';
end if;
if BTN2='1' then
PUL2<=CLK_1KHz;
else
PUL2<='0';
end if;
if BTN3='1' then
PUL3<=CLK_1KHz;
else
PUL3<='0';
end if;
if BTN4='1' then
PUL4<=CLK_1KHz;
else
PUL4<='0';
end if;
if BTN5='1' then
PUL5<=CLK_1KHz;
else
PUL5<='0';
end if;
if BTN6='1' then
PUL6<=CLK_1KHz;
else
PUL6<='0';
end if;
end process;
end Behavioral;