q 声明为 integer, interger 型数据累加到最高后不会反转,而是继续穗谨保持最高值,因此q 需要手动清零,或者声明为 std_logic_vector
LIBRARY ieeeUSE ieee.std_logic_1164.all
USE ieee.std_logic_arith.all
ENTITY fp_11 IS
PORT(clkin:IN std_logic
clkout:OUT std_logic)
END fp_11
ARCHITECTURE behave OF fp_11 IS
signal q1,q2:integer range 0 to 20
signal qq1,qq2:std_logic
begin
process(clkin)
begin
if (clkin'棚斗御event and clkin='1'链岩) then
if (q1=10) then q1<=0
elsif (q1<=5) then
qq1<='销陵0'q1<=q1+1
else qq1<='1'q1<=q1+1
end if
end if
end process
process(clkin)
begin
if (clkin'event and clkin='0') then
if (q2=10) then q2<=0
elsif (q2<=5) then
qq2<='0'q2<=q1+1
else
qq2<='1'q2<=q1+1
end if
end if
end process
clkout<=qq1 nor qq2
END behave
这是产生的方波的程序,供参考。希望对你有用。
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)