Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- design.vhd
- library IEEE;
- use IEEE.std_logic_1164.all;
- entity d_flipflop_sync is
- port(clock, D : in std_logic;
- Q, Qn : out std_logic);
- end entity d_flipflop_sync;
- architecture d_flipflop_sync_arch of d_flipflop_sync is
- begin
- process(clock)
- begin
- if(clock'event and clock = '1') then
- if(D = '0') then
- Q <= '0';
- Qn <= '1';
- elsif(D = '1') then
- Q <= '1';
- Qn <= '0';
- end if;
- end if;
- end process;
- end architecture d_flipflop_sync_arch;
- -- testbench.vhd
- library IEEE;
- use IEEE.std_logic_1164.all;
- entity d_flipflop_sync_tb is
- end entity d_flipflop_sync_tb;
- architecture d_flipflop_sync_tb_arch of d_flipflop_sync_tb is
- signal clock1, D1, Q1, Qn1 : std_logic;
- begin
- DUT1 : entity work.d_flipflop_sync(d_flipflop_sync_arch)
- port map(clock1, D1, Q1, Qn1);
- CLOCK : process
- begin
- clock1 <= '0'; wait for 10ns;
- clock1 <= '1'; wait for 10ns;
- end process;
- STIMULUS : process
- begin
- D1 <= '0'; wait for 10ns;
- D1 <= '0'; wait for 10ns;
- D1 <= '1'; wait for 10ns;
- D1 <= '1'; wait for 10ns;
- D1 <= 'X'; wait for 10ns;
- D1 <= 'X'; wait for 10ns;
- end process;
- end architecture d_flipflop_sync_tb_arch;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement