警报模块
LIBRARY IEEE;
USE IEEE.STD_LOGIC_1164.ALL;
USE IEEE.STD_LOGIC_UNSIGNED.ALL;
ENTITY warn IS
PORT (
count8a : IN STD_LOGIC;
count8b : IN STD_LOGIC;
cp : IN STD_LOGIC;
dididi : OUT STD_LOGIC;
a, b : OUT STD_LOGIC
);
END warn;
ARCHITECTURE a OF warn IS
BEGIN
PROCESS (count8a, count8b)
BEGIN
IF (count8a = '1' OR count8b = '1') THEN
dididi <= CP;
ELSE
dididi <= '0';
END IF;
END PROCESS;
-- process count8a, cp.
PROCESS (count8a, cp)
BEGIN
IF (count8a = '1') THEN
a <= '0';
ELSE
a <= '1';
END IF;
END PROCESS;
-- process count8b, cp.
PROCESS (count8b, cp)
BEGIN
IF (count8b = '1') THEN
b <= '0';
ELSE
b <= '1';
END IF;
END PROCESS;
END a;
顶层文件
VHDL:
LIBRARY ieee;
USE ieee.std_logic_1164.all;
ENTITY qilei IS
PORT (
clk,cr, s : IN STD_LOGIC;
dididi,a,b : OUT STD_LOGIC;
a_8s,a_gewei_50s,a_shiwei50s,b_8s,b_gewei_50s,b_shiwei50s :OUT STD_LOGIC_VECTOR (3 DOWNTO 0));
END qilei;
ARCHITECTURE behaveral OF qilei IS
COMPONENT cnt50s IS
PORT (
clk : IN STD_LOGIC;
cir : IN STD_LOGIC;
en : IN STD_LOGIC;
co : OUT STD_LOGIC;
sunit : OUT STD_LOGIC_VECTOR (3 DOWNTO 0);
stent : OUT STD_LOGIC_VECTOR (3 DOWNTO 0)
);
END COMPONENT;
COMPONENT cnt8s IS
PORT (
clk : IN STD_LOGIC;
cir