enterkill
Newbie level 3
Hi, i have a vhdl code here, I'm still missing of a certain part. How do i equate this into the code: When Q hits P, LED lights up and Q stops counting.
code:
library ieee;
use ieee.std._logic_1164.all;
use ieee.numeric_std.all;
entity conveyor is
port ( sensor, reset : in std_logic;
p : in std_logic_vector (4 downto 0);
q : out_std_logic_vector (4 downto 0);
Led_on : out std_logic);
end conveyor
architecture flow of conveyor is
signal count_sig: unsigned (4 downto 0);
begin
process (sensor, reset, Led_on)
begin
if (reset = '0') then
count_sig <= "00000";
Led_on <= "1";
elsif falling_edge (sensor) then
count_sig <= count_sig + 1;
end if;
end process;
q <= std_logic_vector (count_sig);
end flow;
code:
library ieee;
use ieee.std._logic_1164.all;
use ieee.numeric_std.all;
entity conveyor is
port ( sensor, reset : in std_logic;
p : in std_logic_vector (4 downto 0);
q : out_std_logic_vector (4 downto 0);
Led_on : out std_logic);
end conveyor
architecture flow of conveyor is
signal count_sig: unsigned (4 downto 0);
begin
process (sensor, reset, Led_on)
begin
if (reset = '0') then
count_sig <= "00000";
Led_on <= "1";
elsif falling_edge (sensor) then
count_sig <= count_sig + 1;
end if;
end process;
q <= std_logic_vector (count_sig);
end flow;