Line | |
---|
1 | module cex(ck,j); |
---|
2 | input ck; |
---|
3 | input j; |
---|
4 | wire nd_1; |
---|
5 | wire nd_2; |
---|
6 | wire nd_3; |
---|
7 | |
---|
8 | |
---|
9 | reg [2:0]state; |
---|
10 | reg s2; |
---|
11 | reg s3; |
---|
12 | reg s4; |
---|
13 | |
---|
14 | initial |
---|
15 | begin |
---|
16 | state[0] = 1; |
---|
17 | state[1] = 1; |
---|
18 | state[2] = $ND(0,1); |
---|
19 | if(state == 3) |
---|
20 | begin |
---|
21 | s2 = 0; |
---|
22 | s3 = $ND(0,1); |
---|
23 | s4 = $ND(0,1); |
---|
24 | end |
---|
25 | else |
---|
26 | begin |
---|
27 | s2 = 1; |
---|
28 | s3 = 0; |
---|
29 | s4 = 0; |
---|
30 | end |
---|
31 | end |
---|
32 | |
---|
33 | assign nd_1 = $ND(0,1); |
---|
34 | assign nd_2 = $ND(0,1); |
---|
35 | assign nd_3 = $ND(0,1); |
---|
36 | always @(posedge ck) |
---|
37 | begin |
---|
38 | case (state) |
---|
39 | 7 : |
---|
40 | if(j == 1) |
---|
41 | begin |
---|
42 | s2 = 1; |
---|
43 | s3 = 0; |
---|
44 | s4 = 0; |
---|
45 | state = 1; |
---|
46 | end |
---|
47 | else |
---|
48 | begin |
---|
49 | s2 = 0; |
---|
50 | s3 = nd_1; |
---|
51 | s4 = nd_2; |
---|
52 | state = 2; |
---|
53 | end |
---|
54 | |
---|
55 | 3: |
---|
56 | begin |
---|
57 | s2 = nd_3; |
---|
58 | s3 = nd_1; |
---|
59 | s4 = nd_2; |
---|
60 | state = 0; |
---|
61 | end |
---|
62 | 1: |
---|
63 | begin |
---|
64 | s2 = nd_3; |
---|
65 | s3 = 0; |
---|
66 | s4 = nd_2; |
---|
67 | state = 4; |
---|
68 | end |
---|
69 | 2: |
---|
70 | begin |
---|
71 | s2 = nd_3; |
---|
72 | s3 = nd_1; |
---|
73 | s4 = nd_2; |
---|
74 | state = 0; |
---|
75 | end |
---|
76 | 4: |
---|
77 | begin |
---|
78 | s2 = nd_3; |
---|
79 | s3 = nd_1; |
---|
80 | s4 = nd_2; |
---|
81 | state = 0; |
---|
82 | end |
---|
83 | 0: |
---|
84 | begin |
---|
85 | s2 = nd_3; |
---|
86 | s3 = nd_1; |
---|
87 | s4 = nd_2; |
---|
88 | state = 0; |
---|
89 | end |
---|
90 | |
---|
91 | |
---|
92 | endcase |
---|
93 | end |
---|
94 | |
---|
95 | endmodule |
---|
96 | |
---|
97 | |
---|
Note: See
TracBrowser
for help on using the repository browser.