1 |
6 |
marta |
-- VHDL data flow description generated from `counter`
|
2 |
|
|
-- date : Wed Mar 21 13:35:50 2001
|
3 |
|
|
|
4 |
|
|
|
5 |
|
|
-- Entity Declaration
|
6 |
|
|
|
7 |
|
|
ENTITY counter IS
|
8 |
|
|
PORT (
|
9 |
|
|
ck : in BIT; -- ck
|
10 |
|
|
i : in BIT; -- i
|
11 |
|
|
reset : in BIT; -- reset
|
12 |
|
|
o : out BIT; -- o
|
13 |
|
|
vdd : in BIT; -- vdd
|
14 |
|
|
vss : in BIT -- vss
|
15 |
|
|
);
|
16 |
|
|
END counter;
|
17 |
|
|
|
18 |
|
|
|
19 |
|
|
-- Architecture Declaration
|
20 |
|
|
|
21 |
|
|
ARCHITECTURE VBE OF counter IS
|
22 |
|
|
SIGNAL current_state : REG_VECTOR(2 DOWNTO 0) REGISTER; -- current_state
|
23 |
|
|
SIGNAL current_state_s4 : BIT; -- current_state_s4
|
24 |
|
|
SIGNAL next_state_s4 : BIT; -- next_state_s4
|
25 |
|
|
SIGNAL current_state_s3 : BIT; -- current_state_s3
|
26 |
|
|
SIGNAL next_state_s3 : BIT; -- next_state_s3
|
27 |
|
|
SIGNAL current_state_s2 : BIT; -- current_state_s2
|
28 |
|
|
SIGNAL next_state_s2 : BIT; -- next_state_s2
|
29 |
|
|
SIGNAL current_state_s1 : BIT; -- current_state_s1
|
30 |
|
|
SIGNAL next_state_s1 : BIT; -- next_state_s1
|
31 |
|
|
SIGNAL current_state_s0 : BIT; -- current_state_s0
|
32 |
|
|
SIGNAL next_state_s0 : BIT; -- next_state_s0
|
33 |
|
|
SIGNAL next_state : BIT_VECTOR(2 DOWNTO 0); -- next_state
|
34 |
|
|
|
35 |
|
|
BEGIN
|
36 |
|
|
next_state(0) <= (next_state_s0 OR next_state_s3 OR next_state_s4);
|
37 |
|
|
next_state(1) <= (next_state_s0 OR next_state_s4);
|
38 |
|
|
next_state(2) <= (next_state_s2 OR next_state_s3 OR next_state_s4);
|
39 |
|
|
next_state_s0 <= ((current_state_s0 AND NOT(i)) OR (
|
40 |
|
|
current_state_s1 AND NOT(i)) OR (current_state_s2 AND NOT(i)) OR
|
41 |
|
|
(current_state_s3 AND NOT(i)) OR (current_state_s4
|
42 |
|
|
AND NOT(i)));
|
43 |
|
|
current_state_s0 <= (NOT(current_state(2)) AND current_state(1));
|
44 |
|
|
next_state_s1 <= (current_state_s0 AND i);
|
45 |
|
|
current_state_s1 <= (NOT(current_state(2)) AND NOT(current_state(1)));
|
46 |
|
|
next_state_s2 <= (current_state_s1 AND i);
|
47 |
|
|
current_state_s2 <= (current_state(2) AND NOT(current_state(0)));
|
48 |
|
|
next_state_s3 <= (current_state_s2 AND i);
|
49 |
|
|
current_state_s3 <= (NOT(current_state(1)) AND current_state(0));
|
50 |
|
|
next_state_s4 <= ((current_state_s3 AND i) OR (current_state_s4
|
51 |
|
|
AND i));
|
52 |
|
|
current_state_s4 <= (current_state(2) AND current_state(1));
|
53 |
|
|
label0 : BLOCK ((NOT((ck'STABLE)) AND NOT(ck)) = '1')
|
54 |
|
|
BEGIN
|
55 |
|
|
current_state(0) <= GUARDED (next_state(0) OR reset);
|
56 |
|
|
END BLOCK label0;
|
57 |
|
|
label1 : BLOCK ((NOT((ck'STABLE)) AND NOT(ck)) = '1')
|
58 |
|
|
BEGIN
|
59 |
|
|
current_state(1) <= GUARDED (next_state(1) OR reset);
|
60 |
|
|
END BLOCK label1;
|
61 |
|
|
label2 : BLOCK ((NOT((ck'STABLE)) AND NOT(ck)) = '1')
|
62 |
|
|
BEGIN
|
63 |
|
|
current_state(2) <= GUARDED (next_state(2) AND NOT(reset));
|
64 |
|
|
END BLOCK label2;
|
65 |
|
|
|
66 |
|
|
o <= (current_state_s4 AND NOT(reset));
|
67 |
|
|
END;
|