我对我的 VHDL 代码有疑问。该代码适用于机器人,应该能够检测到地雷。这段代码就是这个特定地雷探测器的代码。Teller_sensor 进程不起作用。我知道,因为它将在 FPGA 芯片上编程,所以你只能有一个时钟。但我不知道该怎么做才能使该过程正常工作。我希望你们愿意帮助我:)
罗伯托
这是代码:
LIBRARY IEEE;
USE IEEE.std_logic_1164.ALL;
use IEEE.numeric_std.all;
library ieee; use ieee.numeric_std.all;
entity metaal_detector is
port (clk : in std_logic;
sensor : in std_logic;
reset : in std_logic;
metaal : out std_logic
);
end entity metaal_detector;
architecture behavioural of metaal_detector is
signal count, count_sensor, stand, clock1, sensor1, stand1 : unsigned (10 downto 0);
signal reset_teller, resets, metaals: std_logic;
begin
teller_clk: process (clk)
begin
if rising_edge(clk) then
if ((reset ='1') or (resets = '1')) then
count <= (others => '0');
else
count <= count + 1;
end if;
end if;
end process;
teller_sensor: process (sensor)
begin
if rising_edge(clk) then
if ((reset ='1') or (resets = '1')) then
count_sensor <= (others => '0');
else
if (sensor'event and sensor='1') then
count_sensor <= count_sensor + 1;
end if;
end if;
end if;
end process;
process(clk)
begin
if (unsigned(clock1) = 71) then
stand <= clock1;
reset_teller <= '1';
else
reset_teller <= '0';
stand <= stand;
end if;
end process;
process(clk)
begin
if (unsigned(stand1) < 70) then
metaals <= '1';
else
metaals <= '0';
end if;
end process;
clock1 <= count;
sensor1 <= count_sensor;
stand1 <= stand;
resets <= reset_teller;
metaal <= metaals;
end architecture behavioural;