OpenCores
URL https://opencores.org/ocsvn/idea/idea/trunk

Subversion Repositories idea

[/] [idea/] [trunk/] [fsm/] [main control/] [register.fsm] - Blame information for rev 9

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 6 marta
-- File Name    : register.fsm
2
-- Description  : finite state mechine description of register block
3
-- Author       : Sigit Dewantoro
4
-- Date         : July 3rd, 2001
5
 
6
entity ecb is
7
PORT (
8
        a               : in BIT;
9
        clk             : in BIT;
10
        cke             : in BIT;
11
        clr             : in BIT;
12
        en              : in BIT;
13
        b               : out BIT
14
     );
15
end ecb;
16
 
17
architecture STATE_MACHINE of ecb is
18
        type STATE_TYPE is (S0, S1, S2, S3);
19
 
20
        -- pragma CLOCK clk
21
        -- pragma CURRENT_STATE CURRENT_STATE
22
        -- pragma NEXT_STATE NEXT_STATE
23
 
24
        signal CURRENT_STATE, NEXT_STATE : STATE_TYPE;
25
 
26
        begin
27
        process (CURRENT_STATE, en, clr, cke)
28
                begin
29
                if (clr or en) then
30
                        NEXT_STATE <= S0;
31
 
32
                else
33
 
34
                case CURRENT_STATE is
35
 
36
        -- ***********************************************************************
37
 
38
                when S0 =>
39
                if clr then
40
                        NEXT_STATE <= S1;
41
                        b <= '0';
42
                else
43
                        if cke then
44
                                NEXT_STATE <= S2;
45
                                b <= a;
46
                        end if;
47
                end if;
48
 
49
        -- ***********************************************************************
50
 
51
                when S1 =>
52
                NEXT_STATE <= S3;
53
 
54
        -- ***********************************************************************
55
 
56
                when S2 =>
57
                NEXT_STATE <= S3;
58
 
59
                end case;
60
                end if;
61
        end process;
62
 
63
        process(clk)
64
                begin
65
                if(clk = '0' and not clk' stable) then
66
                        CURRENT_STATE <= NEXT_STATE;
67
                end if;
68
       end process;
69
 
70
end STATE_MACHINE;

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.