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

Subversion Repositories idea

[/] [idea/] [trunk/] [fsm/] [main control/] [reg01.fsm] - Blame information for rev 10

Go to most recent revision | Details | Compare with Previous | View Log

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

powered by: WebSVN 2.1.0

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