aboutsummaryrefslogtreecommitdiff
path: root/sem6/dig/m4/ex1.vhdl
blob: 159dfffcb3b42246f3c5671db9cba26517ac55a4 (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
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
-- TEST_START{"inputs": ["clk"], "outputs": [],"teststep": 10, "testin": "101010101010101010101010101010"}TEST_STOP
LIBRARY IEEE;
USE IEEE.STD_LOGIC_1164.all;

ENTITY ex1 IS
    PORT(
            clk: IN STD_LOGIC
        );
END ex1;

ARCHITECTURE impl OF ex1 IS
    SIGNAL seed : STD_LOGIC := '1';
    SIGNAL a : STD_LOGIC := '0';
    SIGNAL first_out : STD_LOGIC := '0';
    SIGNAL b : STD_LOGIC := '0';
    SIGNAL c : STD_LOGIC := '0';
    SIGNAL d : STD_LOGIC := '0';
    SIGNAL lp : STD_LOGIC := '0';

BEGIN
    lp <= c XOR d;
    a <= seed OR first_out;

    flip1 : ENTITY work.dflip
    PORT MAP (
                 d => lp,
                 q => first_out,
                 clk => clk
             );

    flip2 : ENTITY work.dflip
    PORT MAP (
                 d => a,
                 q => b,
                 clk => clk
             );

    flip3 : ENTITY work.dflip
    PORT MAP (
                 d => b,
                 q => c,
                 clk => clk
             );

    flip4 : ENTITY work.dflip
    PORT MAP (
                 d => c,
                 q => d,
                 clk => clk
             );

    process (clk)
    begin
        if (clk = '0' AND seed = '1') then
            seed <= '0';
        end if;
    end process;

END impl;