Hardware Reference
In-Depth Information
as well. Particular attention should be paid to the recommendations in comment 8,
which can be easily adapted from the Moore case to the Mealy case.
1 //Part 1: Module header:----------------------------------
2
(same as for category 1 Moore, section 7.3)
3
4 //Part 2: Declarations:-----------------------------------
5
(same as for category 1 Moore, section 7.3)
6
7 //Part 3: Statements:-------------------------------------
8
9
//FSM state register:
10
(same as for category 1 Moore, section 7.3)
11
12
//FSM combinational logic:
13
always_comb
14
case (pr_state)
15
A:
16
if (condition) begin
17
outp1 <= <value>;
18
outp2 <= <value>;
19
...
20
nx_state <= B;
21
end
22
else if (condition) begin
23
outp1 <= <value>;
24
outp2 <= <value>;
25
...
26
nx_state <= ...;
27
end
28
else begin
29
outp1 <= <value>;
30
outp2 <= <value>;
31
...
32
nx_state <= A;
33
end
34
B:
35
if (condition) begin
36
outp1 <= <value>;
37
outp2 <= <value>;
38
...
39
nx_state <= C;
40
end
41
else if (condition) begin
42
outp1 <= <value>;
43
outp2 <= <value>;
44
...
45
nx_state <= ...;
46
end
47
else begin
48
outp1 <= <value>;
49
outp2 <= <value>;
50
...
51
nx_state <= B;
52
end
Search WWH ::




Custom Search