本帖最后由 izefei 于 2010-7-28 10:41 编辑
小弟想实现如下图所示电路结构(图在程序下方),就是:Clock时钟上升沿到来时,Output就翻转一次。我用了很多方法,可就是用modelsim仿真老是不对,如下是我的一个方法,请路过的大侠们给指点下,或者给小弟一个可行的程序,不胜感激!!!:
library ieee;
use ieee.std_logic_1164.all;
use ieee.numeric_std.all;
use ieee.std_logic_unsigned.all;
entity com is------com实现的是图中com部分,即翻转功能
port(
Input,Clock:in std_logic;
Output: out std_logic
);
end com;
architecture behav of com is
begin
process(Clock)
begin
if(Clock'event and Clock'last_value='0' and Clock='1')then
Output<=not Input;
end if;
end process;
end architecture behav;
library ieee;
use ieee.std_logic_1164.all;
use ieee.numeric_std.all;
use ieee.std_logic_unsigned.all;
entity comup is ---------------comup调用的com进行元件例化
port(
Clock:in std_logic;
Output: out std_logic
);
end comup;
architecture behav of comup is
component com is
port(
Input,Clock:in std_logic;
Output: out std_logic
);
end component;
signal temp:std_logic:='0';
begin
Output<=temp;
com1:com port map(temp,Clock,temp);
end architecture behav; |