|
设计要求:用两个T触发器 连成 一个计时器,第一个T触发器的Q1输出给第二个T触发器的clk,最后有两个输出Q1,Q2.VHDL语言用子程序的方式写
下面是我的代码,希望高手帮忙修正一下错误。
library ieee;
use ieee.std_logic_1164.all;
package ttt is
procedure ttt_2 (signal clk:in std_logic;
signal q:out std_logic);
end ttt;
package body ttt is
procedure ttt_2(signal clk,d:in std_logic;
signal q:out std_logic) is
begin
d<=not q;
if clk'event and clk ='1'
then q<= d;
end if;
end ttt_2;
end ttt;
library ieee;
use ieee.std_logic_1164.all;
use work.ttt.all;
entity lbjs is
port(clk2:in std_logic;
q1,q2:out std_logic);
end;
architecture bhv of lbjs is
signal clk3:in std_logic;
begin
ttt_2(clk2,q1);
ttt_2(clk3,q2);
clk3<=q1;
end ; |
|