我刚开始学习vhdl代码,我为D型异步触发器编写了这段代码。我应该如何修改我的代码,使其具有第二个D型,第二个的输入是从第一个的输出中提供的。
library ieee;
use ieee.std_logic_1164.all;
entity FLIPFLOP is
port (
clk : in std_logic ;
clr : in std_logic ;
D : in std_logic ;
Q : out std_logic
);
end FLIPFLOP;
architecture behav of FLIPFLOP is
begin
process (clk,clr,D)
begin
if clr = '1' then
Q<= '0';
elsif rising_edge (clk) then
Q<= D;
end if;
end process;
end behav;
答案 0 :(得分:0)
我认为您需要编写一个使用DFF架构的顶级VHDL文件:
entity top is
port (
clk: in std_logic;
clr: in std_logic;
some_input_signal: in std_logic;
some_output_signal: out std_logic
);
end top;
architecture rtl of top is
signal x: std_logic;
begin
e1: entity work.FLIPFLOP
port map (
clk => clk,
clr => clr,
D => some_input_signal,
Q => x );
e2: entity work.FLIPFLOP
port map (
clk => clk,
clr => clr,
D => x,
Q => some_output_signal );
end;
x是第一个DFF输出并输入第二个DFF的信号。