CPLD模块输出自定义
随便写了一个,没综合不知道有没有小错。你这是5个时钟以后一直是1,还是每过5个时钟置1一次?如果是前者,综合器出warnning的可能性很大哦。
library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
-- Uncomment the following library declaration if using
-- arithmetic functions with Signed or Unsigned values
--use IEEE.NUMERIC_STD.ALL;
-- Uncomment the following library declaration if instantiating
-- any Xilinx primitives in this code.
--library UNISIM;
--use UNISIM.VComponents.all;
entity EX is
PORT(
clk_50 :IN STD_LOGIC; --输入主频
pin_out :OUT STD_LOGIC; --输出管脚
);
end EX;
architecture Behavioral of EX is
SIGNAL output_reg:STD_LOGIC:='0';
BEGIN
PROCESS
VARIABLE cnt: INTEGER RANGE 0 to 5;
BEGIN
WAIT UNTIL(RISING_EDGE(clk_50));
IF cnt=5 THEN
cnt:=0;
output_reg<='1';
ELSE
cnt:=cnt+1;
END IF;
END PROCESS;
pin_out<= output_reg;
end Behavioral;
非常感谢!