aboutsummaryrefslogtreecommitdiff
path: root/sem6/dig/m4/dflip.vhdl
blob: 5f722d3122b4c4fe3f4cf758075629deee2af275 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
LIBRARY IEEE;
USE IEEE.STD_LOGIC_1164.all;

ENTITY dflip IS
    PORT(
            d: IN STD_LOGIC;
            clk: IN STD_LOGIC;
            q: OUT STD_LOGIC;
            nq: OUT STD_LOGIC
        );
END dflip;

ARCHITECTURE impl OF dflip IS
    SIGNAL qi : STD_LOGIC;
BEGIN
    nq <= NOT qi;
    q <= qi;
    PROCESS (clk)
    BEGIN
    -- Check if high edge
        if (clk'event and clk = '1') then
            qi <= d;
        end if;
    END PROCESS;
END IMPL;