我做的是一个6分频的程序,如下:
LIBRARY IEEE;
USE IEEE.STD_LOGIC_1164.ALL;
ENTITY div_6 IS
GENERIC( DWITH : INTEGER := 6);
PORT( clkin : IN STD_LOGIC;
clkout: OUT STD_LOGIC
);
END ENTITY;
ARCHITECTURE arc_div_6 OF div_6 IS
SIGNAL temp : INTEGER RANGE DWITH-1 DOWNTO 0;
BEGIN
PROCESS(clkin)
BEGIN
IF(clkin'EVENT AND clkin = '1')THEN
IF( temp = 5 )THEN
temp <= 0;
ELSE
temp <= temp + 1;
END IF;
END IF;
END PROCESS;
PROCESS(temp)
BEGIN
IF temp < DWITH/2 THEN
clkout <= '0';
ELSE
clkout <= '1';
END IF;
END PROCESS;
END ARCHITECTURE;
做功能仿真时波形很正常,但是做时序仿真的时候波形是这样的 |