Line | |
---|
1 | typedef enum {UN,DEUX,TROIS,QUATRE,CINQ,SIX,SEPT,HUIT,NEUF,DIX} state_t; |
---|
2 | |
---|
3 | module concret(clk); |
---|
4 | input clk; |
---|
5 | |
---|
6 | reg p; |
---|
7 | reg q; |
---|
8 | input i,j; |
---|
9 | state_t reg state; |
---|
10 | |
---|
11 | initial |
---|
12 | begin |
---|
13 | p = 1; |
---|
14 | q = 1; |
---|
15 | state = UN; |
---|
16 | end |
---|
17 | |
---|
18 | always @(posedge clk) |
---|
19 | begin |
---|
20 | case(state) |
---|
21 | UN : |
---|
22 | if(j == 1) |
---|
23 | begin |
---|
24 | state = QUATRE; |
---|
25 | p = 0; |
---|
26 | q = 1; |
---|
27 | end |
---|
28 | else |
---|
29 | if(i == 1) |
---|
30 | begin |
---|
31 | state = SIX; |
---|
32 | p = 1; |
---|
33 | q = 0; |
---|
34 | end |
---|
35 | else |
---|
36 | begin |
---|
37 | state = DEUX; |
---|
38 | p = 1; |
---|
39 | q = 1; |
---|
40 | end |
---|
41 | DEUX: |
---|
42 | begin |
---|
43 | state = TROIS; |
---|
44 | p = 1; |
---|
45 | q = 0; |
---|
46 | end |
---|
47 | // The faulty transition |
---|
48 | TROIS: |
---|
49 | begin |
---|
50 | state = NEUF; |
---|
51 | p = 1; |
---|
52 | q = 1; |
---|
53 | end |
---|
54 | QUATRE: |
---|
55 | begin |
---|
56 | state = CINQ; |
---|
57 | p = 1; |
---|
58 | q = 0; |
---|
59 | end |
---|
60 | CINQ: |
---|
61 | begin |
---|
62 | state = CINQ; |
---|
63 | p = 1; |
---|
64 | q = 0; |
---|
65 | end |
---|
66 | SIX: |
---|
67 | if (j == 0) |
---|
68 | begin |
---|
69 | state = SEPT; |
---|
70 | p = 1; |
---|
71 | q = 1; |
---|
72 | end |
---|
73 | else |
---|
74 | begin |
---|
75 | state = TROIS; |
---|
76 | p = 1; |
---|
77 | q = 0; |
---|
78 | end |
---|
79 | SEPT: |
---|
80 | begin |
---|
81 | state = HUIT; |
---|
82 | p = 0; |
---|
83 | q = 1; |
---|
84 | end |
---|
85 | HUIT: |
---|
86 | begin |
---|
87 | state = NEUF; |
---|
88 | p = 1; |
---|
89 | q = 1; |
---|
90 | end |
---|
91 | NEUF: |
---|
92 | begin |
---|
93 | state = DIX; |
---|
94 | p = 0; |
---|
95 | q = 0; |
---|
96 | end |
---|
97 | DIX: |
---|
98 | begin |
---|
99 | state = DIX; |
---|
100 | p = 0; |
---|
101 | q = 0; |
---|
102 | end |
---|
103 | endcase |
---|
104 | |
---|
105 | end |
---|
106 | |
---|
107 | |
---|
108 | endmodule |
---|
Note: See
TracBrowser
for help on using the repository browser.