这是我的第一个程序,有很多用的不合适地方也请各位大神指出
library ieee;
use ieee.std_logic_1164.all;
use ieee.std_logic_unsigned.all;
entity div is
port(clk: in std_logic;
d: in std_logic_vector(7 downto 0);
fout:out std_logic);
end;
architecture one of div is
signal addcnt1:std_logic_vector(7 downto 0);
signal addcnt2:std_logic_vector(7 downto 0);
signal addcnt:std_logic_vector(7 downto 0);
signal qq:std_logic;
signal cen:std_logic;
begin
jj_one:process(clk)
begin
if d(0)='1' then
if clk'event and clk='1' then
if qq='0'then
addcnt1<=addcnt1+1;
else addcnt1<="00000000";
end if;
end if;
end if;
end process jj_one;
jj_two:process(clk)
begin
if d(0)='1' then
if clk'event and clk='0' then
if qq='0' then
addcnt2<=addcnt2+1;
else addcnt2<="00000000";
end if;
end if;
end if;
end process jj_two;
jj:process(clk)
begin
if d(0)='1' then
if addcnt=d then
cen<=not cen;
qq<='1';
else qq<='0';
end if;
end if;
end process jj;
addcnt<=addcnt1+addcnt2;
fout<=cen;
end one;
时序仿真没有输出,下图: