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 | TROIS: |
---|
48 | begin |
---|
49 | state = QUATRE; |
---|
50 | p = 0; |
---|
51 | q = 1; |
---|
52 | end |
---|
53 | QUATRE: |
---|
54 | begin |
---|
55 | state = CINQ; |
---|
56 | p = 1; |
---|
57 | q = 0; |
---|
58 | end |
---|
59 | CINQ: |
---|
60 | begin |
---|
61 | state = CINQ; |
---|
62 | p = 1; |
---|
63 | q = 0; |
---|
64 | end |
---|
65 | SIX: |
---|
66 | if (j == 0) |
---|
67 | begin |
---|
68 | state = SEPT; |
---|
69 | p = 1; |
---|
70 | q = 1; |
---|
71 | end |
---|
72 | else |
---|
73 | begin |
---|
74 | state = TROIS; |
---|
75 | p = 1; |
---|
76 | q = 0; |
---|
77 | end |
---|
78 | SEPT: |
---|
79 | begin |
---|
80 | state = HUIT; |
---|
81 | p = 0; |
---|
82 | q = 1; |
---|
83 | end |
---|
84 | HUIT: |
---|
85 | begin |
---|
86 | state = NEUF; |
---|
87 | p = 1; |
---|
88 | q = 1; |
---|
89 | end |
---|
90 | NEUF: |
---|
91 | begin |
---|
92 | state = DIX; |
---|
93 | p = 0; |
---|
94 | q = 0; |
---|
95 | end |
---|
96 | DIX: |
---|
97 | begin |
---|
98 | state = DIX; |
---|
99 | p = 0; |
---|
100 | q = 0; |
---|
101 | end |
---|
102 | endcase |
---|
103 | |
---|
104 | end |
---|
105 | |
---|
106 | |
---|
107 | endmodule |
---|
Note: See
TracBrowser
for help on using the repository browser.