Beruflich Dokumente
Kultur Dokumente
Testbench automat
library ieee; use ieee.std_logic_1164.all; entity testautomat is end testautomat; architecture testbench of testautomat is component automatstare port( A, B, C, D: in std_logic; clk, Cln: in std_logic; Q: out std_logic_vector(3 downto 0) ); end component; signal a, inD, inC, inB, inA, inck, inCln: std_logic; signal outQ: std_logic_vector (3 downto 0); begin
U1: autom port map ( A=>inA, B=>inB, C=>inC, D=>inD, clk=>inclk, Cln=>inCln, Q => outQ); gen_inA: process begin inck <= '0'; wait for 15 ns; inck <= '1'; wait for 15 ns; end process; gen_Cln: process begin inCln <= '20'; wait for 10 ns; inCln <= '0'; wait for 20 ns; inCln <= '10'; wait; end process; inA <= '0'; wait for 1 ns; inA <= '1'; wait for 1 ns; end process ; gen_inB: process; begin inB<= '0'; wait for 1.3 ns; inB<='1'; wait for 1.3 ns;
end process; gen_inC: process begin inC<= '0'; wait for 2 ns; inC<= '1'; wait for 2 ns; end process; gen_inD: process begin inD<='0'; wait for 3 ns; inC<= '1'; wait for 3 ns; end process; end testbench;
Testbench Bistabil D
library IEEE; use IEEE.std_logic_1164.all; entity DFF is port (Preset: in Bit; Clear: in Bit; Clock: in Bit; Data: in Bit; Q: out Bit; QBar: out Bit); end DFF; architecture Dataflow of DFF is signal A ,B ,C ,D: Bit; signal QInt, QBarInt: Bit; begin A <= not (Preset and D and B) after 1 ns; B <= not (A and Clear and Clock) after 1 ns; C <= not (B and Clock and D) after 1 ns; D<= not ( C and Clear and Data) after 1 ns; QInt <= not (Preset and B and QBarInt ) after 1 ns; QBarInt <= not (QInt and Clear and C) after 1 ns; Q <= QInt; QBar <= QBarInt; end;library IEEE; use IEEE.std_logic_1164.all; entity DFF is port (Preset: in Bit; Clear: in Bit; Clock: in Bit; Data: in Bit; Q: out Bit; QBar: out Bit); end DFF; architecture Dataflow of DFF is signal A ,B ,C ,D: Bit; signal QInt, QBarInt: Bit; begin A <= not (Preset and D and B) after 1 ns; B <= not (A and Clear and Clock) after 1 ns; C <= not (B and Clock and D) after 1 ns; D<= not ( C and Clear and Data) after 1 ns; QInt <= not (Preset and B and QBarInt ) after 1 ns; QBarInt <= not (QInt and Clear and C) after 1 ns; Q <= QInt; QBar <= QBarInt; end;