正文

语法说明2007-05-28 13:25:00

【评论】 【打印】 【字体: 】 本文链接:http://blog.pfan.cn/vfdff/26226.html

分享到:

-- 信号扩展:把一个小于"101"的高电平信号扩展成一个"101"周期的信号(间距大于"101"周期)-- 若在把这个信号经过边沿检测,那么这个就实现把一次高电平扩展成一个"101"周期的信号(间距大于"101"周期)) -- 区别在于,上面的高电平大于"101"周期时,则每"101"周期扩展一次library ieee;use ieee.std_logic_1164.all;use ieee.std_logic_unsigned.all;use ieee.std_logic_arith.all; entity processs is port(  d : in std_logic;  clk : in std_logic;  q   : out std_logic );end processs;------------------------------ architecture vr1 of processs is signal cn : std_logic_vector(2 downto 0) := "000";begin p1:process(clk,d) begin  if (clk'event and clk='1')then   if(d='1' and cn="000") then    cn <= "101";       elsif(cn>"001")then    cn <= cn-'1';   else    cn <= "000";   end if;  end if; end process p1;  --q <='0' when(cn ="000") else '1';                                                                                                                                                                                                                                                         '; p2:process(clk) begin  if (clk'event and clk='1')then   if(cn="000")then    q <='0';    else     q <='1';    end if;  end if; end process p2; end vr1; architecture vr2 of processs is signal cn : std_logic_vector(2 downto 0) := "000";begin p1:process(clk,d) begin  if (clk'event and clk='1')then   if(d='1' and cn="000") then    cn <= "101";   elsif(cn>"000")then    cn <= cn-'1';   end if;  end if; end process p1;  p2:process(clk) begin  if (clk'event and clk='1')then   if(cn="000")then    q <='0';    else     q <='1';    end if;  end if; end process p2; end vr2; architecture vr3 of processs is signal cn : std_logic_vector(2 downto 0) := "000";begin p1:process(clk,d) begin  if (clk'event and clk='1')then   if(d='1' and cn="000") then    cn <= "101";   elsif(cn>"000")then    cn <= cn-'1';   end if;  end if; end process p1; q <='0' when cn="000" else '1';  p2:process(clk) begin  if (clk'event and clk='1')then   -- q <='0' when cn="000" else '1'; 不能在进程中  end if; end process p2; end vr3; configuration two_process of processs is for vr2 end for;end two_process;

阅读(3609) | 评论(0)


版权声明:编程爱好者网站为此博客服务提供商,如本文牵涉到版权问题,编程爱好者网站不承担相关责任,如有版权问题请直接与本文作者联系解决。谢谢!

评论

暂无评论
您需要登录后才能评论,请 登录 或者 注册