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_async is
- port(C, D : in std_logic;
- Q, Qn : out std_logic);
- end entity d_flipflop_async;
- architecture d_flipflop_async_arch of d_flipflop_async is
- begin
- process(C, D)
- begin
- if(C = '0' and D = '0') then
- Q <= Q;
- Q <= Qn;
- elsif(C = '0' and D = '1') then
- Q <= Q;
- Qn <= Qn;
- elsif(C = '1' and D = '0') then
- Q <= '0';
- Qn <= '1';
- elsif(C = '1' and D = '1') then
- Q <= '1';
- Qn <= '0';
- end if;
- end process;
- end architecture d_flipflop_async_arch;
- -- testbench.vhd
- library IEEE;
- use IEEE.std_logic_1164.all;
- entity d_flipflop_async_tb is
- end entity d_flipflop_async_tb;
- architecture d_flipflop_async_tb_arch of d_flipflop_async_tb is
- signal C1, D1, Q1, Qn1 : std_logic;
- begin
- DUT1 : entity work.d_flipflop_async(d_flipflop_async_arch)
- port map(C1, D1, Q1, Qn1);
- STIMULUS : process
- begin
- C1 <= '0'; D1 <= '0'; wait for 10ns;
- C1 <= '0'; D1 <= '1'; wait for 10ns;
- C1 <= '1'; D1 <= '0'; wait for 10ns;
- C1 <= '1'; D1 <= '1'; wait for 10ns;
- C1 <= 'X'; D1 <= 'X'; wait for 10ns;
- end process;
- end architecture d_flipflop_async_tb_arch;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement